summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp')
-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