summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/platform/graphics/android/PathAndroid.cpp2
-rw-r--r--Source/WebCore/platform/graphics/skia/SkiaUtils.cpp20
2 files changed, 21 insertions, 1 deletions
diff --git a/Source/WebCore/platform/graphics/android/PathAndroid.cpp b/Source/WebCore/platform/graphics/android/PathAndroid.cpp
index 436da59..554e187 100644
--- a/Source/WebCore/platform/graphics/android/PathAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/PathAndroid.cpp
@@ -286,7 +286,7 @@ void Path::transform(const AffineTransform& xform)
///////////////////////////////////////////////////////////////////////////////
FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) const
-{
+{
GraphicsContext* scratch = scratchContext();
scratch->save();
diff --git a/Source/WebCore/platform/graphics/skia/SkiaUtils.cpp b/Source/WebCore/platform/graphics/skia/SkiaUtils.cpp
index da83793..ebd9f0d 100644
--- a/Source/WebCore/platform/graphics/skia/SkiaUtils.cpp
+++ b/Source/WebCore/platform/graphics/skia/SkiaUtils.cpp
@@ -40,6 +40,11 @@
#include "SkRegion.h"
#include "SkUnPreMultiply.h"
+#if PLATFORM(ANDROID)
+#include "GraphicsContext.h"
+#include "PlatformGraphicsContextSkia.h"
+#endif
+
namespace WebCore {
#if PLATFORM(ANDROID)
@@ -246,6 +251,20 @@ bool SkPathContainsPoint(SkPath* originalPath, const FloatPoint& point, SkPath::
return contains;
}
+#if PLATFORM(ANDROID)
+GraphicsContext* scratchContext()
+{
+ static GraphicsContext* scratch = 0;
+ if (!scratch) {
+ SkBitmap bm;
+ bm.setConfig(SkBitmap::kNo_Config, 1, 1);
+ SkCanvas* canvas = new SkCanvas(bm);
+ PlatformGraphicsContextSkia* pgc = new PlatformGraphicsContextSkia(canvas);
+ scratch = new GraphicsContext(pgc);
+ }
+ return scratch;
+}
+#else
GraphicsContext* scratchContext()
{
static ImageBuffer* scratch = ImageBuffer::create(IntSize(1, 1)).leakPtr();
@@ -253,5 +272,6 @@ GraphicsContext* scratchContext()
// ImageBuffer initializer won't fail.
return scratch->context();
}
+#endif
} // namespace WebCore