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

Unified Diff: skia/ext/pixel_ref_utils.cc

Issue 1279843004: cc: Plumb more details about pixel refs to tile manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « skia/ext/pixel_ref_utils.h ('k') | skia/ext/pixel_ref_utils_unittest.cc » ('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 49254b18fbcb18833fd63ff24ec0c3f1696ae27c..d7e2f7e62efa7f9cdc448a5d58a8b5b2c55a941a 100644
--- a/skia/ext/pixel_ref_utils.cc
+++ b/skia/ext/pixel_ref_utils.cc
@@ -100,7 +100,7 @@ class GatherPixelRefDevice : public SkBitmapDevice {
if (GetBitmapFromPaint(paint, &bitmap)) {
SkRect mapped_rect;
draw.fMatrix->mapRect(&mapped_rect, rect);
- if (mapped_rect.intersect(SkRect::Make(draw.fRC->getBounds()))) {
+ if (mapped_rect.intersects(SkRect::Make(draw.fRC->getBounds()))) {
AddBitmap(bitmap, mapped_rect, *draw.fMatrix, paint.getFilterQuality());
}
}
@@ -355,10 +355,8 @@ class GatherPixelRefDevice : public SkBitmapDevice {
const SkMatrix& matrix,
SkFilterQuality filter_quality) {
SkRect canvas_rect = SkRect::MakeWH(width(), height());
- SkRect paint_rect = SkRect::MakeEmpty();
- if (paint_rect.intersect(rect, canvas_rect)) {
- pixel_ref_set_->Add(bm.pixelRef(), paint_rect, matrix,
- filter_quality);
+ if (rect.intersects(canvas_rect)) {
+ pixel_ref_set_->Add(bm.pixelRef(), rect, matrix, filter_quality);
}
}
@@ -385,14 +383,14 @@ void PixelRefUtils::GatherDiscardablePixelRefs(
SkRect picture_bounds = picture->cullRect();
SkIRect picture_ibounds = picture_bounds.roundOut();
SkBitmap empty_bitmap;
- empty_bitmap.setInfo(SkImageInfo::MakeUnknown(picture_ibounds.width(),
- picture_ibounds.height()));
+ // Use right/bottom as the size so that we don't need a translate and, as a
+ // result, the information is returned relative to the picture's origin.
+ empty_bitmap.setInfo(SkImageInfo::MakeUnknown(picture_ibounds.right(),
+ picture_ibounds.bottom()));
GatherPixelRefDevice device(empty_bitmap, &pixel_ref_set);
SkNoSaveLayerCanvas canvas(&device);
- // 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/ext/pixel_ref_utils.h ('k') | skia/ext/pixel_ref_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698