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 12 matching lines...) Expand all Loading... |
23 ContentLayerClient* client) { | 23 ContentLayerClient* client) { |
24 return make_scoped_ptr(new ContentLayerPainter(client)); | 24 return make_scoped_ptr(new ContentLayerPainter(client)); |
25 } | 25 } |
26 | 26 |
27 void ContentLayerPainter::Paint(SkCanvas* canvas, | 27 void ContentLayerPainter::Paint(SkCanvas* canvas, |
28 const gfx::Rect& content_rect) { | 28 const gfx::Rect& content_rect) { |
29 client_->PaintContents(canvas, content_rect, | 29 client_->PaintContents(canvas, content_rect, |
30 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); | 30 ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); |
31 } | 31 } |
32 | 32 |
33 scoped_refptr<ContentLayer> ContentLayer::Create(ContentLayerClient* client) { | 33 scoped_refptr<ContentLayer> ContentLayer::Create(const LayerSettings& settings, |
34 return make_scoped_refptr(new ContentLayer(client)); | 34 ContentLayerClient* client) { |
| 35 return make_scoped_refptr(new ContentLayer(settings, client)); |
35 } | 36 } |
36 | 37 |
37 ContentLayer::ContentLayer(ContentLayerClient* client) | 38 ContentLayer::ContentLayer(const LayerSettings& settings, |
38 : TiledLayer(), client_(client) { | 39 ContentLayerClient* client) |
| 40 : TiledLayer(settings), client_(client) { |
39 } | 41 } |
40 | 42 |
41 ContentLayer::~ContentLayer() {} | 43 ContentLayer::~ContentLayer() {} |
42 | 44 |
43 void ContentLayer::ClearClient() { | 45 void ContentLayer::ClearClient() { |
44 client_ = nullptr; | 46 client_ = nullptr; |
45 UpdateDrawsContent(HasDrawableContent()); | 47 UpdateDrawsContent(HasDrawableContent()); |
46 } | 48 } |
47 | 49 |
48 bool ContentLayer::HasDrawableContent() const { | 50 bool ContentLayer::HasDrawableContent() const { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return picture; | 132 return picture; |
131 } | 133 } |
132 | 134 |
133 void ContentLayer::OnOutputSurfaceCreated() { | 135 void ContentLayer::OnOutputSurfaceCreated() { |
134 SetTextureFormat( | 136 SetTextureFormat( |
135 layer_tree_host()->GetRendererCapabilities().best_texture_format); | 137 layer_tree_host()->GetRendererCapabilities().best_texture_format); |
136 TiledLayer::OnOutputSurfaceCreated(); | 138 TiledLayer::OnOutputSurfaceCreated(); |
137 } | 139 } |
138 | 140 |
139 } // namespace cc | 141 } // namespace cc |
OLD | NEW |