Optimize the complex clip case

Bug 10152369

This can save considerable time on each draw

Change-Id: Id195f1e691f1cbc92efcbfdf357fa93e01e4e241
(cherry picked from commit 3603a870e2edfac7b6430796971eca72b6d02924)
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 @@
   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;
 }