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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 updater_ = ImageLayerUpdater::Create(); | 58 updater_ = ImageLayerUpdater::Create(); |
59 SetTextureFormat( | 59 SetTextureFormat( |
60 layer_tree_host()->GetRendererCapabilities().best_texture_format); | 60 layer_tree_host()->GetRendererCapabilities().best_texture_format); |
61 } | 61 } |
62 | 62 |
63 LayerUpdater* ImageLayer::Updater() const { | 63 LayerUpdater* ImageLayer::Updater() const { |
64 return updater_.get(); | 64 return updater_.get(); |
65 } | 65 } |
66 | 66 |
67 void ImageLayer::CalculateContentsScale(float ideal_contents_scale, | 67 void ImageLayer::CalculateContentsScale(float ideal_contents_scale, |
68 float device_scale_factor, | |
69 float page_scale_factor, | |
70 float maximum_animation_contents_scale, | |
71 bool animating_transform_to_screen, | |
72 float* contents_scale_x, | 68 float* contents_scale_x, |
73 float* contents_scale_y, | 69 float* contents_scale_y, |
74 gfx::Size* content_bounds) { | 70 gfx::Size* content_bounds) { |
75 *contents_scale_x = ImageContentsScaleX(); | 71 *contents_scale_x = ImageContentsScaleX(); |
76 *contents_scale_y = ImageContentsScaleY(); | 72 *contents_scale_y = ImageContentsScaleY(); |
77 *content_bounds = gfx::Size(bitmap_.width(), bitmap_.height()); | 73 *content_bounds = gfx::Size(bitmap_.width(), bitmap_.height()); |
78 } | 74 } |
79 | 75 |
80 bool ImageLayer::DrawsContent() const { | 76 bool ImageLayer::DrawsContent() const { |
81 return !bitmap_.isNull() && TiledLayer::DrawsContent(); | 77 return !bitmap_.isNull() && TiledLayer::DrawsContent(); |
(...skipping 11 matching lines...) Expand all Loading... |
93 return static_cast<float>(bitmap_.width()) / bounds().width(); | 89 return static_cast<float>(bitmap_.width()) / bounds().width(); |
94 } | 90 } |
95 | 91 |
96 float ImageLayer::ImageContentsScaleY() const { | 92 float ImageLayer::ImageContentsScaleY() const { |
97 if (bounds().IsEmpty() || bitmap_.height() == 0) | 93 if (bounds().IsEmpty() || bitmap_.height() == 0) |
98 return 1; | 94 return 1; |
99 return static_cast<float>(bitmap_.height()) / bounds().height(); | 95 return static_cast<float>(bitmap_.height()) / bounds().height(); |
100 } | 96 } |
101 | 97 |
102 } // namespace cc | 98 } // namespace cc |
OLD | NEW |