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

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: 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
Index: cc/resources/picture.cc
diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc
index 93b59aea7435532456ab03b9248113b8e5c8d46c..03ddec0226595e9814dbfa6379c64f9bd1f68423 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,7 @@ void Picture::Record(ContentLayerClient* painter,
if (canvas)
canvas->restore();
- if (picture_->getRecordingCanvas())
- picture_->endRecording();
+ picture_ = skia::AdoptRef(recorder.endRecording());
opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect);

Powered by Google App Engine
This is Rietveld 408576698