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

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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/content_layer.cc ('k') | cc/resources/picture.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // We could either flatten the PicturePile into a single SkPicture, 184 // We could either flatten the PicturePile into a single SkPicture,
185 // or paint a fresh one depending on what we intend to do with the 185 // or paint a fresh one depending on what we intend to do with the
186 // picture. For now we just paint a fresh one to get consistent results. 186 // picture. For now we just paint a fresh one to get consistent results.
187 if (!DrawsContent()) 187 if (!DrawsContent())
188 return skia::RefPtr<SkPicture>(); 188 return skia::RefPtr<SkPicture>();
189 189
190 int width = bounds().width(); 190 int width = bounds().width();
191 int height = bounds().height(); 191 int height = bounds().height();
192 gfx::RectF opaque; 192 gfx::RectF opaque;
193 193
194 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); 194 SkPictureRecorder recorder;
195 SkCanvas* canvas = picture->beginRecording(width, height); 195 SkCanvas* canvas = recorder.beginRecording(width, height);
196 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque); 196 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque);
197 picture->endRecording(); 197 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
198 return picture; 198 return picture;
199 } 199 }
200 200
201 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 201 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
202 benchmark->RunOnLayer(this); 202 benchmark->RunOnLayer(this);
203 } 203 }
204 204
205 } // namespace cc 205 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/content_layer.cc ('k') | cc/resources/picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698