| 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 #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 explicit FakePictureLayerTilingClient(TileManager* tile_manager); | 19 FakePictureLayerTilingClient(); |
| 20 explicit FakePictureLayerTilingClient(ResourceProvider* resource_provider); |
| 20 virtual ~FakePictureLayerTilingClient(); | 21 virtual ~FakePictureLayerTilingClient(); |
| 21 | 22 |
| 22 // PictureLayerTilingClient implementation. | 23 // PictureLayerTilingClient implementation. |
| 23 virtual scoped_refptr<Tile> CreateTile( | 24 virtual scoped_refptr<Tile> CreateTile( |
| 24 PictureLayerTiling* tiling, gfx::Rect rect) OVERRIDE; | 25 PictureLayerTiling* tiling, gfx::Rect rect) OVERRIDE; |
| 25 virtual scoped_refptr<TileBundle> CreateTileBundle(int offset_x, | |
| 26 int offset_y, | |
| 27 int width, | |
| 28 int height) OVERRIDE; | |
| 29 virtual void UpdatePile(Tile* tile) OVERRIDE {} | 26 virtual void UpdatePile(Tile* tile) OVERRIDE {} |
| 30 virtual gfx::Size CalculateTileSize( | 27 virtual gfx::Size CalculateTileSize( |
| 31 gfx::Size content_bounds) const OVERRIDE; | 28 gfx::Size content_bounds) const OVERRIDE; |
| 32 | 29 |
| 33 void SetTileSize(gfx::Size tile_size); | 30 void SetTileSize(gfx::Size tile_size); |
| 34 gfx::Size TileSize() const { return tile_size_; } | 31 gfx::Size TileSize() const { return tile_size_; } |
| 35 scoped_refptr<PicturePileImpl> pile() { return pile_; } | 32 scoped_refptr<PicturePileImpl> pile() { return pile_; } |
| 36 const PicturePileImpl* pile() const { return pile_.get(); } | 33 const PicturePileImpl* pile() const { return pile_.get(); } |
| 37 | 34 |
| 38 virtual const Region* GetInvalidation() OVERRIDE; | 35 virtual const Region* GetInvalidation() OVERRIDE; |
| 39 virtual const PictureLayerTiling* GetTwinTiling( | 36 virtual const PictureLayerTiling* GetTwinTiling( |
| 40 const PictureLayerTiling* tiling) const OVERRIDE; | 37 const PictureLayerTiling* tiling) const OVERRIDE; |
| 41 | 38 |
| 42 void set_twin_tiling(PictureLayerTiling* tiling) { twin_tiling_ = tiling; } | 39 void set_twin_tiling(PictureLayerTiling* tiling) { twin_tiling_ = tiling; } |
| 43 void set_text_rect(gfx::Rect rect) { text_rect_ = rect; } | 40 void set_text_rect(gfx::Rect rect) { text_rect_ = rect; } |
| 44 void set_allow_create_tile(bool allow) { allow_create_tile_ = allow; } | 41 void set_allow_create_tile(bool allow) { allow_create_tile_ = allow; } |
| 45 void set_invalidation(const Region& region) { invalidation_ = region; } | 42 void set_invalidation(const Region& region) { invalidation_ = region; } |
| 46 | 43 |
| 47 TileManager* tile_manager() const { | 44 TileManager* tile_manager() const { |
| 48 return tile_manager_; | 45 return tile_manager_.get(); |
| 49 } | 46 } |
| 50 | 47 |
| 51 protected: | 48 protected: |
| 52 TileManager* tile_manager_; | 49 FakeTileManagerClient tile_manager_client_; |
| 50 scoped_ptr<TileManager> tile_manager_; |
| 53 scoped_refptr<PicturePileImpl> pile_; | 51 scoped_refptr<PicturePileImpl> pile_; |
| 54 gfx::Size tile_size_; | 52 gfx::Size tile_size_; |
| 55 PictureLayerTiling* twin_tiling_; | 53 PictureLayerTiling* twin_tiling_; |
| 56 gfx::Rect text_rect_; | 54 gfx::Rect text_rect_; |
| 57 bool allow_create_tile_; | 55 bool allow_create_tile_; |
| 58 Region invalidation_; | 56 Region invalidation_; |
| 59 bool is_active_; | |
| 60 bool is_pending_; | |
| 61 }; | 57 }; |
| 62 | 58 |
| 63 } // namespace cc | 59 } // namespace cc |
| 64 | 60 |
| 65 #endif // CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_ | 61 #endif // CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_ |
| OLD | NEW |