| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (!DrawsContent()) | 118 if (!DrawsContent()) |
| 119 return skia::RefPtr<SkPicture>(); | 119 return skia::RefPtr<SkPicture>(); |
| 120 | 120 |
| 121 int width = bounds().width(); | 121 int width = bounds().width(); |
| 122 int height = bounds().height(); | 122 int height = bounds().height(); |
| 123 | 123 |
| 124 SkPictureRecorder recorder; | 124 SkPictureRecorder recorder; |
| 125 SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0); | 125 SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0); |
| 126 client_->PaintContents(canvas, gfx::Rect(width, height), | 126 client_->PaintContents(canvas, gfx::Rect(width, height), |
| 127 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); | 127 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); |
| 128 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); | 128 skia::RefPtr<SkPicture> picture = |
| 129 skia::AdoptRef(recorder.endRecordingAsPicture()); |
| 129 return picture; | 130 return picture; |
| 130 } | 131 } |
| 131 | 132 |
| 132 void ContentLayer::OnOutputSurfaceCreated() { | 133 void ContentLayer::OnOutputSurfaceCreated() { |
| 133 SetTextureFormat( | 134 SetTextureFormat( |
| 134 layer_tree_host()->GetRendererCapabilities().best_texture_format); | 135 layer_tree_host()->GetRendererCapabilities().best_texture_format); |
| 135 TiledLayer::OnOutputSurfaceCreated(); | 136 TiledLayer::OnOutputSurfaceCreated(); |
| 136 } | 137 } |
| 137 | 138 |
| 138 } // namespace cc | 139 } // namespace cc |
| OLD | NEW |