OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/test/tiled_layer_test_common.h" | 5 #include "cc/test/tiled_layer_test_common.h" |
6 | 6 |
7 using cc::LayerTilingData; | 7 using cc::LayerTilingData; |
8 using cc::LayerUpdater; | 8 using cc::LayerUpdater; |
9 using cc::PriorityCalculator; | 9 using cc::PriorityCalculator; |
10 using cc::PrioritizedResource; | 10 using cc::PrioritizedResource; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 clearRenderSurface(); | 127 clearRenderSurface(); |
128 drawProperties().render_target = 0; | 128 drawProperties().render_target = 0; |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 cc::PrioritizedResourceManager* FakeTiledLayer::resourceManager() const | 132 cc::PrioritizedResourceManager* FakeTiledLayer::resourceManager() const |
133 { | 133 { |
134 return m_resourceManager; | 134 return m_resourceManager; |
135 } | 135 } |
136 | 136 |
| 137 void FakeTiledLayer::updateContentsScale(float idealContentsScale) |
| 138 { |
| 139 calculateContentsScale( |
| 140 idealContentsScale, |
| 141 &drawProperties().contents_scale_x, |
| 142 &drawProperties().contents_scale_y, |
| 143 &drawProperties().content_bounds); |
| 144 } |
| 145 |
137 cc::LayerUpdater* FakeTiledLayer::updater() const | 146 cc::LayerUpdater* FakeTiledLayer::updater() const |
138 { | 147 { |
139 return m_fakeUpdater.get(); | 148 return m_fakeUpdater.get(); |
140 } | 149 } |
141 | 150 |
142 gfx::Size FakeTiledLayerWithScaledBounds::contentBounds() const | 151 void FakeTiledLayerWithScaledBounds::setContentBounds(const gfx::Size& contentBo
unds) |
143 { | 152 { |
144 return m_forcedContentBounds; | 153 m_forcedContentBounds = contentBounds; |
| 154 drawProperties().content_bounds = m_forcedContentBounds; |
145 } | 155 } |
146 | 156 |
147 float FakeTiledLayerWithScaledBounds::contentsScaleX() const | 157 void FakeTiledLayerWithScaledBounds::calculateContentsScale( |
| 158 float idealContentsScale, |
| 159 float* contentsScaleX, |
| 160 float* contentsScaleY, |
| 161 gfx::Size* contentBounds) |
148 { | 162 { |
149 return static_cast<float>(m_forcedContentBounds.width()) / bounds().width(); | 163 *contentsScaleX = static_cast<float>(m_forcedContentBounds.width()) / bounds
().width(); |
| 164 *contentsScaleY = static_cast<float>(m_forcedContentBounds.height()) / bound
s().height(); |
| 165 *contentBounds = m_forcedContentBounds; |
150 } | 166 } |
151 | 167 |
152 float FakeTiledLayerWithScaledBounds::contentsScaleY() const | 168 void FakeTiledLayerWithScaledBounds::didUpdateBounds() |
153 { | 169 { |
154 return static_cast<float>(m_forcedContentBounds.height()) / bounds().height(
); | 170 drawProperties().content_bounds = m_forcedContentBounds; |
155 } | |
156 | |
157 void FakeTiledLayerWithScaledBounds::setContentsScale(float) | |
158 { | |
159 NOTREACHED(); | |
160 } | 171 } |
161 | 172 |
162 } // namespace | 173 } // namespace |
OLD | NEW |