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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() { |
55 if (updater_.get()) | 55 if (updater_.get()) |
56 return; | 56 return; |
57 | 57 |
58 updater_ = ImageLayerUpdater::Create(); | 58 updater_ = ImageLayerUpdater::Create(); |
59 GLenum texture_format = | 59 SetTextureFormat( |
60 layer_tree_host()->GetRendererCapabilities().best_texture_format; | 60 layer_tree_host()->GetRendererCapabilities().best_texture_format); |
61 SetTextureFormat(texture_format); | |
62 } | 61 } |
63 | 62 |
64 LayerUpdater* ImageLayer::Updater() const { | 63 LayerUpdater* ImageLayer::Updater() const { |
65 return updater_.get(); | 64 return updater_.get(); |
66 } | 65 } |
67 | 66 |
68 void ImageLayer::CalculateContentsScale(float ideal_contents_scale, | 67 void ImageLayer::CalculateContentsScale(float ideal_contents_scale, |
69 float device_scale_factor, | 68 float device_scale_factor, |
70 float page_scale_factor, | 69 float page_scale_factor, |
71 bool animating_transform_to_screen, | 70 bool animating_transform_to_screen, |
(...skipping 15 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 |