| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, | 68 float device_scale_factor, |
| 69 float page_scale_factor, | 69 float page_scale_factor, |
| 70 float maximum_animation_contents_scale, |
| 70 bool animating_transform_to_screen, | 71 bool animating_transform_to_screen, |
| 71 float* contents_scale_x, | 72 float* contents_scale_x, |
| 72 float* contents_scale_y, | 73 float* contents_scale_y, |
| 73 gfx::Size* content_bounds) { | 74 gfx::Size* content_bounds) { |
| 74 *contents_scale_x = ImageContentsScaleX(); | 75 *contents_scale_x = ImageContentsScaleX(); |
| 75 *contents_scale_y = ImageContentsScaleY(); | 76 *contents_scale_y = ImageContentsScaleY(); |
| 76 *content_bounds = gfx::Size(bitmap_.width(), bitmap_.height()); | 77 *content_bounds = gfx::Size(bitmap_.width(), bitmap_.height()); |
| 77 } | 78 } |
| 78 | 79 |
| 79 bool ImageLayer::DrawsContent() const { | 80 bool ImageLayer::DrawsContent() const { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 92 return static_cast<float>(bitmap_.width()) / bounds().width(); | 93 return static_cast<float>(bitmap_.width()) / bounds().width(); |
| 93 } | 94 } |
| 94 | 95 |
| 95 float ImageLayer::ImageContentsScaleY() const { | 96 float ImageLayer::ImageContentsScaleY() const { |
| 96 if (bounds().IsEmpty() || bitmap_.height() == 0) | 97 if (bounds().IsEmpty() || bitmap_.height() == 0) |
| 97 return 1; | 98 return 1; |
| 98 return static_cast<float>(bitmap_.height()) / bounds().height(); | 99 return static_cast<float>(bitmap_.height()) / bounds().height(); |
| 99 } | 100 } |
| 100 | 101 |
| 101 } // namespace cc | 102 } // namespace cc |
| OLD | NEW |