summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorNicolas Roard <nicolas@android.com>2009-08-12 14:56:59 +0100
committerNicolas Roard <nicolas@android.com>2009-08-12 15:38:58 +0100
commit95e3d862bbab761f8caaf1d1b54065f67b9a5148 (patch)
treea68c7eaeb75b06d7b1fee2b1b8a44f5e4cd0a04a /WebCore/platform
parent0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (diff)
downloadexternal_webkit-95e3d862bbab761f8caaf1d1b54065f67b9a5148.zip
external_webkit-95e3d862bbab761f8caaf1d1b54065f67b9a5148.tar.gz
external_webkit-95e3d862bbab761f8caaf1d1b54065f67b9a5148.tar.bz2
Fix merges and add #if PLATFORM(ANDROID)
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/DragImage.h8
-rw-r--r--WebCore/platform/graphics/FloatPoint.h17
-rw-r--r--WebCore/platform/graphics/Gradient.h17
-rw-r--r--WebCore/platform/graphics/ImageSource.h18
-rw-r--r--WebCore/platform/graphics/skia/SkiaUtils.cpp41
-rw-r--r--WebCore/platform/graphics/skia/SkiaUtils.h10
-rw-r--r--WebCore/platform/wx/TemporaryLinkStubs.cpp6
7 files changed, 51 insertions, 66 deletions
diff --git a/WebCore/platform/DragImage.h b/WebCore/platform/DragImage.h
index 3a946c0..0196971 100644
--- a/WebCore/platform/DragImage.h
+++ b/WebCore/platform/DragImage.h
@@ -71,13 +71,9 @@ namespace WebCore {
#elif PLATFORM(WX)
typedef wxDragImage* DragImageRef;
#elif PLATFORM(GTK)
-#ifdef MANUAL_MERGE_REQUIRED
+ typedef GdkPixBuf* DragImageRef;
+#elif PLATFORM(ANDROID)
typedef void* DragImageRef;
-#elif defined ANDROID
- typedef void* DragImageRef;
-#else // MANUAL_MERGE_REQUIRED
- typedef GdkPixbuf* DragImageRef;
-#endif // MANUAL_MERGE_REQUIRED
#endif
IntSize dragImageSize(DragImageRef);
diff --git a/WebCore/platform/graphics/FloatPoint.h b/WebCore/platform/graphics/FloatPoint.h
index a9850c9..157c1e7 100644
--- a/WebCore/platform/graphics/FloatPoint.h
+++ b/WebCore/platform/graphics/FloatPoint.h
@@ -51,15 +51,7 @@ class QPointF;
QT_END_NAMESPACE
#endif
-#ifdef MANUAL_MERGE_REQUIRED
-#if PLATFORM(SYMBIAN)
-class TPoint;
-#endif
-
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
-#else // MANUAL_MERGE_REQUIRED
#if PLATFORM(SKIA)
-#endif // MANUAL_MERGE_REQUIRED
struct SkPoint;
#endif
@@ -98,16 +90,7 @@ public:
operator QPointF() const;
#endif
-#ifdef MANUAL_MERGE_REQUIRED
-#if PLATFORM(SYMBIAN)
- operator TPoint() const;
- FloatPoint(const TPoint&);
-#endif
-
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
-#else // MANUAL_MERGE_REQUIRED
#if PLATFORM(SKIA)
-#endif // MANUAL_MERGE_REQUIRED
operator SkPoint() const;
FloatPoint(const SkPoint&);
#endif
diff --git a/WebCore/platform/graphics/Gradient.h b/WebCore/platform/graphics/Gradient.h
index 074c99d..bb4ac94 100644
--- a/WebCore/platform/graphics/Gradient.h
+++ b/WebCore/platform/graphics/Gradient.h
@@ -46,7 +46,7 @@ typedef QGradient* PlatformGradient;
#elif PLATFORM(CAIRO)
typedef struct _cairo_pattern cairo_pattern_t;
typedef cairo_pattern_t* PlatformGradient;
-#elif PLATFORM(SGL)
+#elif PLATFORM(ANDROID) && PLATFORM(SGL)
#include "SkShader.h"
typedef class PlatformGradientRec* PlatformGradient;
#elif PLATFORM(SKIA)
@@ -77,11 +77,6 @@ namespace WebCore {
void getColor(float value, float* r, float* g, float* b, float* a) const;
-#ifdef MANUAL_MERGE_REQUIRED
-#if PLATFORM(SGL)
- SkShader* getShader(SkShader::TileMode);
-#else
-#else // MANUAL_MERGE_REQUIRED
#if PLATFORM(WINCE) && !PLATFORM(QT)
const FloatPoint& p0() const { return m_p0; }
const FloatPoint& p1() const { return m_p1; }
@@ -91,14 +86,14 @@ namespace WebCore {
struct ColorStop;
const Vector<ColorStop>& getStops() const;
#else
-#endif // MANUAL_MERGE_REQUIRED
+
+#if PLATFORM(ANDROID) && PLATFORM(SGL)
+ SkShader* getShader(SkShader::TileMode);
+ PlatformGradient platformGradient();
+#else
PlatformGradient platformGradient();
-#ifdef MANUAL_MERGE_REQUIRED
#endif
-#else // MANUAL_MERGE_REQUIRED
-#endif
-#endif // MANUAL_MERGE_REQUIRED
struct ColorStop {
float stop;
float red;
diff --git a/WebCore/platform/graphics/ImageSource.h b/WebCore/platform/graphics/ImageSource.h
index c9ac03a..173d50b 100644
--- a/WebCore/platform/graphics/ImageSource.h
+++ b/WebCore/platform/graphics/ImageSource.h
@@ -45,7 +45,7 @@ QT_END_NAMESPACE
#elif PLATFORM(CAIRO)
struct _cairo_surface;
typedef struct _cairo_surface cairo_surface_t;
-#elif PLATFORM(SGL)
+#elif PLATFORM(ANDROID) && PLATFORM(SGL)
#include "SkString.h"
class SkBitmapRef;
class PrivateAndroidImageSourceRec;
@@ -77,7 +77,8 @@ typedef CGImageRef NativeImagePtr;
class ImageDecoderQt;
typedef ImageDecoderQt* NativeImageSourcePtr;
typedef QPixmap* NativeImagePtr;
-#elif PLATFORM(SGL)
+#elif PLATFORM(ANDROID)
+#if PLATFORM(SGL)
class String;
#ifdef ANDROID_ANIMATED_GIF
class ImageDecoder;
@@ -91,6 +92,11 @@ struct NativeImageSourcePtr {
};
typedef const Vector<char>* NativeBytePtr;
typedef SkBitmapRef* NativeImagePtr;
+#elif PLATFORM(SKIA) // ANDROID
+class ImageDecoder;
+typedef ImageDecoder* NativeImageSourcePtr;
+typedef NativeImageSkia* NativeImagePtr;
+#endif
#elif PLATFORM(CAIRO)
class ImageDecoder;
typedef ImageDecoder* NativeImageSourcePtr;
@@ -160,18 +166,18 @@ public:
bool frameHasAlphaAtIndex(size_t); // Whether or not the frame actually used any alpha.
bool frameIsCompleteAtIndex(size_t); // Whether or not the frame is completely decoded.
-#ifdef MANUAL_MERGE_REQUIRED
+#if PLATFORM(ANDROID)
#if PLATFORM(SGL)
void clearURL();
void setURL(const String& url);
#endif
+#endif
private:
+#if PLATFORM(ANDROID)
// FIXME: This is protected only to allow ImageSourceSkia to set ICO decoder
// with a preferred size. See ImageSourceSkia.h for discussion.
protected:
-#else // MANUAL_MERGE_REQUIRED
-private:
-#endif // MANUAL_MERGE_REQUIRED
+#endif
NativeImageSourcePtr m_decoder;
};
diff --git a/WebCore/platform/graphics/skia/SkiaUtils.cpp b/WebCore/platform/graphics/skia/SkiaUtils.cpp
index dbbbdbf..acb3669 100644
--- a/WebCore/platform/graphics/skia/SkiaUtils.cpp
+++ b/WebCore/platform/graphics/skia/SkiaUtils.cpp
@@ -42,7 +42,7 @@
namespace WebCore {
-#ifdef MANUAL_MERGE_REQUIRED
+#if PLATFORM(ANDROID)
static const struct CompositOpToSkiaMode {
uint8_t mCompositOp;
uint8_t mMode;
@@ -76,11 +76,10 @@ SkXfermode::Mode WebCoreCompositeToSkiaMode(CompositeOperator op)
SkDEBUGF(("GraphicsContext::setCompositeOperation uknown CompositeOperator %d\n", op));
return SkXfermode::kSrcOver_Mode; // fall-back
}
-
-static const struct CompositOpToPorterDuffMode {
-#else // MANUAL_MERGE_REQUIRED
+
+#endif
+
static const struct CompositOpToXfermodeMode {
-#endif // MANUAL_MERGE_REQUIRED
uint8_t mCompositOp;
uint8_t m_xfermodeMode;
} gMapCompositOpsToXfermodeModes[] = {
@@ -113,6 +112,7 @@ SkXfermode::Mode WebCoreCompositeToSkiaComposite(CompositeOperator op)
return SkXfermode::kSrcOver_Mode; // fall-back
}
+#if PLATFORM(ANDROID)
Color SkPMColorToWebCoreColor(SkPMColor pm)
{
SkColor c = SkUnPreMultiply::PMColorToColor(pm);
@@ -120,6 +120,32 @@ Color SkPMColorToWebCoreColor(SkPMColor pm)
return WebCore::Color((int)SkColorGetR(c), (int)SkColorGetG(c),
(int)SkColorGetB(c), (int)SkColorGetA(c));
}
+#else
+static U8CPU InvScaleByte(U8CPU component, uint32_t scale)
+{
+ SkASSERT(component == (uint8_t)component);
+ return (component * scale + 0x8000) >> 16;
+}
+
+SkColor SkPMColorToColor(SkPMColor pm)
+{
+ if (0 == pm)
+ return 0;
+
+ unsigned a = SkGetPackedA32(pm);
+ uint32_t scale = (255 << 16) / a;
+
+ return SkColorSetARGB(a,
+ InvScaleByte(SkGetPackedR32(pm), scale),
+ InvScaleByte(SkGetPackedG32(pm), scale),
+ InvScaleByte(SkGetPackedB32(pm), scale));
+}
+
+Color SkPMColorToWebCoreColor(SkPMColor pm)
+{
+ return SkPMColorToColor(pm);
+}
+#endif
void IntersectRectAndRegion(const SkRegion& region, const SkRect& srcRect, SkRect* destRect) {
// The cliperator requires an int rect, so we round out.
@@ -172,12 +198,7 @@ bool SkPathContainsPoint(SkPath* originalPath, const FloatPoint& point, SkPath::
SkPath scaledPath;
int scale = 1;
-#ifdef MANUAL_MERGE_REQUIRED
- SkRect bounds;
- bounds = originalPath->getBounds();
-#else // MANUAL_MERGE_REQUIRED
SkRect bounds = originalPath->getBounds();
-#endif // MANUAL_MERGE_REQUIRED
// We can immediately return false if the point is outside the bounding rect
if (!bounds.contains(SkFloatToScalar(point.x()), SkFloatToScalar(point.y())))
diff --git a/WebCore/platform/graphics/skia/SkiaUtils.h b/WebCore/platform/graphics/skia/SkiaUtils.h
index a210cd3..681dcd5 100644
--- a/WebCore/platform/graphics/skia/SkiaUtils.h
+++ b/WebCore/platform/graphics/skia/SkiaUtils.h
@@ -36,24 +36,14 @@
#include <wtf/MathExtras.h>
#include "GraphicsContext.h"
#include "SkPath.h"
-#ifdef MANUAL_MERGE_REQUIRED
-#include "SkPorterDuff.h"
#include "SkXfermode.h"
-#else // MANUAL_MERGE_REQUIRED
-#include "SkXfermode.h"
-#endif // MANUAL_MERGE_REQUIRED
class SkCanvas;
class SkRegion;
namespace WebCore {
-#ifdef MANUAL_MERGE_REQUIRED
-SkXfermode::Mode WebCoreCompositeToSkiaMode(CompositeOperator);
-SkPorterDuff::Mode WebCoreCompositeToSkiaComposite(CompositeOperator);
-#else // MANUAL_MERGE_REQUIRED
SkXfermode::Mode WebCoreCompositeToSkiaComposite(CompositeOperator);
-#endif // MANUAL_MERGE_REQUIRED
// move this guy into SkColor.h
SkColor SkPMColorToColor(SkPMColor);
diff --git a/WebCore/platform/wx/TemporaryLinkStubs.cpp b/WebCore/platform/wx/TemporaryLinkStubs.cpp
index 9f2cd91..2403527 100644
--- a/WebCore/platform/wx/TemporaryLinkStubs.cpp
+++ b/WebCore/platform/wx/TemporaryLinkStubs.cpp
@@ -118,13 +118,7 @@ void GraphicsContext::setLineJoin(LineJoin) { notImplemented(); }
void GraphicsContext::setMiterLimit(float) { notImplemented(); }
void GraphicsContext::setAlpha(float) { notImplemented(); }
-#ifdef MANUAL_MERGE_REQUIRED
-Color WebCore::focusRingColor() { return 0xFF0000FF; }
-
-void Image::drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, CompositeOperator, const FloatRect& destRect) { notImplemented(); }
-#else // MANUAL_MERGE_REQUIRED
void Image::drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, CompositeOperator, const FloatRect& destRect) { notImplemented(); }
-#endif // MANUAL_MERGE_REQUIRED
ScrollbarTheme* ScrollbarTheme::nativeTheme() { notImplemented(); static ScrollbarTheme theme; return &theme; }