Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
| 6 | #define CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
| 7 | |
| 8 | #include "base/memory/scoped_ptr.h" |
| 9 | #include "cc/layers/picture_layer_impl.h" |
| 10 | |
| 11 | namespace cc { |
| 12 | |
| 13 | class FakePictureLayerImpl : public PictureLayerImpl { |
| 14 | public: |
| 15 | static scoped_ptr<FakePictureLayerImpl> Create( |
| 16 | LayerTreeImpl* tree_impl, int id) { |
| 17 | return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id)); |
| 18 | } |
| 19 | |
| 20 | static scoped_ptr<FakePictureLayerImpl> CreateWithPile( |
| 21 | LayerTreeImpl* tree_impl, int id, scoped_refptr<PicturePileImpl> pile) { |
| 22 | return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, pile)); |
| 23 | } |
| 24 | |
| 25 | virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
| 26 | OVERRIDE; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 27 | virtual void AppendQuads(QuadSink* quad_sink, |
| 28 | AppendQuadsData* append_quads_data) OVERRIDE; |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 29 | virtual gfx::Size CalculateTileSize(gfx::Size content_bounds) const OVERRIDE; |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 30 | |
| 31 | using PictureLayerImpl::AddTiling; |
| 32 | using PictureLayerImpl::CleanUpTilingsOnActiveLayer; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 33 | using PictureLayerImpl::CanHaveTilings; |
| 34 | using PictureLayerImpl::MarkVisibleResourcesAsRequired; |
| 35 | |
| 36 | PictureLayerTiling* HighResTiling() const; |
| 37 | PictureLayerTiling* LowResTiling() const; |
| 38 | size_t num_tilings() const { return tilings_->num_tilings(); } |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 39 | |
| 40 | PictureLayerImpl* twin_layer() { return twin_layer_; } |
| 41 | PictureLayerTilingSet* tilings() { return tilings_.get(); } |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 42 | size_t append_quads_count() { return append_quads_count_; } |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 43 | |
| 44 | const Region& invalidation() const { return invalidation_; } |
| 45 | void set_invalidation(const Region& region) { invalidation_ = region; } |
| 46 | |
| 47 | void set_fixed_tile_size(gfx::Size size) { fixed_tile_size_ = size; } |
| 48 | |
| 49 | protected: |
| 50 | FakePictureLayerImpl( |
| 51 | LayerTreeImpl* tree_impl, |
| 52 | int id, |
| 53 | scoped_refptr<PicturePileImpl> pile); |
| 54 | FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 55 | |
| 56 | private: |
| 57 | gfx::Size fixed_tile_size_; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 58 | |
| 59 | size_t append_quads_count_; |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | } // namespace cc |
| 63 | |
| 64 | #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |