diff options
author | John Reck <jreck@google.com> | 2012-05-22 14:45:14 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2012-05-22 14:45:14 -0700 |
commit | a1bc0f8df743e553d30b5564f1807f5fa678e2f5 (patch) | |
tree | 907a84f22553558c842d671e112d29dce39a2d41 /Source/WebCore/platform/graphics | |
parent | 45aaa37ec3809f4220214dd57c3dc50b7b5dd0d9 (diff) | |
download | external_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')
-rw-r--r-- | Source/WebCore/platform/graphics/android/PathAndroid.cpp | 2 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/skia/SkiaUtils.cpp | 20 |
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 |