Lots of random cleanups, mostly for native_theme_win.cc:
[chromium-blink-merge.git] / cc / test / fake_picture_layer_impl.h
blob14310c7b9d923db1c68828e69acffb63d67153e2
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(RenderPass* render_pass,
39 const OcclusionTracker<LayerImpl>& occlusion_tracker,
40 AppendQuadsData* append_quads_data) OVERRIDE;
41 virtual gfx::Size CalculateTileSize(
42 const gfx::Size& content_bounds) const OVERRIDE;
44 using PictureLayerImpl::AddTiling;
45 using PictureLayerImpl::CleanUpTilingsOnActiveLayer;
46 using PictureLayerImpl::CanHaveTilings;
47 using PictureLayerImpl::MarkVisibleResourcesAsRequired;
48 using PictureLayerImpl::DoPostCommitInitializationIfNeeded;
49 using PictureLayerImpl::MinimumContentsScale;
50 using PictureLayerImpl::SanityCheckTilingState;
52 using PictureLayerImpl::UpdateIdealScales;
53 using PictureLayerImpl::MaximumTilingContentsScale;
55 void SetNeedsPostCommitInitialization() {
56 needs_post_commit_initialization_ = true;
59 bool needs_post_commit_initialization() const {
60 return needs_post_commit_initialization_;
63 float raster_page_scale() const { return raster_page_scale_; }
64 void set_raster_page_scale(float scale) { raster_page_scale_ = scale; }
66 PictureLayerTiling* HighResTiling() const;
67 PictureLayerTiling* LowResTiling() const;
68 size_t num_tilings() const { return tilings_->num_tilings(); }
70 PictureLayerImpl* twin_layer() { return twin_layer_; }
71 void set_twin_layer(PictureLayerImpl* twin) { twin_layer_ = twin; }
72 PictureLayerTilingSet* tilings() { return tilings_.get(); }
73 PicturePileImpl* pile() { return pile_.get(); }
74 size_t append_quads_count() { return append_quads_count_; }
76 const Region& invalidation() const { return invalidation_; }
77 void set_invalidation(const Region& region) { invalidation_ = region; }
79 gfx::Rect visible_rect_for_tile_priority() {
80 return visible_rect_for_tile_priority_;
82 gfx::Size viewport_size_for_tile_priority() {
83 return viewport_size_for_tile_priority_;
85 gfx::Transform screen_space_transform_for_tile_priority() {
86 return screen_space_transform_for_tile_priority_;
89 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; }
91 void CreateDefaultTilingsAndTiles();
92 void SetAllTilesVisible();
93 void SetAllTilesReady();
94 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling);
95 void ResetAllTilesPriorities();
97 protected:
98 FakePictureLayerImpl(
99 LayerTreeImpl* tree_impl,
100 int id,
101 scoped_refptr<PicturePileImpl> pile);
102 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
103 int id,
104 scoped_refptr<PicturePileImpl> pile,
105 const gfx::Size& layer_bounds);
106 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id);
108 private:
109 gfx::Size fixed_tile_size_;
111 size_t append_quads_count_;
114 } // namespace cc
116 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_