summaryrefslogtreecommitdiff
path: root/chromium/plat_support
diff options
context:
space:
mode:
authorJonathan Dixon <joth@google.com>2013-09-06 18:25:30 -0700
committerJonathan Dixon <joth@google.com>2013-10-23 23:26:32 +0000
commit86abeb66b6f8237f85ccce79495f15ace437a96a (patch)
treed86638e9c976a36df2165e1684b4f0aad9b9a3a0 /chromium/plat_support
parent031cc89c1a241b593fd851cd3f8a96188fb2cbcf (diff)
downloadwebview-86abeb66b6f8237f85ccce79495f15ace437a96a.tar.gz
Optimize the complex clip case
Bug 10152369 This can save considerable time on each draw Change-Id: Id195f1e691f1cbc92efcbfdf357fa93e01e4e241 (cherry picked from commit 3603a870e2edfac7b6430796971eca72b6d02924)
Diffstat (limited to 'chromium/plat_support')
-rw-r--r--chromium/plat_support/graphics_utils.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/chromium/plat_support/graphics_utils.cpp b/chromium/plat_support/graphics_utils.cpp
index e584f93..f717707 100644
--- a/chromium/plat_support/graphics_utils.cpp
+++ b/chromium/plat_support/graphics_utils.cpp
@@ -60,6 +60,16 @@ AwPixelInfo* GetPixels(JNIEnv* env, jobject java_canvas) {
if (!canvas)
return NULL;
+ // Workarounds for http://crbug.com/271096: SW draw only supports
+ // translate & scale transforms, and a simple rectangular clip.
+ // (This also avoids significant wasted time in calling
+ // SkCanvasStateUtils::CaptureCanvasState when the clip is complex).
+ if (!canvas->getTotalClip().isRect() ||
+ (canvas->getTotalMatrix().getType() &
+ ~(SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask))) {
+ return NULL;
+ }
+
UniquePtr<PixelInfo> pixels(new PixelInfo(canvas));
return pixels->state ? pixels.release() : NULL;
}