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

Side by Side Diff: cc/layers/picture_layer_impl.h

Issue 2688673003: cc: Distinguish single texture mask from normal masks (Closed)
Patch Set: Rebase Created 3 years, 10 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/layers/picture_layer.cc ('k') | cc/layers/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
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_LAYERS_PICTURE_LAYER_IMPL_H_ 5 #ifndef CC_LAYERS_PICTURE_LAYER_IMPL_H_
6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ 6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "cc/base/cc_export.h" 16 #include "cc/base/cc_export.h"
17 #include "cc/layers/layer.h"
17 #include "cc/layers/layer_impl.h" 18 #include "cc/layers/layer_impl.h"
18 #include "cc/tiles/picture_layer_tiling.h" 19 #include "cc/tiles/picture_layer_tiling.h"
19 #include "cc/tiles/picture_layer_tiling_set.h" 20 #include "cc/tiles/picture_layer_tiling_set.h"
20 #include "cc/tiles/tiling_set_eviction_queue.h" 21 #include "cc/tiles/tiling_set_eviction_queue.h"
21 22
22 namespace cc { 23 namespace cc {
23 24
24 struct AppendQuadsData; 25 struct AppendQuadsData;
25 class MicroBenchmarkImpl; 26 class MicroBenchmarkImpl;
26 class Tile; 27 class Tile;
27 28
28 class CC_EXPORT PictureLayerImpl 29 class CC_EXPORT PictureLayerImpl
29 : public LayerImpl, 30 : public LayerImpl,
30 NON_EXPORTED_BASE(public PictureLayerTilingClient) { 31 NON_EXPORTED_BASE(public PictureLayerTilingClient) {
31 public: 32 public:
32 static std::unique_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, 33 static std::unique_ptr<PictureLayerImpl>
33 int id, 34 Create(LayerTreeImpl* tree_impl, int id, Layer::LayerMaskType mask_type) {
34 bool is_mask) { 35 return base::WrapUnique(new PictureLayerImpl(tree_impl, id, mask_type));
35 return base::WrapUnique(new PictureLayerImpl(tree_impl, id, is_mask));
36 } 36 }
37 ~PictureLayerImpl() override; 37 ~PictureLayerImpl() override;
38 38
39 bool is_mask() const { return is_mask_; } 39 Layer::LayerMaskType mask_type() const { return mask_type_; }
40 40
41 // LayerImpl overrides. 41 // LayerImpl overrides.
42 const char* LayerTypeAsString() const override; 42 const char* LayerTypeAsString() const override;
43 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 43 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
44 void PushPropertiesTo(LayerImpl* layer) override; 44 void PushPropertiesTo(LayerImpl* layer) override;
45 void AppendQuads(RenderPass* render_pass, 45 void AppendQuads(RenderPass* render_pass,
46 AppendQuadsData* append_quads_data) override; 46 AppendQuadsData* append_quads_data) override;
47 void NotifyTileStateChanged(const Tile* tile) override; 47 void NotifyTileStateChanged(const Tile* tile) override;
48 void ResetRasterScale(); 48 void ResetRasterScale();
49 void DidBeginTracing() override; 49 void DidBeginTracing() override;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 bool IsOnActiveOrPendingTree() const; 92 bool IsOnActiveOrPendingTree() const;
93 93
94 // Used for benchmarking 94 // Used for benchmarking
95 RasterSource* GetRasterSource() const { return raster_source_.get(); } 95 RasterSource* GetRasterSource() const { return raster_source_.get(); }
96 96
97 void set_is_directly_composited_image(bool is_directly_composited_image) { 97 void set_is_directly_composited_image(bool is_directly_composited_image) {
98 is_directly_composited_image_ = is_directly_composited_image; 98 is_directly_composited_image_ = is_directly_composited_image;
99 } 99 }
100 100
101 protected: 101 protected:
102 PictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); 102 PictureLayerImpl(LayerTreeImpl* tree_impl,
103 int id,
104 Layer::LayerMaskType mask_type);
103 PictureLayerTiling* AddTiling(float contents_scale); 105 PictureLayerTiling* AddTiling(float contents_scale);
104 void RemoveAllTilings(); 106 void RemoveAllTilings();
105 void AddTilingsForRasterScale(); 107 void AddTilingsForRasterScale();
106 void AddLowResolutionTilingIfNeeded(); 108 void AddLowResolutionTilingIfNeeded();
107 bool ShouldAdjustRasterScale() const; 109 bool ShouldAdjustRasterScale() const;
108 void RecalculateRasterScales(); 110 void RecalculateRasterScales();
109 void CleanUpTilingsOnActiveLayer( 111 void CleanUpTilingsOnActiveLayer(
110 const std::vector<PictureLayerTiling*>& used_tilings); 112 const std::vector<PictureLayerTiling*>& used_tilings);
111 float MinimumContentsScale() const; 113 float MinimumContentsScale() const;
112 float MaximumContentsScale() const; 114 float MaximumContentsScale() const;
(...skipping 23 matching lines...) Expand all
136 float ideal_contents_scale_; 138 float ideal_contents_scale_;
137 139
138 float raster_page_scale_; 140 float raster_page_scale_;
139 float raster_device_scale_; 141 float raster_device_scale_;
140 float raster_source_scale_; 142 float raster_source_scale_;
141 float raster_contents_scale_; 143 float raster_contents_scale_;
142 float low_res_raster_contents_scale_; 144 float low_res_raster_contents_scale_;
143 145
144 bool was_screen_space_transform_animating_; 146 bool was_screen_space_transform_animating_;
145 bool only_used_low_res_last_append_quads_; 147 bool only_used_low_res_last_append_quads_;
146 const bool is_mask_; 148 const Layer::LayerMaskType mask_type_;
147 149
148 bool nearest_neighbor_; 150 bool nearest_neighbor_;
149 bool is_directly_composited_image_; 151 bool is_directly_composited_image_;
150 152
151 // Use this instead of |visible_layer_rect()| for tiling calculations. This 153 // Use this instead of |visible_layer_rect()| for tiling calculations. This
152 // takes external viewport and transform for tile priority into account. 154 // takes external viewport and transform for tile priority into account.
153 gfx::Rect viewport_rect_for_tile_priority_in_content_space_; 155 gfx::Rect viewport_rect_for_tile_priority_in_content_space_;
154 156
155 gfx::Size gpu_raster_max_texture_size_; 157 gfx::Size gpu_raster_max_texture_size_;
156 158
157 // List of tilings that were used last time we appended quads. This can be 159 // List of tilings that were used last time we appended quads. This can be
158 // used as an optimization not to remove tilings if they are still being 160 // used as an optimization not to remove tilings if they are still being
159 // drawn. Note that accessing this vector should only be done in the context 161 // drawn. Note that accessing this vector should only be done in the context
160 // of comparing pointers, since objects pointed to are not guaranteed to 162 // of comparing pointers, since objects pointed to are not guaranteed to
161 // exist. 163 // exist.
162 std::vector<PictureLayerTiling*> last_append_quads_tilings_; 164 std::vector<PictureLayerTiling*> last_append_quads_tilings_;
163 165
164 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); 166 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl);
165 }; 167 };
166 168
167 } // namespace cc 169 } // namespace cc
168 170
169 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ 171 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/layers/picture_layer.cc ('k') | cc/layers/picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698