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

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

Issue 62283012: cc: Added tile bundles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
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_FAKE_PICTURE_LAYER_TILING_CLIENT_H_ 5 #ifndef CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_
6 #define CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_ 6 #define CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_
7 7
8 #include "cc/resources/picture_layer_tiling.h" 8 #include "cc/resources/picture_layer_tiling.h"
9 #include "cc/resources/picture_pile_impl.h" 9 #include "cc/resources/picture_pile_impl.h"
10 #include "cc/resources/tile.h" 10 #include "cc/resources/tile.h"
11 #include "cc/resources/tile_manager.h" 11 #include "cc/resources/tile_manager.h"
12 #include "cc/test/fake_tile_manager_client.h" 12 #include "cc/test/fake_tile_manager_client.h"
13 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 class FakePictureLayerTilingClient : public PictureLayerTilingClient { 17 class FakePictureLayerTilingClient : public PictureLayerTilingClient {
18 public: 18 public:
19 FakePictureLayerTilingClient(); 19 FakePictureLayerTilingClient();
20 explicit FakePictureLayerTilingClient(ResourceProvider* resource_provider); 20 explicit FakePictureLayerTilingClient(ResourceProvider* resource_provider);
21 virtual ~FakePictureLayerTilingClient(); 21 virtual ~FakePictureLayerTilingClient();
22 22
23 // PictureLayerTilingClient implementation. 23 // PictureLayerTilingClient implementation.
24 virtual scoped_refptr<Tile> CreateTile( 24 virtual scoped_refptr<Tile> CreateTile(
25 PictureLayerTiling* tiling, gfx::Rect rect) OVERRIDE; 25 PictureLayerTiling* tiling, gfx::Rect rect) OVERRIDE;
26 virtual scoped_refptr<TileBundle> CreateTileBundle(int width,
27 int height,
28 int offset_x,
29 int offset_y) OVERRIDE;
26 virtual void UpdatePile(Tile* tile) OVERRIDE {} 30 virtual void UpdatePile(Tile* tile) OVERRIDE {}
27 virtual gfx::Size CalculateTileSize( 31 virtual gfx::Size CalculateTileSize(
28 gfx::Size content_bounds) const OVERRIDE; 32 gfx::Size content_bounds) const OVERRIDE;
29 33
30 void SetTileSize(gfx::Size tile_size); 34 void SetTileSize(gfx::Size tile_size);
31 gfx::Size TileSize() const { return tile_size_; } 35 gfx::Size TileSize() const { return tile_size_; }
32 scoped_refptr<PicturePileImpl> pile() { return pile_; } 36 scoped_refptr<PicturePileImpl> pile() { return pile_; }
33 const PicturePileImpl* pile() const { return pile_.get(); } 37 const PicturePileImpl* pile() const { return pile_.get(); }
34 38
35 virtual const Region* GetInvalidation() OVERRIDE; 39 virtual const Region* GetInvalidation() OVERRIDE;
36 virtual const PictureLayerTiling* GetTwinTiling( 40 virtual const PictureLayerTiling* GetTwinTiling(
37 const PictureLayerTiling* tiling) OVERRIDE; 41 const PictureLayerTiling* tiling) OVERRIDE;
42 virtual bool IsActive() const OVERRIDE {
43 return is_active_;
44 }
45 void MarkActive() {
46 is_active_ = true;
47 is_pending_ = false;
48 is_recycled_ = false;
49 }
50
51 virtual bool IsPending() const OVERRIDE {
52 return is_pending_;
53 }
54 void MarkPending() {
55 is_active_ = false;
56 is_pending_ = true;
57 is_recycled_ = false;
58 }
59
60 virtual bool IsRecycled() const OVERRIDE {
61 return is_recycled_;
62 }
63 void MarkRecycled() {
64 is_active_ = false;
65 is_pending_ = false;
66 is_recycled_ = true;
67 }
68
38 69
39 void set_twin_tiling(PictureLayerTiling* tiling) { twin_tiling_ = tiling; } 70 void set_twin_tiling(PictureLayerTiling* tiling) { twin_tiling_ = tiling; }
40 void set_text_rect(gfx::Rect rect) { text_rect_ = rect; } 71 void set_text_rect(gfx::Rect rect) { text_rect_ = rect; }
41 void set_allow_create_tile(bool allow) { allow_create_tile_ = allow; } 72 void set_allow_create_tile(bool allow) { allow_create_tile_ = allow; }
42 void set_invalidation(const Region& region) { invalidation_ = region; } 73 void set_invalidation(const Region& region) { invalidation_ = region; }
43 74
44 TileManager* tile_manager() const { 75 TileManager* tile_manager() const {
45 return tile_manager_.get(); 76 return set_tile_manager_ ? set_tile_manager_ : tile_manager_.get();
77 }
78
79 void set_tile_manager(TileManager* tile_manager) {
80 set_tile_manager_ = tile_manager;
46 } 81 }
47 82
48 protected: 83 protected:
49 FakeTileManagerClient tile_manager_client_; 84 FakeTileManagerClient tile_manager_client_;
50 scoped_ptr<TileManager> tile_manager_; 85 scoped_ptr<TileManager> tile_manager_;
86 TileManager* set_tile_manager_;
51 scoped_refptr<PicturePileImpl> pile_; 87 scoped_refptr<PicturePileImpl> pile_;
52 gfx::Size tile_size_; 88 gfx::Size tile_size_;
53 PictureLayerTiling* twin_tiling_; 89 PictureLayerTiling* twin_tiling_;
54 gfx::Rect text_rect_; 90 gfx::Rect text_rect_;
55 bool allow_create_tile_; 91 bool allow_create_tile_;
56 Region invalidation_; 92 Region invalidation_;
93 bool is_active_;
94 bool is_pending_;
95 bool is_recycled_;
57 }; 96 };
58 97
59 } // namespace cc 98 } // namespace cc
60 99
61 #endif // CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_ 100 #endif // CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698