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

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

Issue 567743003: Fix bad scaling in TiledLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge to trunk 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
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 #ifndef CC_TEST_TILED_LAYER_TEST_COMMON_H_ 5 #ifndef CC_TEST_TILED_LAYER_TEST_COMMON_H_
6 #define CC_TEST_TILED_LAYER_TEST_COMMON_H_ 6 #define CC_TEST_TILED_LAYER_TEST_COMMON_H_
7 7
8 #include "cc/base/region.h" 8 #include "cc/base/region.h"
9 #include "cc/layers/tiled_layer.h" 9 #include "cc/layers/tiled_layer.h"
10 #include "cc/layers/tiled_layer_impl.h" 10 #include "cc/layers/tiled_layer_impl.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 virtual void PrepareToUpdate(const gfx::Rect& content_rect, 47 virtual void PrepareToUpdate(const gfx::Rect& content_rect,
48 const gfx::Size& tile_size, 48 const gfx::Size& tile_size,
49 float contents_width_scale, 49 float contents_width_scale,
50 float contents_height_scale) OVERRIDE; 50 float contents_height_scale) OVERRIDE;
51 // Sets the rect to invalidate during the next call to PrepareToUpdate(). 51 // Sets the rect to invalidate during the next call to PrepareToUpdate().
52 // After the next call to PrepareToUpdate() the rect is reset. 52 // After the next call to PrepareToUpdate() the rect is reset.
53 void SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer); 53 void SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer);
54 // Last rect passed to PrepareToUpdate(). 54 // Last rect passed to PrepareToUpdate().
55 gfx::Rect last_update_rect() const { return last_update_rect_; } 55 gfx::Rect last_update_rect() const { return last_update_rect_; }
56 56
57 // Value of |contents_width_scale| last passed to PrepareToUpdate().
58 float last_contents_width_scale() const { return last_contents_width_scale_; }
59
57 // Number of times PrepareToUpdate has been invoked. 60 // Number of times PrepareToUpdate has been invoked.
58 int prepare_count() const { return prepare_count_; } 61 int prepare_count() const { return prepare_count_; }
59 void ClearPrepareCount() { prepare_count_ = 0; } 62 void ClearPrepareCount() { prepare_count_ = 0; }
60 63
61 // Number of times Update() has been invoked on a texture. 64 // Number of times Update() has been invoked on a texture.
62 int update_count() const { return update_count_; } 65 int update_count() const { return update_count_; }
63 void ClearUpdateCount() { update_count_ = 0; } 66 void ClearUpdateCount() { update_count_ = 0; }
64 void Update() { update_count_++; } 67 void Update() { update_count_++; }
65 68
66 protected: 69 protected:
67 virtual ~FakeLayerUpdater(); 70 virtual ~FakeLayerUpdater();
68 71
69 private: 72 private:
70 int prepare_count_; 73 int prepare_count_;
71 int update_count_; 74 int update_count_;
72 gfx::Rect rect_to_invalidate_; 75 gfx::Rect rect_to_invalidate_;
73 gfx::Rect last_update_rect_; 76 gfx::Rect last_update_rect_;
77 float last_contents_width_scale_;
74 scoped_refptr<FakeTiledLayer> layer_; 78 scoped_refptr<FakeTiledLayer> layer_;
75 79
76 DISALLOW_COPY_AND_ASSIGN(FakeLayerUpdater); 80 DISALLOW_COPY_AND_ASSIGN(FakeLayerUpdater);
77 }; 81 };
78 82
79 class FakeTiledLayerImpl : public TiledLayerImpl { 83 class FakeTiledLayerImpl : public TiledLayerImpl {
80 public: 84 public:
81 FakeTiledLayerImpl(LayerTreeImpl* tree_impl, int id); 85 FakeTiledLayerImpl(LayerTreeImpl* tree_impl, int id);
82 virtual ~FakeTiledLayerImpl(); 86 virtual ~FakeTiledLayerImpl();
83 87
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 virtual ~FakeTiledLayerWithScaledBounds(); 146 virtual ~FakeTiledLayerWithScaledBounds();
143 gfx::Size forced_content_bounds_; 147 gfx::Size forced_content_bounds_;
144 148
145 private: 149 private:
146 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); 150 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds);
147 }; 151 };
148 152
149 } // namespace cc 153 } // namespace cc
150 154
151 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_ 155 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698