summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-09-10 16:11:14 -0700
committerChris Craik <ccraik@google.com>2012-09-10 16:11:14 -0700
commit7dd8f78fa87060920d37643e4ae84cbe1aa6acd8 (patch)
treeaa8eeeaca8692f874b1a0fe3dec7f0c1290cedb5
parent7fe521c630ad9fb57d288c5d59af5ad4630ca166 (diff)
downloadexternal_webkit-7dd8f78fa87060920d37643e4ae84cbe1aa6acd8.zip
external_webkit-7dd8f78fa87060920d37643e4ae84cbe1aa6acd8.tar.gz
external_webkit-7dd8f78fa87060920d37643e4ae84cbe1aa6acd8.tar.bz2
Disable clipping painter when painting 400+ operations
bug:7128794 Change-Id: Id36dbedcb7c8245fc6f37dbf938b085da3e0ae93
-rw-r--r--Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp
index 3237a80..03d9b81 100644
--- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp
+++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp
@@ -47,8 +47,14 @@
#define NEW_OP(X) new (heap()) GraphicsOperation::X
#define USE_CLIPPING_PAINTER true
+
+// Operations smaller than this area aren't considered opaque, and thus don't
+// clip operations below. Chosen empirically.
#define MIN_TRACKED_OPAQUE_AREA 750
+// Cap on ClippingPainter's recursive depth. Chosen empirically.
+#define MAX_CLIPPING_RECURSION_COUNT 400
+
namespace WebCore {
static FloatRect approximateTextBounds(size_t numGlyphs,
@@ -445,7 +451,8 @@ void Recording::draw(SkCanvas* canvas)
nonCopyingSort(nodes.begin(), nodes.end(), CompareRecordingDataOrder);
PlatformGraphicsContextSkia context(canvas);
#if USE_CLIPPING_PAINTER
- if (canvas->getDevice() && canvas->getDevice()->config() != SkBitmap::kNo_Config) {
+ if (canvas->getDevice() && canvas->getDevice()->config() != SkBitmap::kNo_Config
+ && count < MAX_CLIPPING_RECURSION_COUNT) {
ClippingPainter painter(recording(), context, canvas->getTotalMatrix(), nodes);
painter.draw(canvas->getTotalClip().getBounds());
} else