Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1950)

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp

Issue 2128903002: Use enclosingIntRect for the cull rect of DrawingDisplayItems. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rtree
Patch Set: none Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp b/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp
index 4558b88dcaa34853c96606257d7d6a9362a8a1bc..d75455fe88b177c245b30a98c302bae04c29755f 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp
@@ -32,7 +32,7 @@ bool DrawingRecorder::useCachedDrawingIfPossible(GraphicsContext& context, const
return true;
}
-DrawingRecorder::DrawingRecorder(GraphicsContext& context, const DisplayItemClient& displayItemClient, DisplayItem::Type displayItemType, const FloatRect& cullRect)
+DrawingRecorder::DrawingRecorder(GraphicsContext& context, const DisplayItemClient& displayItemClient, DisplayItem::Type displayItemType, const FloatRect& floatCullRect)
: m_context(context)
, m_displayItemClient(displayItemClient)
, m_displayItemType(displayItemType)
@@ -55,6 +55,9 @@ DrawingRecorder::DrawingRecorder(GraphicsContext& context, const DisplayItemClie
context.setInDrawingRecorder(true);
#endif
+ // Use the enclosing int rect, since pixel-snapping may be applied to the bounds of the object during painting. Potentially expanding
+ // the cull rect by a pixel or two also does not affect correctness, and is very unlikely to matter for performance.
+ IntRect cullRect = enclosingIntRect(floatCullRect);
context.beginRecording(cullRect);
#if ENABLE(ASSERT)
@@ -63,13 +66,12 @@ DrawingRecorder::DrawingRecorder(GraphicsContext& context, const DisplayItemClie
// cull rect clipping is enabled, make this explicit. This allows us to identify potential
// incorrect cull rects that might otherwise be masked due to Skia internal optimizations.
context.save();
- IntRect verificationClip = enclosingIntRect(cullRect);
// Expand the verification clip by one pixel to account for Skia's SkCanvas::getClipBounds()
// expansion, used in testing cull rects.
// TODO(schenney) This is not the best place to do this. Ideally, we would expand by one pixel
// in device (pixel) space, but to do that we would need to add the verification mode to Skia.
- verificationClip.inflate(1);
- context.clipRect(verificationClip, NotAntiAliased, SkRegion::kIntersect_Op);
+ cullRect.inflate(1);
+ context.clipRect(cullRect, NotAntiAliased, SkRegion::kIntersect_Op);
}
#endif
}
« no previous file with comments | « third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698