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 17 matching lines...) Expand all Loading... |
28 queue->AppendFullUpload(upload); | 28 queue->AppendFullUpload(upload); |
29 | 29 |
30 layer_->Update(); | 30 layer_->Update(); |
31 } | 31 } |
32 | 32 |
33 FakeLayerUpdater::FakeLayerUpdater() : prepare_count_(0), update_count_(0) {} | 33 FakeLayerUpdater::FakeLayerUpdater() : prepare_count_(0), update_count_(0) {} |
34 | 34 |
35 FakeLayerUpdater::~FakeLayerUpdater() {} | 35 FakeLayerUpdater::~FakeLayerUpdater() {} |
36 | 36 |
37 void FakeLayerUpdater::PrepareToUpdate(const gfx::Rect& content_rect, | 37 void FakeLayerUpdater::PrepareToUpdate(const gfx::Rect& content_rect, |
38 gfx::Size tile_size, | 38 const gfx::Size& tile_size, |
39 float contents_width_scale, | 39 float contents_width_scale, |
40 float contents_height_scale, | 40 float contents_height_scale, |
41 gfx::Rect* resulting_opaque_rect) { | 41 gfx::Rect* resulting_opaque_rect) { |
42 prepare_count_++; | 42 prepare_count_++; |
43 last_update_rect_ = content_rect; | 43 last_update_rect_ = content_rect; |
44 if (!rect_to_invalidate_.IsEmpty()) { | 44 if (!rect_to_invalidate_.IsEmpty()) { |
45 layer_->InvalidateContentRect(rect_to_invalidate_); | 45 layer_->InvalidateContentRect(rect_to_invalidate_); |
46 rect_to_invalidate_ = gfx::Rect(); | 46 rect_to_invalidate_ = gfx::Rect(); |
47 layer_ = NULL; | 47 layer_ = NULL; |
48 } | 48 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 ++num; | 141 ++num; |
142 } | 142 } |
143 num_dependents_need_push_properties_ = num; | 143 num_dependents_need_push_properties_ = num; |
144 } | 144 } |
145 | 145 |
146 LayerUpdater* FakeTiledLayer::Updater() const { | 146 LayerUpdater* FakeTiledLayer::Updater() const { |
147 return fake_updater_.get(); | 147 return fake_updater_.get(); |
148 } | 148 } |
149 | 149 |
150 void FakeTiledLayerWithScaledBounds::SetContentBounds( | 150 void FakeTiledLayerWithScaledBounds::SetContentBounds( |
151 gfx::Size content_bounds) { | 151 const gfx::Size& content_bounds) { |
152 forced_content_bounds_ = content_bounds; | 152 forced_content_bounds_ = content_bounds; |
153 draw_properties().content_bounds = forced_content_bounds_; | 153 draw_properties().content_bounds = forced_content_bounds_; |
154 } | 154 } |
155 | 155 |
156 void FakeTiledLayerWithScaledBounds::CalculateContentsScale( | 156 void FakeTiledLayerWithScaledBounds::CalculateContentsScale( |
157 float ideal_contents_scale, | 157 float ideal_contents_scale, |
158 float device_scale_factor, | 158 float device_scale_factor, |
159 float page_scale_factor, | 159 float page_scale_factor, |
160 bool animating_transform_to_screen, | 160 bool animating_transform_to_screen, |
161 float* contents_scale_x, | 161 float* contents_scale_x, |
162 float* contents_scale_y, | 162 float* contents_scale_y, |
163 gfx::Size* content_bounds) { | 163 gfx::Size* content_bounds) { |
164 *contents_scale_x = | 164 *contents_scale_x = |
165 static_cast<float>(forced_content_bounds_.width()) / bounds().width(); | 165 static_cast<float>(forced_content_bounds_.width()) / bounds().width(); |
166 *contents_scale_y = | 166 *contents_scale_y = |
167 static_cast<float>(forced_content_bounds_.height()) / bounds().height(); | 167 static_cast<float>(forced_content_bounds_.height()) / bounds().height(); |
168 *content_bounds = forced_content_bounds_; | 168 *content_bounds = forced_content_bounds_; |
169 } | 169 } |
170 | 170 |
171 } // namespace cc | 171 } // namespace cc |
OLD | NEW |