From 8b15717bb02c9101e8c621affd41a2e5c2cc8636 Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Thu, 7 Nov 2013 22:20:31 +0000 Subject: [PATCH] "Fix" bug in debug canvas https://codereview.chromium.org/59073008/ git-svn-id: http://skia.googlecode.com/svn/trunk@12180 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/utils/debugger/SkDebugCanvas.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp index 53b531cf2d..8d35782f85 100644 --- a/src/utils/debugger/SkDebugCanvas.cpp +++ b/src/utils/debugger/SkDebugCanvas.cpp @@ -35,6 +35,24 @@ SkDebugCanvas::SkDebugCanvas(int width, int height) fFilter = false; fIndex = 0; fUserMatrix.reset(); + + // SkPicturePlayback uses the base-class' quickReject calls to cull clipped + // operations. This can lead to problems in the debugger which expects all + // the operations in the captured skp to appear in the debug canvas. To + // circumvent this we create a wide open clip here (an empty clip rect + // is not sufficient). + // Internally, the SkRect passed to clipRect is converted to an SkIRect and + // rounded out. The following code creates a nearly maximal rect that will + // not get collapsed by the coming conversions (Due to precision loss the + // inset has to be surprisingly large). + SkIRect largeIRect = SkIRect::MakeLargest(); + largeIRect.inset(1024, 1024); + SkRect large = SkRect::MakeFromIRect(largeIRect); +#ifdef SK_DEBUG + large.roundOut(&largeIRect); + SkASSERT(!largeIRect.isEmpty()); +#endif + INHERITED::clipRect(large, SkRegion::kReplace_Op, false); } SkDebugCanvas::~SkDebugCanvas() {