| 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 bool ImageLayer::Update(ResourceUpdateQueue* queue, | 43 bool ImageLayer::Update(ResourceUpdateQueue* queue, |
| 44 const OcclusionTracker* occlusion) { | 44 const OcclusionTracker<Layer>* occlusion) { |
| 45 CreateUpdaterIfNeeded(); | 45 CreateUpdaterIfNeeded(); |
| 46 if (!updater_->UsingBitmap(bitmap_)) { | 46 if (!updater_->UsingBitmap(bitmap_)) { |
| 47 updater_->SetBitmap(bitmap_); | 47 updater_->SetBitmap(bitmap_); |
| 48 UpdateTileSizeAndTilingOption(); | 48 UpdateTileSizeAndTilingOption(); |
| 49 InvalidateContentRect(gfx::Rect(content_bounds())); | 49 InvalidateContentRect(gfx::Rect(content_bounds())); |
| 50 } | 50 } |
| 51 return TiledLayer::Update(queue, occlusion); | 51 return TiledLayer::Update(queue, occlusion); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void ImageLayer::CreateUpdaterIfNeeded() { | 54 void ImageLayer::CreateUpdaterIfNeeded() { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return static_cast<float>(bitmap_.width()) / bounds().width(); | 92 return static_cast<float>(bitmap_.width()) / bounds().width(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 float ImageLayer::ImageContentsScaleY() const { | 95 float ImageLayer::ImageContentsScaleY() const { |
| 96 if (bounds().IsEmpty() || bitmap_.height() == 0) | 96 if (bounds().IsEmpty() || bitmap_.height() == 0) |
| 97 return 1; | 97 return 1; |
| 98 return static_cast<float>(bitmap_.height()) / bounds().height(); | 98 return static_cast<float>(bitmap_.height()) / bounds().height(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace cc | 101 } // namespace cc |
| OLD | NEW |