| 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/image_layer.h" | 5 #include "cc/layers/image_layer.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "cc/resources/image_layer_updater.h" | 8 #include "cc/resources/image_layer_updater.h" |
| 9 #include "cc/resources/layer_updater.h" | 9 #include "cc/resources/layer_updater.h" |
| 10 #include "cc/resources/prioritized_resource.h" | 10 #include "cc/resources/prioritized_resource.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 void ImageLayer::SetTexturePriorities(const PriorityCalculator& priority_calc) { | 36 void ImageLayer::SetTexturePriorities(const PriorityCalculator& priority_calc) { |
| 37 // Update the tile data before creating all the layer's tiles. | 37 // Update the tile data before creating all the layer's tiles. |
| 38 UpdateTileSizeAndTilingOption(); | 38 UpdateTileSizeAndTilingOption(); |
| 39 | 39 |
| 40 TiledLayer::SetTexturePriorities(priority_calc); | 40 TiledLayer::SetTexturePriorities(priority_calc); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void ImageLayer::Update(ResourceUpdateQueue* queue, | 43 void ImageLayer::Update(ResourceUpdateQueue* queue, |
| 44 const OcclusionTracker* occlusion, | 44 const OcclusionTracker* occlusion) { |
| 45 RenderingStats* stats) { | |
| 46 CreateUpdaterIfNeeded(); | 45 CreateUpdaterIfNeeded(); |
| 47 if (needs_display_) { | 46 if (needs_display_) { |
| 48 updater_->set_bitmap(bitmap_); | 47 updater_->set_bitmap(bitmap_); |
| 49 UpdateTileSizeAndTilingOption(); | 48 UpdateTileSizeAndTilingOption(); |
| 50 InvalidateContentRect(gfx::Rect(content_bounds())); | 49 InvalidateContentRect(gfx::Rect(content_bounds())); |
| 51 needs_display_ = false; | 50 needs_display_ = false; |
| 52 } | 51 } |
| 53 TiledLayer::Update(queue, occlusion, stats); | 52 TiledLayer::Update(queue, occlusion); |
| 54 } | 53 } |
| 55 | 54 |
| 56 void ImageLayer::CreateUpdaterIfNeeded() { | 55 void ImageLayer::CreateUpdaterIfNeeded() { |
| 57 if (updater_) | 56 if (updater_) |
| 58 return; | 57 return; |
| 59 | 58 |
| 60 updater_ = ImageLayerUpdater::Create(); | 59 updater_ = ImageLayerUpdater::Create(); |
| 61 GLenum texture_format = | 60 GLenum texture_format = |
| 62 layer_tree_host()->GetRendererCapabilities().best_texture_format; | 61 layer_tree_host()->GetRendererCapabilities().best_texture_format; |
| 63 SetTextureFormat(texture_format); | 62 SetTextureFormat(texture_format); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 87 return static_cast<float>(bitmap_.width()) / bounds().width(); | 86 return static_cast<float>(bitmap_.width()) / bounds().width(); |
| 88 } | 87 } |
| 89 | 88 |
| 90 float ImageLayer::ImageContentsScaleY() const { | 89 float ImageLayer::ImageContentsScaleY() const { |
| 91 if (bounds().IsEmpty() || bitmap_.height() == 0) | 90 if (bounds().IsEmpty() || bitmap_.height() == 0) |
| 92 return 1; | 91 return 1; |
| 93 return static_cast<float>(bitmap_.height()) / bounds().height(); | 92 return static_cast<float>(bitmap_.height()) / bounds().height(); |
| 94 } | 93 } |
| 95 | 94 |
| 96 } // namespace cc | 95 } // namespace cc |
| OLD | NEW |