OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/content_layer.h" | 5 #include "cc/layers/content_layer.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 153 } |
154 | 154 |
155 skia::RefPtr<SkPicture> ContentLayer::GetPicture() const { | 155 skia::RefPtr<SkPicture> ContentLayer::GetPicture() const { |
156 if (!DrawsContent()) | 156 if (!DrawsContent()) |
157 return skia::RefPtr<SkPicture>(); | 157 return skia::RefPtr<SkPicture>(); |
158 | 158 |
159 int width = bounds().width(); | 159 int width = bounds().width(); |
160 int height = bounds().height(); | 160 int height = bounds().height(); |
161 gfx::RectF opaque; | 161 gfx::RectF opaque; |
162 | 162 |
163 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); | 163 SkPictureRecorder recorder; |
164 SkCanvas* canvas = picture->beginRecording(width, height); | 164 SkCanvas* canvas = recorder.beginRecording(width, height); |
165 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque); | 165 client_->PaintContents(canvas, gfx::Rect(width, height), &opaque); |
166 picture->endRecording(); | 166 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
167 return picture; | 167 return picture; |
168 } | 168 } |
169 | 169 |
170 void ContentLayer::OnOutputSurfaceCreated() { | 170 void ContentLayer::OnOutputSurfaceCreated() { |
171 SetTextureFormat( | 171 SetTextureFormat( |
172 layer_tree_host()->GetRendererCapabilities().best_texture_format); | 172 layer_tree_host()->GetRendererCapabilities().best_texture_format); |
173 TiledLayer::OnOutputSurfaceCreated(); | 173 TiledLayer::OnOutputSurfaceCreated(); |
174 } | 174 } |
175 | 175 |
176 } // namespace cc | 176 } // namespace cc |
OLD | NEW |