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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
9 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
10 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // We could either flatten the PicturePile into a single SkPicture, | 177 // We could either flatten the PicturePile into a single SkPicture, |
178 // or paint a fresh one depending on what we intend to do with the | 178 // or paint a fresh one depending on what we intend to do with the |
179 // picture. For now we just paint a fresh one to get consistent results. | 179 // picture. For now we just paint a fresh one to get consistent results. |
180 if (!DrawsContent()) | 180 if (!DrawsContent()) |
181 return skia::RefPtr<SkPicture>(); | 181 return skia::RefPtr<SkPicture>(); |
182 | 182 |
183 int width = bounds().width(); | 183 int width = bounds().width(); |
184 int height = bounds().height(); | 184 int height = bounds().height(); |
185 | 185 |
186 SkPictureRecorder recorder; | 186 SkPictureRecorder recorder; |
187 SkCanvas* canvas = recorder.beginRecording(width, height, NULL, 0); | 187 SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0); |
188 client_->PaintContents(canvas, | 188 client_->PaintContents(canvas, |
189 gfx::Rect(width, height), | 189 gfx::Rect(width, height), |
190 ContentLayerClient::GRAPHICS_CONTEXT_ENABLED); | 190 ContentLayerClient::GRAPHICS_CONTEXT_ENABLED); |
191 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); | 191 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
192 return picture; | 192 return picture; |
193 } | 193 } |
194 | 194 |
195 bool PictureLayer::IsSuitableForGpuRasterization() const { | 195 bool PictureLayer::IsSuitableForGpuRasterization() const { |
196 return pile_->is_suitable_for_gpu_rasterization(); | 196 return pile_->is_suitable_for_gpu_rasterization(); |
197 } | 197 } |
198 | 198 |
199 void PictureLayer::ClearClient() { | 199 void PictureLayer::ClearClient() { |
200 client_ = NULL; | 200 client_ = nullptr; |
201 UpdateDrawsContent(HasDrawableContent()); | 201 UpdateDrawsContent(HasDrawableContent()); |
202 } | 202 } |
203 | 203 |
204 bool PictureLayer::HasDrawableContent() const { | 204 bool PictureLayer::HasDrawableContent() const { |
205 return client_ && Layer::HasDrawableContent(); | 205 return client_ && Layer::HasDrawableContent(); |
206 } | 206 } |
207 | 207 |
208 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 208 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
209 benchmark->RunOnLayer(this); | 209 benchmark->RunOnLayer(this); |
210 } | 210 } |
211 | 211 |
212 } // namespace cc | 212 } // namespace cc |
OLD | NEW |