| 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 namespace cc { | 7 namespace cc { |
| 8 | 8 |
| 9 FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, | 9 FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, |
| 10 scoped_ptr<PrioritizedResource> texture) | 10 scoped_ptr<PrioritizedResource> texture) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 TiledLayer::SetNeedsDisplayRect(rect); | 90 TiledLayer::SetNeedsDisplayRect(rect); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void FakeTiledLayer::SetTexturePriorities( | 93 void FakeTiledLayer::SetTexturePriorities( |
| 94 const PriorityCalculator& calculator) { | 94 const PriorityCalculator& calculator) { |
| 95 // Ensure there is always a target render surface available. If none has been | 95 // Ensure there is always a target render surface available. If none has been |
| 96 // set (the layer is an orphan for the test), then just set a surface on | 96 // set (the layer is an orphan for the test), then just set a surface on |
| 97 // itself. | 97 // itself. |
| 98 bool missing_target_render_surface = !render_target(); | 98 bool missing_target_render_surface = !render_target(); |
| 99 | 99 |
| 100 if (missing_target_render_surface) | 100 if (missing_target_render_surface) { |
| 101 CreateRenderSurface(); | 101 CreateRenderSurface(); |
| 102 draw_properties().render_target = this; |
| 103 } |
| 102 | 104 |
| 103 TiledLayer::SetTexturePriorities(calculator); | 105 TiledLayer::SetTexturePriorities(calculator); |
| 104 | 106 |
| 105 if (missing_target_render_surface) { | 107 if (missing_target_render_surface) { |
| 106 ClearRenderSurface(); | 108 ClearRenderSurface(); |
| 107 draw_properties().render_target = 0; | 109 draw_properties().render_target = 0; |
| 108 } | 110 } |
| 109 } | 111 } |
| 110 | 112 |
| 111 PrioritizedResourceManager* FakeTiledLayer::ResourceManager() { | 113 PrioritizedResourceManager* FakeTiledLayer::ResourceManager() { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 float* contents_scale_y, | 157 float* contents_scale_y, |
| 156 gfx::Size* content_bounds) { | 158 gfx::Size* content_bounds) { |
| 157 *contents_scale_x = | 159 *contents_scale_x = |
| 158 static_cast<float>(forced_content_bounds_.width()) / bounds().width(); | 160 static_cast<float>(forced_content_bounds_.width()) / bounds().width(); |
| 159 *contents_scale_y = | 161 *contents_scale_y = |
| 160 static_cast<float>(forced_content_bounds_.height()) / bounds().height(); | 162 static_cast<float>(forced_content_bounds_.height()) / bounds().height(); |
| 161 *content_bounds = forced_content_bounds_; | 163 *content_bounds = forced_content_bounds_; |
| 162 } | 164 } |
| 163 | 165 |
| 164 } // namespace cc | 166 } // namespace cc |
| OLD | NEW |