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

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

Issue 567743003: 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
« cc/layers/tiled_layer.cc ('K') | « 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() : 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 gfx::Rect* resulting_opaque_rect) { 42 gfx::Rect* resulting_opaque_rect) {
41 prepare_count_++; 43 prepare_count_++;
42 last_update_rect_ = content_rect; 44 last_update_rect_ = content_rect;
45 last_contents_width_scale_ = contents_width_scale;
43 if (!rect_to_invalidate_.IsEmpty()) { 46 if (!rect_to_invalidate_.IsEmpty()) {
44 layer_->InvalidateContentRect(rect_to_invalidate_); 47 layer_->InvalidateContentRect(rect_to_invalidate_);
45 rect_to_invalidate_ = gfx::Rect(); 48 rect_to_invalidate_ = gfx::Rect();
46 layer_ = NULL; 49 layer_ = NULL;
47 } 50 }
48 *resulting_opaque_rect = opaque_paint_rect_; 51 *resulting_opaque_rect = opaque_paint_rect_;
49 } 52 }
50 53
51 void FakeLayerUpdater::SetRectToInvalidate(const gfx::Rect& rect, 54 void FakeLayerUpdater::SetRectToInvalidate(const gfx::Rect& rect,
52 FakeTiledLayer* layer) { 55 FakeTiledLayer* layer) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 float* contents_scale_y, 158 float* contents_scale_y,
156 gfx::Size* content_bounds) { 159 gfx::Size* content_bounds) {
157 *contents_scale_x = 160 *contents_scale_x =
158 static_cast<float>(forced_content_bounds_.width()) / bounds().width(); 161 static_cast<float>(forced_content_bounds_.width()) / bounds().width();
159 *contents_scale_y = 162 *contents_scale_y =
160 static_cast<float>(forced_content_bounds_.height()) / bounds().height(); 163 static_cast<float>(forced_content_bounds_.height()) / bounds().height();
161 *content_bounds = forced_content_bounds_; 164 *content_bounds = forced_content_bounds_;
162 } 165 }
163 166
164 } // namespace cc 167 } // namespace cc
OLDNEW
« cc/layers/tiled_layer.cc ('K') | « 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