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) |
11 : LayerUpdater::Resource(texture.Pass()), layer_(layer) { | 11 : LayerUpdater::Resource(texture.Pass()), layer_(layer) { |
12 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); | 12 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); |
13 bitmap_.allocPixels(); | 13 bitmap_.allocPixels(); |
14 } | 14 } |
15 | 15 |
16 FakeLayerUpdater::Resource::~Resource() {} | 16 FakeLayerUpdater::Resource::~Resource() {} |
17 | 17 |
18 void FakeLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, | 18 void FakeLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, |
19 const gfx::Rect& source_rect, | 19 const gfx::Rect& source_rect, |
20 gfx::Vector2d dest_offset, | 20 const gfx::Vector2d& dest_offset, |
21 bool partial_update) { | 21 bool partial_update) { |
22 const gfx::Rect kRect(0, 0, 10, 10); | 22 const gfx::Rect kRect(0, 0, 10, 10); |
23 ResourceUpdate upload = ResourceUpdate::Create( | 23 ResourceUpdate upload = ResourceUpdate::Create( |
24 texture(), &bitmap_, kRect, kRect, gfx::Vector2d()); | 24 texture(), &bitmap_, kRect, kRect, gfx::Vector2d()); |
25 if (partial_update) | 25 if (partial_update) |
26 queue->AppendPartialUpload(upload); | 26 queue->AppendPartialUpload(upload); |
27 else | 27 else |
28 queue->AppendFullUpload(upload); | 28 queue->AppendFullUpload(upload); |
29 | 29 |
30 layer_->Update(); | 30 layer_->Update(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |