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

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

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « cc/test/fake_picture_layer.cc ('k') | cc/test/fake_picture_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 bool is_mask = false;
18 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, is_mask));
19 }
20
21 // Create layer from a raster source that covers the entire layer.
22 static scoped_ptr<FakePictureLayerImpl> CreateWithRasterSource(
23 LayerTreeImpl* tree_impl,
24 int id,
25 scoped_refptr<RasterSource> raster_source) {
26 bool is_mask = false;
27 return make_scoped_ptr(
28 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask));
29 }
30
31 // Create layer from a raster source that only covers part of the layer.
32 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource(
33 LayerTreeImpl* tree_impl,
34 int id,
35 scoped_refptr<RasterSource> raster_source,
36 const gfx::Size& layer_bounds) {
37 bool is_mask = false;
38 return make_scoped_ptr(new FakePictureLayerImpl(
39 tree_impl, id, raster_source, is_mask, layer_bounds));
40 }
41
42 // Create layer from a raster source that covers the entire layer and is a
43 // mask.
44 static scoped_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource(
45 LayerTreeImpl* tree_impl,
46 int id,
47 scoped_refptr<RasterSource> raster_source) {
48 bool is_mask = true;
49 return make_scoped_ptr(
50 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask));
51 }
52
53 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
54 void PushPropertiesTo(LayerImpl* layer_impl) override;
55 void AppendQuads(RenderPass* render_pass,
56 AppendQuadsData* append_quads_data) override;
57 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override;
58
59 void DidBecomeActive() override;
60 size_t did_become_active_call_count() {
61 return did_become_active_call_count_;
62 }
63
64 bool HasValidTilePriorities() const override;
65 void set_has_valid_tile_priorities(bool has_valid_priorities) {
66 has_valid_tile_priorities_ = has_valid_priorities;
67 use_set_valid_tile_priorities_flag_ = true;
68 }
69
70 size_t CountTilesRequired(
71 TileRequirementCheck is_tile_required_callback) const;
72 size_t CountTilesRequiredForActivation() const;
73 size_t CountTilesRequiredForDraw() const;
74
75 using PictureLayerImpl::AddTiling;
76 using PictureLayerImpl::CleanUpTilingsOnActiveLayer;
77 using PictureLayerImpl::CanHaveTilings;
78 using PictureLayerImpl::MinimumContentsScale;
79 using PictureLayerImpl::SanityCheckTilingState;
80 using PictureLayerImpl::GetRecycledTwinLayer;
81 using PictureLayerImpl::UpdateRasterSource;
82
83 using PictureLayerImpl::UpdateIdealScales;
84 using PictureLayerImpl::MaximumTilingContentsScale;
85
86 void AddTilingUntilNextDraw(float scale) {
87 last_append_quads_tilings_.push_back(AddTiling(scale));
88 }
89
90 float raster_page_scale() const { return raster_page_scale_; }
91 void set_raster_page_scale(float scale) { raster_page_scale_ = scale; }
92
93 float ideal_contents_scale() const { return ideal_contents_scale_; }
94 float raster_contents_scale() const { return raster_contents_scale_; }
95
96 PictureLayerTiling* HighResTiling() const;
97 PictureLayerTiling* LowResTiling() const;
98 size_t num_tilings() const { return tilings_->num_tilings(); }
99
100 PictureLayerTilingSet* tilings() { return tilings_.get(); }
101 RasterSource* raster_source() { return raster_source_.get(); }
102 void SetRasterSourceOnPending(scoped_refptr<RasterSource> raster_source,
103 const Region& invalidation);
104 size_t append_quads_count() { return append_quads_count_; }
105
106 const Region& invalidation() const { return invalidation_; }
107 void set_invalidation(const Region& region) { invalidation_ = region; }
108
109 gfx::Rect visible_rect_for_tile_priority() {
110 return visible_rect_for_tile_priority_;
111 }
112
113 gfx::Rect viewport_rect_for_tile_priority_in_content_space() {
114 return viewport_rect_for_tile_priority_in_content_space_;
115 }
116
117 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; }
118
119 void SetIsDrawnRenderSurfaceLayerListMember(bool is);
120
121 void CreateAllTiles();
122 void SetAllTilesVisible();
123 void SetAllTilesReady();
124 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling);
125 void SetTileReady(Tile* tile);
126 void ResetAllTilesPriorities();
127 PictureLayerTilingSet* GetTilings() { return tilings_.get(); }
128
129 // Add the given tiling as a "used" tiling during AppendQuads. This ensures
130 // that future calls to UpdateTiles don't delete the tiling.
131 void MarkAllTilingsUsed() {
132 last_append_quads_tilings_.clear();
133 for (size_t i = 0; i < tilings_->num_tilings(); ++i)
134 last_append_quads_tilings_.push_back(tilings_->tiling_at(i));
135 }
136
137 size_t release_resources_count() const { return release_resources_count_; }
138 void reset_release_resources_count() { release_resources_count_ = 0; }
139
140 void ReleaseResources() override;
141
142 bool only_used_low_res_last_append_quads() const {
143 return only_used_low_res_last_append_quads_;
144 }
145
146 protected:
147 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
148 int id,
149 scoped_refptr<RasterSource> raster_source,
150 bool is_mask);
151 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
152 int id,
153 scoped_refptr<RasterSource> raster_source,
154 bool is_mask,
155 const gfx::Size& layer_bounds);
156 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask);
157 FakePictureLayerImpl(
158 LayerTreeImpl* tree_impl,
159 int id,
160 bool is_mask,
161 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset);
162
163 private:
164 gfx::Size fixed_tile_size_;
165
166 size_t append_quads_count_;
167 size_t did_become_active_call_count_;
168 bool has_valid_tile_priorities_;
169 bool use_set_valid_tile_priorities_flag_;
170 size_t release_resources_count_;
171 };
172
173 } // namespace cc
174
175 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/test/fake_picture_layer.cc ('k') | cc/test/fake_picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698