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

Unified Diff: cc/resources/picture.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/layers/picture_layer.cc ('k') | cc/resources/picture_pile_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture.cc
diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc
index 93b59aea7435532456ab03b9248113b8e5c8d46c..f9020e8730ea786263ea5dc3186a45d1f2663703 100644
--- a/cc/resources/picture.cc
+++ b/cc/resources/picture.cc
@@ -249,17 +249,21 @@ void Picture::Record(ContentLayerClient* painter,
DCHECK(!picture_);
DCHECK(!tile_grid_info.fTileInterval.isEmpty());
- picture_ = skia::AdoptRef(new SkTileGridPicture(
- layer_rect_.width(), layer_rect_.height(), tile_grid_info));
+
+ skia::RefPtr<SkPictureFactory> factory =
+ skia::AdoptRef(new SkTileGridPictureFactory(tile_grid_info));
+ SkPictureRecorder recorder(factory.get());
skia::RefPtr<SkCanvas> canvas;
+ canvas = skia::SharePtr(recorder.beginRecording(
+ layer_rect_.width(),
+ layer_rect_.height(),
+ SkPicture::kUsePathBoundsForClip_RecordingFlag |
+ SkPicture::kOptimizeForClippedPlayback_RecordingFlag));
+
switch (recording_mode) {
case RECORD_NORMALLY:
- canvas = skia::SharePtr(picture_->beginRecording(
- layer_rect_.width(),
- layer_rect_.height(),
- SkPicture::kUsePathBoundsForClip_RecordingFlag |
- SkPicture::kOptimizeForClippedPlayback_RecordingFlag));
+ // Already setup for normal recording
break;
case RECORD_WITH_SK_NULL_CANVAS:
canvas = skia::AdoptRef(SkCreateNullCanvas());
@@ -267,6 +271,7 @@ void Picture::Record(ContentLayerClient* painter,
case RECORD_WITH_PAINTING_DISABLED:
// Blink's GraphicsContext will disable painting when given a NULL
// canvas.
+ canvas.clear();
break;
default:
NOTREACHED();
@@ -289,8 +294,8 @@ void Picture::Record(ContentLayerClient* painter,
if (canvas)
canvas->restore();
- if (picture_->getRecordingCanvas())
- picture_->endRecording();
+ picture_ = skia::AdoptRef(recorder.endRecording());
+ DCHECK(picture_);
opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect);
« no previous file with comments | « cc/layers/picture_layer.cc ('k') | cc/resources/picture_pile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698