summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/skia
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-05-22 14:45:14 -0700
committerJohn Reck <jreck@google.com>2012-05-22 14:45:14 -0700
commita1bc0f8df743e553d30b5564f1807f5fa678e2f5 (patch)
tree907a84f22553558c842d671e112d29dce39a2d41 /Source/WebCore/platform/graphics/skia
parent45aaa37ec3809f4220214dd57c3dc50b7b5dd0d9 (diff)
downloadexternal_webkit-a1bc0f8df743e553d30b5564f1807f5fa678e2f5.zip
external_webkit-a1bc0f8df743e553d30b5564f1807f5fa678e2f5.tar.gz
external_webkit-a1bc0f8df743e553d30b5564f1807f5fa678e2f5.tar.bz2
Don't use an ImageBuffer for scratchContext()
Bug: 6509450 Change-Id: I6d952b92062e96772663824839b0229062c3a524
Diffstat (limited to 'Source/WebCore/platform/graphics/skia')
-rw-r--r--Source/WebCore/platform/graphics/skia/SkiaUtils.cpp20
1 files changed, 20 insertions, 0 deletions
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