| 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::Rect& content_rect, |
| 37 const gfx::Size& tile_size, | 39 const gfx::Size& tile_size, |
| 38 float contents_width_scale, | 40 float contents_width_scale, |
| 39 float contents_height_scale) { | 41 float contents_height_scale) { |
| 40 prepare_count_++; | 42 prepare_count_++; |
| 41 last_update_rect_ = content_rect; | 43 last_update_rect_ = content_rect; |
| 44 last_contents_width_scale_ = contents_width_scale; |
| 42 if (!rect_to_invalidate_.IsEmpty()) { | 45 if (!rect_to_invalidate_.IsEmpty()) { |
| 43 layer_->InvalidateContentRect(rect_to_invalidate_); | 46 layer_->InvalidateContentRect(rect_to_invalidate_); |
| 44 rect_to_invalidate_ = gfx::Rect(); | 47 rect_to_invalidate_ = gfx::Rect(); |
| 45 layer_ = NULL; | 48 layer_ = NULL; |
| 46 } | 49 } |
| 47 } | 50 } |
| 48 | 51 |
| 49 void FakeLayerUpdater::SetRectToInvalidate(const gfx::Rect& rect, | 52 void FakeLayerUpdater::SetRectToInvalidate(const gfx::Rect& rect, |
| 50 FakeTiledLayer* layer) { | 53 FakeTiledLayer* layer) { |
| 51 rect_to_invalidate_ = rect; | 54 rect_to_invalidate_ = rect; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 float* contents_scale_y, | 156 float* contents_scale_y, |
| 154 gfx::Size* content_bounds) { | 157 gfx::Size* content_bounds) { |
| 155 *contents_scale_x = | 158 *contents_scale_x = |
| 156 static_cast<float>(forced_content_bounds_.width()) / bounds().width(); | 159 static_cast<float>(forced_content_bounds_.width()) / bounds().width(); |
| 157 *contents_scale_y = | 160 *contents_scale_y = |
| 158 static_cast<float>(forced_content_bounds_.height()) / bounds().height(); | 161 static_cast<float>(forced_content_bounds_.height()) / bounds().height(); |
| 159 *content_bounds = forced_content_bounds_; | 162 *content_bounds = forced_content_bounds_; |
| 160 } | 163 } |
| 161 | 164 |
| 162 } // namespace cc | 165 } // namespace cc |
| OLD | NEW |