OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/resources/bitmap_content_layer_updater.h" | 5 #include "cc/resources/bitmap_content_layer_updater.h" |
6 | 6 |
7 #include "cc/debug/devtools_instrumentation.h" | 7 #include "cc/debug/devtools_instrumentation.h" |
8 #include "cc/debug/rendering_stats_instrumentation.h" | 8 #include "cc/debug/rendering_stats_instrumentation.h" |
9 #include "cc/resources/layer_painter.h" | 9 #include "cc/resources/content_layer_painter.h" |
10 #include "cc/resources/prioritized_resource.h" | 10 #include "cc/resources/prioritized_resource.h" |
11 #include "cc/resources/resource_update.h" | 11 #include "cc/resources/resource_update.h" |
12 #include "cc/resources/resource_update_queue.h" | 12 #include "cc/resources/resource_update_queue.h" |
13 #include "skia/ext/platform_canvas.h" | 13 #include "skia/ext/platform_canvas.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 BitmapContentLayerUpdater::Resource::Resource( | 17 BitmapContentLayerUpdater::Resource::Resource( |
18 BitmapContentLayerUpdater* updater, | 18 BitmapContentLayerUpdater* updater, |
19 scoped_ptr<PrioritizedResource> texture) | 19 scoped_ptr<PrioritizedResource> texture) |
20 : LayerUpdater::Resource(texture.Pass()), updater_(updater) {} | 20 : LayerUpdater::Resource(texture.Pass()), updater_(updater) {} |
21 | 21 |
22 BitmapContentLayerUpdater::Resource::~Resource() {} | 22 BitmapContentLayerUpdater::Resource::~Resource() {} |
23 | 23 |
24 void BitmapContentLayerUpdater::Resource::Update( | 24 void BitmapContentLayerUpdater::Resource::Update( |
25 ResourceUpdateQueue* queue, | 25 ResourceUpdateQueue* queue, |
26 const gfx::Rect& source_rect, | 26 const gfx::Rect& source_rect, |
27 const gfx::Vector2d& dest_offset, | 27 const gfx::Vector2d& dest_offset, |
28 bool partial_update) { | 28 bool partial_update) { |
29 updater_->UpdateTexture( | 29 updater_->UpdateTexture( |
30 queue, texture(), source_rect, dest_offset, partial_update); | 30 queue, texture(), source_rect, dest_offset, partial_update); |
31 } | 31 } |
32 | 32 |
33 scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::Create( | 33 scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::Create( |
34 scoped_ptr<LayerPainter> painter, | 34 scoped_ptr<ContentLayerPainter> painter, |
35 RenderingStatsInstrumentation* stats_instrumentation, | 35 RenderingStatsInstrumentation* stats_instrumentation, |
36 int layer_id) { | 36 int layer_id) { |
37 return make_scoped_refptr( | 37 return make_scoped_refptr( |
38 new BitmapContentLayerUpdater(painter.Pass(), | 38 new BitmapContentLayerUpdater(painter.Pass(), |
39 stats_instrumentation, | 39 stats_instrumentation, |
40 layer_id)); | 40 layer_id)); |
41 } | 41 } |
42 | 42 |
43 BitmapContentLayerUpdater::BitmapContentLayerUpdater( | 43 BitmapContentLayerUpdater::BitmapContentLayerUpdater( |
44 scoped_ptr<LayerPainter> painter, | 44 scoped_ptr<ContentLayerPainter> painter, |
45 RenderingStatsInstrumentation* stats_instrumentation, | 45 RenderingStatsInstrumentation* stats_instrumentation, |
46 int layer_id) | 46 int layer_id) |
47 : ContentLayerUpdater(painter.Pass(), stats_instrumentation, layer_id) {} | 47 : ContentLayerUpdater(painter.Pass(), stats_instrumentation, layer_id) { |
| 48 } |
48 | 49 |
49 BitmapContentLayerUpdater::~BitmapContentLayerUpdater() {} | 50 BitmapContentLayerUpdater::~BitmapContentLayerUpdater() {} |
50 | 51 |
51 scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::CreateResource( | 52 scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::CreateResource( |
52 PrioritizedResourceManager* manager) { | 53 PrioritizedResourceManager* manager) { |
53 return scoped_ptr<LayerUpdater::Resource>( | 54 return scoped_ptr<LayerUpdater::Resource>( |
54 new Resource(this, PrioritizedResource::Create(manager))); | 55 new Resource(this, PrioritizedResource::Create(manager))); |
55 } | 56 } |
56 | 57 |
57 void BitmapContentLayerUpdater::PrepareToUpdate( | 58 void BitmapContentLayerUpdater::PrepareToUpdate( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { | 113 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { |
113 if (opaque != layer_is_opaque_) { | 114 if (opaque != layer_is_opaque_) { |
114 canvas_.clear(); | 115 canvas_.clear(); |
115 canvas_size_ = gfx::Size(); | 116 canvas_size_ = gfx::Size(); |
116 } | 117 } |
117 | 118 |
118 ContentLayerUpdater::SetOpaque(opaque); | 119 ContentLayerUpdater::SetOpaque(opaque); |
119 } | 120 } |
120 | 121 |
121 } // namespace cc | 122 } // namespace cc |
OLD | NEW |