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

Unified Diff: cc/layers/picture_image_layer.cc

Issue 1409713002: cc: Remove cc::ContentLayerClient::PaintContents(SkCanvas*, ...). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restore comment Created 5 years, 2 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 | « cc/layers/picture_image_layer.h ('k') | cc/layers/picture_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_image_layer.cc
diff --git a/cc/layers/picture_image_layer.cc b/cc/layers/picture_image_layer.cc
index ee129330b3ef7b3acfc53014a95135a343378245..f2caeaf199d58086eb5756533efefaadaad13566 100644
--- a/cc/layers/picture_image_layer.cc
+++ b/cc/layers/picture_image_layer.cc
@@ -49,14 +49,23 @@ void PictureImageLayer::SetImage(skia::RefPtr<const SkImage> image) {
SetNeedsDisplay();
}
-void PictureImageLayer::PaintContents(
- SkCanvas* canvas,
+scoped_refptr<DisplayItemList> PictureImageLayer::PaintContentsToDisplayList(
const gfx::Rect& clip,
ContentLayerClient::PaintingControlSetting painting_control) {
DCHECK(image_);
DCHECK_GT(image_->width(), 0);
DCHECK_GT(image_->height(), 0);
+ // Picture image layers can be used with GatherPixelRefs, so cached SkPictures
+ // are currently required.
+ DisplayItemListSettings settings;
+ settings.use_cached_picture = true;
+ scoped_refptr<DisplayItemList> display_list =
+ DisplayItemList::Create(clip, settings);
+
+ SkPictureRecorder recorder;
+ SkCanvas* canvas = recorder.beginRecording(gfx::RectToSkRect(clip));
+
SkScalar content_to_layer_scale_x =
SkFloatToScalar(static_cast<float>(bounds().width()) / image_->width());
SkScalar content_to_layer_scale_y =
@@ -67,21 +76,6 @@ void PictureImageLayer::PaintContents(
// to the root canvas, this draw must use the kSrcOver_Mode so that
// transparent images blend correctly.
canvas->drawImage(image_.get(), 0, 0);
-}
-
-scoped_refptr<DisplayItemList> PictureImageLayer::PaintContentsToDisplayList(
- const gfx::Rect& clip,
- ContentLayerClient::PaintingControlSetting painting_control) {
- // Picture image layers can be used with GatherPixelRefs, so cached SkPictures
- // are currently required.
- DisplayItemListSettings settings;
- settings.use_cached_picture = true;
- scoped_refptr<DisplayItemList> display_list =
- DisplayItemList::Create(clip, settings);
-
- SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(gfx::RectToSkRect(clip));
- PaintContents(canvas, clip, painting_control);
skia::RefPtr<SkPicture> picture =
skia::AdoptRef(recorder.endRecordingAsPicture());
« no previous file with comments | « cc/layers/picture_image_layer.h ('k') | cc/layers/picture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698