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

Unified Diff: cc/playback/discardable_image_map.cc

Issue 2743203006: cc: Outset image rects by 1 for the purposes of the rtree. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | cc/playback/discardable_image_map_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/discardable_image_map.cc
diff --git a/cc/playback/discardable_image_map.cc b/cc/playback/discardable_image_map.cc
index 7e1abd6640bd83f8173b65cc565260b55e9c0a52..b5927f2b5ecadc4190746189be49aec65cf377ae 100644
--- a/cc/playback/discardable_image_map.cc
+++ b/cc/playback/discardable_image_map.cc
@@ -172,6 +172,7 @@ class DiscardableImagesMetadataCanvas : public SkNWayCanvas {
return false;
*paint_bounds = paint.computeFastBounds(*paint_bounds, paint_bounds);
}
+
return true;
}
@@ -202,6 +203,18 @@ class DiscardableImagesMetadataCanvas : public SkNWayCanvas {
src_rect.roundOut(&src_irect);
gfx::Rect image_rect = SafeClampPaintRectToSize(paint_rect, canvas_size_);
+ // During raster, we use the device clip bounds on the canvas, which outsets
+ // the actual clip by 1 due to the possibility of antialiasing. Account for
+ // this here by outsetting the image rect by 1. Note that this only affects
+ // queries into the rtree, which will now return images that only touch the
+ // bounds of the query rect.
+ //
+ // Note that it's not sufficient for us to inset the device clip bounds at
+ // raster time, since we might be sending a larger-than-one-item display
+ // item to skia, which means that skia will internally determine whether to
+ // raster the picture (using device clip bounds that are outset).
+ image_rect.Inset(-1, -1);
+
(*image_id_to_rect_)[image->uniqueID()].Union(image_rect);
image_set_->push_back(std::make_pair(
DrawImage(std::move(image), src_irect, filter_quality, matrix),
« no previous file with comments | « no previous file | cc/playback/discardable_image_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698