From 7dd8f78fa87060920d37643e4ae84cbe1aa6acd8 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Mon, 10 Sep 2012 16:11:14 -0700 Subject: Disable clipping painter when painting 400+ operations bug:7128794 Change-Id: Id36dbedcb7c8245fc6f37dbf938b085da3e0ae93 --- .../android/context/PlatformGraphicsContextRecording.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- cgit v1.1