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

Side by Side Diff: cc/layers/picture_layer.cc

Issue 236633008: Switching Chromium to use new Skia SkPictureRecorder API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address code review issue 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/picture_layer.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "cc/layers/content_layer_client.h" 7 #include "cc/layers/content_layer_client.h"
8 #include "cc/layers/picture_layer_impl.h" 8 #include "cc/layers/picture_layer_impl.h"
9 #include "cc/trees/layer_tree_impl.h" 9 #include "cc/trees/layer_tree_impl.h"
10 #include "ui/gfx/rect_conversions.h" 10 #include "ui/gfx/rect_conversions.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // We could either flatten the PicturePile into a single SkPicture, 179 // We could either flatten the PicturePile into a single SkPicture,
180 // or paint a fresh one depending on what we intend to do with the 180 // or paint a fresh one depending on what we intend to do with the
181 // picture. For now we just paint a fresh one to get consistent results. 181 // picture. For now we just paint a fresh one to get consistent results.
182 if (!DrawsContent()) 182 if (!DrawsContent())
183 return skia::RefPtr<SkPicture>(); 183 return skia::RefPtr<SkPicture>();
184 184
185 int width = bounds().width(); 185 int width = bounds().width();
186 int height = bounds().height(); 186 int height = bounds().height();
187 gfx::RectF opaque; 187 gfx::RectF opaque;
188 188
189 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); 189 SkPictureRecorder recorder;
190 SkCanvas* canvas = picture->beginRecording(width, height); 190 SkCanvas* canvas = recorder.beginRecording(width, height);
191 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque); 191 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque);
192 picture->endRecording(); 192 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
193 return picture; 193 return picture;
194 } 194 }
195 195
196 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 196 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
197 benchmark->RunOnLayer(this); 197 benchmark->RunOnLayer(this);
198 } 198 }
199 199
200 } // namespace cc 200 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/content_layer.cc ('k') | cc/resources/picture.cc » ('j') | cc/resources/picture.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698