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 11 matching lines...) Expand all Loading... |
22 ResourceUpdate upload = ResourceUpdate::Create( | 22 ResourceUpdate upload = ResourceUpdate::Create( |
23 texture(), &bitmap_, kRect, kRect, gfx::Vector2d()); | 23 texture(), &bitmap_, kRect, kRect, gfx::Vector2d()); |
24 if (partial_update) | 24 if (partial_update) |
25 queue->AppendPartialUpload(upload); | 25 queue->AppendPartialUpload(upload); |
26 else | 26 else |
27 queue->AppendFullUpload(upload); | 27 queue->AppendFullUpload(upload); |
28 | 28 |
29 layer_->Update(); | 29 layer_->Update(); |
30 } | 30 } |
31 | 31 |
32 FakeLayerUpdater::FakeLayerUpdater() : prepare_count_(0), update_count_(0) {} | 32 FakeLayerUpdater::FakeLayerUpdater() |
| 33 : prepare_count_(0), update_count_(0), last_contents_width_scale_(0.f) { |
| 34 } |
33 | 35 |
34 FakeLayerUpdater::~FakeLayerUpdater() {} | 36 FakeLayerUpdater::~FakeLayerUpdater() {} |
35 | 37 |
36 void FakeLayerUpdater::PrepareToUpdate(const gfx::Rect& content_rect, | 38 void FakeLayerUpdater::PrepareToUpdate(const gfx::Size& content_size, |
| 39 const gfx::Rect& paint_rect, |
37 const gfx::Size& tile_size, | 40 const gfx::Size& tile_size, |
38 float contents_width_scale, | 41 float contents_width_scale, |
39 float contents_height_scale) { | 42 float contents_height_scale) { |
40 prepare_count_++; | 43 prepare_count_++; |
41 last_update_rect_ = content_rect; | 44 last_update_rect_ = paint_rect; |
| 45 last_contents_width_scale_ = contents_width_scale; |
42 if (!rect_to_invalidate_.IsEmpty()) { | 46 if (!rect_to_invalidate_.IsEmpty()) { |
43 layer_->InvalidateContentRect(rect_to_invalidate_); | 47 layer_->InvalidateContentRect(rect_to_invalidate_); |
44 rect_to_invalidate_ = gfx::Rect(); | 48 rect_to_invalidate_ = gfx::Rect(); |
45 layer_ = NULL; | 49 layer_ = NULL; |
46 } | 50 } |
47 } | 51 } |
48 | 52 |
49 void FakeLayerUpdater::SetRectToInvalidate(const gfx::Rect& rect, | 53 void FakeLayerUpdater::SetRectToInvalidate(const gfx::Rect& rect, |
50 FakeTiledLayer* layer) { | 54 FakeTiledLayer* layer) { |
51 rect_to_invalidate_ = rect; | 55 rect_to_invalidate_ = rect; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 float* contents_scale_y, | 157 float* contents_scale_y, |
154 gfx::Size* content_bounds) { | 158 gfx::Size* content_bounds) { |
155 *contents_scale_x = | 159 *contents_scale_x = |
156 static_cast<float>(forced_content_bounds_.width()) / bounds().width(); | 160 static_cast<float>(forced_content_bounds_.width()) / bounds().width(); |
157 *contents_scale_y = | 161 *contents_scale_y = |
158 static_cast<float>(forced_content_bounds_.height()) / bounds().height(); | 162 static_cast<float>(forced_content_bounds_.height()) / bounds().height(); |
159 *content_bounds = forced_content_bounds_; | 163 *content_bounds = forced_content_bounds_; |
160 } | 164 } |
161 | 165 |
162 } // namespace cc | 166 } // namespace cc |
OLD | NEW |