OLD | NEW |
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 Loading... |
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 |
OLD | NEW |