| 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/rendering_stats.h" | 7 #include "cc/debug/rendering_stats_instrumentation.h" |
| 8 #include "cc/resources/layer_painter.h" | 8 #include "cc/resources/layer_painter.h" |
| 9 #include "cc/resources/prioritized_resource.h" | 9 #include "cc/resources/prioritized_resource.h" |
| 10 #include "cc/resources/resource_update.h" | 10 #include "cc/resources/resource_update.h" |
| 11 #include "cc/resources/resource_update_queue.h" | 11 #include "cc/resources/resource_update_queue.h" |
| 12 #include "skia/ext/platform_canvas.h" | 12 #include "skia/ext/platform_canvas.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 BitmapContentLayerUpdater::Resource::Resource( | 16 BitmapContentLayerUpdater::Resource::Resource( |
| 17 BitmapContentLayerUpdater* updater, | 17 BitmapContentLayerUpdater* updater, |
| 18 scoped_ptr<PrioritizedResource> texture) | 18 scoped_ptr<PrioritizedResource> texture) |
| 19 : LayerUpdater::Resource(texture.Pass()), updater_(updater) {} | 19 : LayerUpdater::Resource(texture.Pass()), updater_(updater) {} |
| 20 | 20 |
| 21 BitmapContentLayerUpdater::Resource::~Resource() {} | 21 BitmapContentLayerUpdater::Resource::~Resource() {} |
| 22 | 22 |
| 23 void BitmapContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, | 23 void BitmapContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, |
| 24 gfx::Rect source_rect, | 24 gfx::Rect source_rect, |
| 25 gfx::Vector2d dest_offset, | 25 gfx::Vector2d dest_offset, |
| 26 bool partial_update, | 26 bool partial_update, |
| 27 RenderingStats* stats) { | 27 RenderingStats* stats) { |
| 28 updater_->UpdateTexture( | 28 updater_->UpdateTexture( |
| 29 queue, texture(), source_rect, dest_offset, partial_update); | 29 queue, texture(), source_rect, dest_offset, partial_update); |
| 30 } | 30 } |
| 31 | 31 |
| 32 scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::Create( | 32 scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::Create( |
| 33 scoped_ptr<LayerPainter> painter) { | 33 scoped_ptr<LayerPainter> painter, |
| 34 return make_scoped_refptr(new BitmapContentLayerUpdater(painter.Pass())); | 34 RenderingStatsInstrumentation* stats_instrumentation) { |
| 35 return make_scoped_refptr( |
| 36 new BitmapContentLayerUpdater(painter.Pass(), stats_instrumentation)); |
| 35 } | 37 } |
| 36 | 38 |
| 37 BitmapContentLayerUpdater::BitmapContentLayerUpdater( | 39 BitmapContentLayerUpdater::BitmapContentLayerUpdater( |
| 38 scoped_ptr<LayerPainter> painter) | 40 scoped_ptr<LayerPainter> painter, |
| 39 : ContentLayerUpdater(painter.Pass()), opaque_(false) {} | 41 RenderingStatsInstrumentation* stats_instrumentation) |
| 42 : ContentLayerUpdater(painter.Pass(), stats_instrumentation), |
| 43 opaque_(false) {} |
| 40 | 44 |
| 41 BitmapContentLayerUpdater::~BitmapContentLayerUpdater() {} | 45 BitmapContentLayerUpdater::~BitmapContentLayerUpdater() {} |
| 42 | 46 |
| 43 scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::CreateResource( | 47 scoped_ptr<LayerUpdater::Resource> BitmapContentLayerUpdater::CreateResource( |
| 44 PrioritizedResourceManager* manager) { | 48 PrioritizedResourceManager* manager) { |
| 45 return scoped_ptr<LayerUpdater::Resource>( | 49 return scoped_ptr<LayerUpdater::Resource>( |
| 46 new Resource(this, PrioritizedResource::Create(manager))); | 50 new Resource(this, PrioritizedResource::Create(manager))); |
| 47 } | 51 } |
| 48 | 52 |
| 49 void BitmapContentLayerUpdater::PrepareToUpdate( | 53 void BitmapContentLayerUpdater::PrepareToUpdate( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 95 |
| 92 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { | 96 void BitmapContentLayerUpdater::SetOpaque(bool opaque) { |
| 93 if (opaque != opaque_) { | 97 if (opaque != opaque_) { |
| 94 canvas_.reset(); | 98 canvas_.reset(); |
| 95 canvas_size_ = gfx::Size(); | 99 canvas_size_ = gfx::Size(); |
| 96 } | 100 } |
| 97 opaque_ = opaque; | 101 opaque_ = opaque; |
| 98 } | 102 } |
| 99 | 103 |
| 100 } // namespace cc | 104 } // namespace cc |
| OLD | NEW |