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

Unified Diff: cc/resources/skpicture_content_layer_updater.cc

Issue 236633008: Switching Chromium to use new Skia SkPictureRecorder API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to ToT Created 6 years, 8 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/resources/skpicture_content_layer_updater.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/skpicture_content_layer_updater.cc
diff --git a/cc/resources/skpicture_content_layer_updater.cc b/cc/resources/skpicture_content_layer_updater.cc
index b100778275593eae6625d8f20599cb47396ea016..645258a16b313625f48db2c4ca19ad508bd14785 100644
--- a/cc/resources/skpicture_content_layer_updater.cc
+++ b/cc/resources/skpicture_content_layer_updater.cc
@@ -27,8 +27,9 @@ void SkPictureContentLayerUpdater::PrepareToUpdate(
float contents_width_scale,
float contents_height_scale,
gfx::Rect* resulting_opaque_rect) {
+ SkPictureRecorder recorder;
SkCanvas* canvas =
- picture_.beginRecording(content_rect.width(), content_rect.height());
+ recorder.beginRecording(content_rect.width(), content_rect.height());
DCHECK_EQ(content_rect.width(), canvas->getBaseLayerSize().width());
DCHECK_EQ(content_rect.height(), canvas->getBaseLayerSize().height());
base::TimeTicks start_time =
@@ -42,12 +43,13 @@ void SkPictureContentLayerUpdater::PrepareToUpdate(
rendering_stats_instrumentation_->EndRecording(start_time);
rendering_stats_instrumentation_->AddRecord(
duration, content_rect.width() * content_rect.height());
- picture_.endRecording();
+ picture_ = skia::AdoptRef(recorder.endRecording());
}
void SkPictureContentLayerUpdater::DrawPicture(SkCanvas* canvas) {
TRACE_EVENT0("cc", "SkPictureContentLayerUpdater::DrawPicture");
- canvas->drawPicture(picture_);
+ if (picture_)
+ canvas->drawPicture(*picture_);
}
} // namespace cc
« no previous file with comments | « cc/resources/skpicture_content_layer_updater.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698