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 |