summaryrefslogtreecommitdiff
path: root/chromium/plat_support
diff options
context:
space:
mode:
authorJonathan Dixon <joth@google.com>2013-07-22 20:08:22 -0700
committerJonathan Dixon <joth@google.com>2013-07-23 13:01:54 -0700
commit52dbec0d199461e4631cec25f8f0706c8ece3029 (patch)
tree29b7c46a8da88f3fd5e2b003c81a88567d17ab32 /chromium/plat_support
parent245b3a6a2a7850a46536a423594286e04e702006 (diff)
downloadwebview-52dbec0d199461e4631cec25f8f0706c8ece3029.tar.gz
Fix rendering error when Canvas has a layer
Bug: 9953588 We were using the top device to access bitmap (good) but then using the aggregate layer-stack of matrix and clip (bad). Now consistently uses the top layer to get all this information. Change-Id: Ia093cd334965e338ff2714cc023330836ffac27a
Diffstat (limited to 'chromium/plat_support')
-rw-r--r--chromium/plat_support/graphics_utils.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/chromium/plat_support/graphics_utils.cpp b/chromium/plat_support/graphics_utils.cpp
index e7da2b0..4dc2966 100644
--- a/chromium/plat_support/graphics_utils.cpp
+++ b/chromium/plat_support/graphics_utils.cpp
@@ -50,7 +50,9 @@ struct PixelInfo : public AwPixelInfo {
AwPixelInfo* GetPixels(JNIEnv* env, jobject java_canvas) {
SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, java_canvas);
if (!canvas) return NULL;
- SkDevice* device = canvas->getTopDevice(true);
+ SkCanvas::LayerIter layer(SkCanvas::LayerIter(canvas, false));
+ if (layer.done()) return NULL;
+ SkDevice* device = layer.device();
if (!device) return NULL;
const SkBitmap* bitmap = &device->accessBitmap(true);
if (!bitmap->lockPixelsAreWritable()) return NULL;
@@ -61,14 +63,12 @@ AwPixelInfo* GetPixels(JNIEnv* env, jobject java_canvas) {
pixels->height = bitmap->height();
pixels->row_bytes = bitmap->rowBytes();
pixels->pixels = bitmap->getPixels();
- const SkMatrix& matrix = canvas->getTotalMatrix();
+ const SkMatrix& matrix = layer.matrix();
for (int i = 0; i < 9; i++) {
pixels->matrix[i] = matrix.get(i);
}
- // TODO: getTotalClip() is now marked as deprecated, but the replacement,
- // getClipDeviceBounds, does not return the exact region, just the bounds.
- // Work out what we should use instead.
- const SkRegion& region = canvas->getTotalClip();
+
+ const SkRegion& region = layer.clip();
pixels->clip_region = NULL;
pixels->clip_region_size = region.writeToMemory(NULL);
if (pixels->clip_region_size) {