Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1012)

Side by Side Diff: cc/test/tiled_layer_test_common.cc

Issue 590313004: Revert of Fix bad scaling in TiledLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/tiled_layer_test_common.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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() 32 FakeLayerUpdater::FakeLayerUpdater() : prepare_count_(0), update_count_(0) {}
33 : prepare_count_(0), update_count_(0), last_contents_width_scale_(0.f) {
34 }
35 33
36 FakeLayerUpdater::~FakeLayerUpdater() {} 34 FakeLayerUpdater::~FakeLayerUpdater() {}
37 35
38 void FakeLayerUpdater::PrepareToUpdate(const gfx::Size& content_size, 36 void FakeLayerUpdater::PrepareToUpdate(const gfx::Rect& content_rect,
39 const gfx::Rect& paint_rect,
40 const gfx::Size& tile_size, 37 const gfx::Size& tile_size,
41 float contents_width_scale, 38 float contents_width_scale,
42 float contents_height_scale) { 39 float contents_height_scale) {
43 prepare_count_++; 40 prepare_count_++;
44 last_update_rect_ = paint_rect; 41 last_update_rect_ = content_rect;
45 last_contents_width_scale_ = contents_width_scale;
46 if (!rect_to_invalidate_.IsEmpty()) { 42 if (!rect_to_invalidate_.IsEmpty()) {
47 layer_->InvalidateContentRect(rect_to_invalidate_); 43 layer_->InvalidateContentRect(rect_to_invalidate_);
48 rect_to_invalidate_ = gfx::Rect(); 44 rect_to_invalidate_ = gfx::Rect();
49 layer_ = NULL; 45 layer_ = NULL;
50 } 46 }
51 } 47 }
52 48
53 void FakeLayerUpdater::SetRectToInvalidate(const gfx::Rect& rect, 49 void FakeLayerUpdater::SetRectToInvalidate(const gfx::Rect& rect,
54 FakeTiledLayer* layer) { 50 FakeTiledLayer* layer) {
55 rect_to_invalidate_ = rect; 51 rect_to_invalidate_ = rect;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 float* contents_scale_y, 153 float* contents_scale_y,
158 gfx::Size* content_bounds) { 154 gfx::Size* content_bounds) {
159 *contents_scale_x = 155 *contents_scale_x =
160 static_cast<float>(forced_content_bounds_.width()) / bounds().width(); 156 static_cast<float>(forced_content_bounds_.width()) / bounds().width();
161 *contents_scale_y = 157 *contents_scale_y =
162 static_cast<float>(forced_content_bounds_.height()) / bounds().height(); 158 static_cast<float>(forced_content_bounds_.height()) / bounds().height();
163 *content_bounds = forced_content_bounds_; 159 *content_bounds = forced_content_bounds_;
164 } 160 }
165 161
166 } // namespace cc 162 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/tiled_layer_test_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698