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

Unified Diff: skia/ext/pixel_ref_utils.cc

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « skia/config/SkUserConfig.h ('k') | skia/ext/skia_utils_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/pixel_ref_utils.cc
diff --git a/skia/ext/pixel_ref_utils.cc b/skia/ext/pixel_ref_utils.cc
index 324adbdf78112ab4662655e6c17d9af0ae5425b8..777c2533024945fe611130eaabded6bdded516d8 100644
--- a/skia/ext/pixel_ref_utils.cc
+++ b/skia/ext/pixel_ref_utils.cc
@@ -351,15 +351,17 @@ void PixelRefUtils::GatherDiscardablePixelRefs(
pixel_refs->clear();
DiscardablePixelRefSet pixel_ref_set(pixel_refs);
+ SkRect picture_bounds = picture->cullRect();
+ SkIRect picture_ibounds = picture_bounds.roundOut();
SkBitmap empty_bitmap;
- empty_bitmap.setInfo(SkImageInfo::MakeUnknown(picture->width(), picture->height()));
+ empty_bitmap.setInfo(SkImageInfo::MakeUnknown(picture_ibounds.width(),
+ picture_ibounds.height()));
GatherPixelRefDevice device(empty_bitmap, &pixel_ref_set);
SkNoSaveLayerCanvas canvas(&device);
- canvas.clipRect(SkRect::MakeWH(picture->width(), picture->height()),
- SkRegion::kIntersect_Op,
- false);
+ // Draw the picture pinned against our top/left corner.
+ canvas.translate(-picture_bounds.left(), -picture_bounds.top());
canvas.drawPicture(picture);
}
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | skia/ext/skia_utils_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698