Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / cc / test / fake_picture_layer_impl.h
blob97cbe24210a146182cc2023c984d6b4c403bcdf7
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.
5 #ifndef CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_
6 #define CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/layers/picture_layer_impl.h"
11 namespace cc {
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));
20 // Create layer from a pile that covers the entire layer.
21 static scoped_ptr<FakePictureLayerImpl> CreateWithPile(
22 LayerTreeImpl* tree_impl, int id, scoped_refptr<PicturePileImpl> pile) {
23 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, pile));
26 // Create layer from a pile that only covers part of the layer.
27 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialPile(
28 LayerTreeImpl* tree_impl,
29 int id,
30 scoped_refptr<PicturePileImpl> pile,
31 const gfx::Size& layer_bounds) {
32 return make_scoped_ptr(
33 new FakePictureLayerImpl(tree_impl, id, pile, layer_bounds));
36 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
37 OVERRIDE;
38 virtual void AppendQuads(QuadSink* quad_sink,
39 AppendQuadsData* append_quads_data) OVERRIDE;
40 virtual gfx::Size CalculateTileSize(
41 const gfx::Size& content_bounds) const OVERRIDE;
43 using PictureLayerImpl::AddTiling;
44 using PictureLayerImpl::CleanUpTilingsOnActiveLayer;
45 using PictureLayerImpl::CanHaveTilings;
46 using PictureLayerImpl::MarkVisibleResourcesAsRequired;
47 using PictureLayerImpl::DoPostCommitInitializationIfNeeded;
48 using PictureLayerImpl::MinimumContentsScale;
49 using PictureLayerImpl::SanityCheckTilingState;
51 bool needs_post_commit_initialization() const {
52 return needs_post_commit_initialization_;
55 bool is_using_lcd_text() const { return is_using_lcd_text_; }
56 void force_set_lcd_text(bool enabled) { is_using_lcd_text_ = enabled; }
58 PictureLayerTiling* HighResTiling() const;
59 PictureLayerTiling* LowResTiling() const;
60 size_t num_tilings() const { return tilings_->num_tilings(); }
62 PictureLayerImpl* twin_layer() { return twin_layer_; }
63 void set_twin_layer(PictureLayerImpl* twin) { twin_layer_ = twin; }
64 PictureLayerTilingSet* tilings() { return tilings_.get(); }
65 PicturePileImpl* pile() { return pile_.get(); }
66 size_t append_quads_count() { return append_quads_count_; }
68 const Region& invalidation() const { return invalidation_; }
69 void set_invalidation(const Region& region) { invalidation_ = region; }
71 gfx::Rect visible_rect_for_tile_priority() {
72 return visible_rect_for_tile_priority_;
74 gfx::Size viewport_size_for_tile_priority() {
75 return viewport_size_for_tile_priority_;
77 gfx::Transform screen_space_transform_for_tile_priority() {
78 return screen_space_transform_for_tile_priority_;
81 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; }
83 void CreateDefaultTilingsAndTiles();
84 void SetAllTilesVisible();
85 void SetAllTilesReady();
86 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling);
87 void ResetAllTilesPriorities();
89 protected:
90 FakePictureLayerImpl(
91 LayerTreeImpl* tree_impl,
92 int id,
93 scoped_refptr<PicturePileImpl> pile);
94 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
95 int id,
96 scoped_refptr<PicturePileImpl> pile,
97 const gfx::Size& layer_bounds);
98 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id);
100 private:
101 gfx::Size fixed_tile_size_;
103 size_t append_quads_count_;
106 } // namespace cc
108 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_