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

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

Issue 2175553002: Raster PictureLayerTiling with fractional translation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: combined Created 3 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/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>
(...skipping 21 matching lines...) Expand all
32 NON_EXPORTED_BASE(public PictureLayerTilingClient) { 32 NON_EXPORTED_BASE(public PictureLayerTilingClient) {
33 public: 33 public:
34 static std::unique_ptr<PictureLayerImpl> 34 static std::unique_ptr<PictureLayerImpl>
35 Create(LayerTreeImpl* tree_impl, int id, Layer::LayerMaskType mask_type) { 35 Create(LayerTreeImpl* tree_impl, int id, Layer::LayerMaskType mask_type) {
36 return base::WrapUnique(new PictureLayerImpl(tree_impl, id, mask_type)); 36 return base::WrapUnique(new PictureLayerImpl(tree_impl, id, mask_type));
37 } 37 }
38 ~PictureLayerImpl() override; 38 ~PictureLayerImpl() override;
39 39
40 Layer::LayerMaskType mask_type() const { return mask_type_; } 40 Layer::LayerMaskType mask_type() const { return mask_type_; }
41 41
42 void ResetRasterScale();
43
42 // LayerImpl overrides. 44 // LayerImpl overrides.
43 const char* LayerTypeAsString() const override; 45 const char* LayerTypeAsString() const override;
44 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 46 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
45 void PushPropertiesTo(LayerImpl* layer) override; 47 void PushPropertiesTo(LayerImpl* layer) override;
46 void AppendQuads(RenderPass* render_pass, 48 void AppendQuads(RenderPass* render_pass,
47 AppendQuadsData* append_quads_data) override; 49 AppendQuadsData* append_quads_data) override;
48 void NotifyTileStateChanged(const Tile* tile) override; 50 void NotifyTileStateChanged(const Tile* tile) override;
49 void ResetRasterScale(); 51 SimpleEnclosedRegion VisibleOpaqueRegion() const override;
52
50 void DidBeginTracing() override; 53 void DidBeginTracing() override;
51 void ReleaseResources() override; 54 void ReleaseResources() override;
52 void ReleaseTileResources() override; 55 void ReleaseTileResources() override;
53 void RecreateTileResources() override; 56 void RecreateTileResources() override;
54 Region GetInvalidationRegionForDebugging() override; 57 Region GetInvalidationRegionForDebugging() override;
55 58
56 // PictureLayerTilingClient overrides. 59 // PictureLayerTilingClient overrides.
57 std::unique_ptr<Tile> CreateTile(const Tile::CreateInfo& info) override; 60 std::unique_ptr<Tile> CreateTile(const Tile::CreateInfo& info) override;
58 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; 61 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override;
59 const Region* GetPendingInvalidation() override; 62 const Region* GetPendingInvalidation() override;
(...skipping 13 matching lines...) Expand all
73 void UpdateCanUseLCDTextAfterCommit(); 76 void UpdateCanUseLCDTextAfterCommit();
74 bool RasterSourceUsesLCDText() const; 77 bool RasterSourceUsesLCDText() const;
75 WhichTree GetTree() const; 78 WhichTree GetTree() const;
76 79
77 // Mask-related functions. 80 // Mask-related functions.
78 void GetContentsResourceId(ResourceId* resource_id, 81 void GetContentsResourceId(ResourceId* resource_id,
79 gfx::Size* resource_size) const override; 82 gfx::Size* resource_size) const override;
80 83
81 void SetNearestNeighbor(bool nearest_neighbor); 84 void SetNearestNeighbor(bool nearest_neighbor);
82 85
86 void SetUseTransformedRasterization(bool use);
87
83 size_t GPUMemoryUsageInBytes() const override; 88 size_t GPUMemoryUsageInBytes() const override;
84 89
85 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; 90 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override;
86 91
87 bool CanHaveTilings() const; 92 bool CanHaveTilings() const;
88 93
89 PictureLayerTilingSet* picture_layer_tiling_set() { return tilings_.get(); } 94 PictureLayerTilingSet* picture_layer_tiling_set() { return tilings_.get(); }
90 95
91 // Functions used by tile manager. 96 // Functions used by tile manager.
92 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; 97 PictureLayerImpl* GetPendingOrActiveTwinLayer() const;
93 bool IsOnActiveOrPendingTree() const; 98 bool IsOnActiveOrPendingTree() const;
94 99
95 // Used for benchmarking 100 // Used for benchmarking
96 RasterSource* GetRasterSource() const { return raster_source_.get(); } 101 RasterSource* GetRasterSource() const { return raster_source_.get(); }
97 102
98 void set_is_directly_composited_image(bool is_directly_composited_image) { 103 void set_is_directly_composited_image(bool is_directly_composited_image) {
99 is_directly_composited_image_ = is_directly_composited_image; 104 is_directly_composited_image_ = is_directly_composited_image;
100 } 105 }
101 106
102 void InvalidateRegionForImages(const ImageIdFlatSet& images_to_invalidate); 107 void InvalidateRegionForImages(const ImageIdFlatSet& images_to_invalidate);
103 108
104 protected: 109 protected:
105 PictureLayerImpl(LayerTreeImpl* tree_impl, 110 PictureLayerImpl(LayerTreeImpl* tree_impl,
106 int id, 111 int id,
107 Layer::LayerMaskType mask_type); 112 Layer::LayerMaskType mask_type);
108 PictureLayerTiling* AddTiling(float contents_scale); 113 PictureLayerTiling* AddTiling(const ScaleTranslate2d& contents_transform);
109 void RemoveAllTilings(); 114 void RemoveAllTilings();
110 void AddTilingsForRasterScale(); 115 void AddTilingsForRasterScale();
111 void AddLowResolutionTilingIfNeeded(); 116 void AddLowResolutionTilingIfNeeded();
112 bool ShouldAdjustRasterScale() const; 117 bool ShouldAdjustRasterScale() const;
113 void RecalculateRasterScales(); 118 void RecalculateRasterScales();
119 gfx::Vector2dF CalculateRasterTranslation(float raster_scale);
114 void CleanUpTilingsOnActiveLayer( 120 void CleanUpTilingsOnActiveLayer(
115 const std::vector<PictureLayerTiling*>& used_tilings); 121 const std::vector<PictureLayerTiling*>& used_tilings);
116 float MinimumContentsScale() const; 122 float MinimumContentsScale() const;
117 float MaximumContentsScale() const; 123 float MaximumContentsScale() const;
118 void UpdateViewportRectForTilePriorityInContentSpace(); 124 void UpdateViewportRectForTilePriorityInContentSpace();
119 PictureLayerImpl* GetRecycledTwinLayer() const; 125 PictureLayerImpl* GetRecycledTwinLayer() const;
120 126
121 void SanityCheckTilingState() const; 127 void SanityCheckTilingState() const;
122 128
123 void GetDebugBorderProperties(SkColor* color, float* width) const override; 129 void GetDebugBorderProperties(SkColor* color, float* width) const override;
(...skipping 20 matching lines...) Expand all
144 float raster_device_scale_; 150 float raster_device_scale_;
145 float raster_source_scale_; 151 float raster_source_scale_;
146 float raster_contents_scale_; 152 float raster_contents_scale_;
147 float low_res_raster_contents_scale_; 153 float low_res_raster_contents_scale_;
148 154
149 bool was_screen_space_transform_animating_; 155 bool was_screen_space_transform_animating_;
150 bool only_used_low_res_last_append_quads_; 156 bool only_used_low_res_last_append_quads_;
151 const Layer::LayerMaskType mask_type_; 157 const Layer::LayerMaskType mask_type_;
152 158
153 bool nearest_neighbor_; 159 bool nearest_neighbor_;
160 bool use_transformed_rasterization_;
154 bool is_directly_composited_image_; 161 bool is_directly_composited_image_;
155 162
156 // Use this instead of |visible_layer_rect()| for tiling calculations. This 163 // Use this instead of |visible_layer_rect()| for tiling calculations. This
157 // takes external viewport and transform for tile priority into account. 164 // takes external viewport and transform for tile priority into account.
158 gfx::Rect viewport_rect_for_tile_priority_in_content_space_; 165 gfx::Rect viewport_rect_for_tile_priority_in_content_space_;
159 166
160 gfx::Size gpu_raster_max_texture_size_; 167 gfx::Size gpu_raster_max_texture_size_;
161 168
162 // List of tilings that were used last time we appended quads. This can be 169 // List of tilings that were used last time we appended quads. This can be
163 // used as an optimization not to remove tilings if they are still being 170 // used as an optimization not to remove tilings if they are still being
164 // drawn. Note that accessing this vector should only be done in the context 171 // drawn. Note that accessing this vector should only be done in the context
165 // of comparing pointers, since objects pointed to are not guaranteed to 172 // of comparing pointers, since objects pointed to are not guaranteed to
166 // exist. 173 // exist.
167 std::vector<PictureLayerTiling*> last_append_quads_tilings_; 174 std::vector<PictureLayerTiling*> last_append_quads_tilings_;
168 175
169 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); 176 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl);
170 }; 177 };
171 178
172 } // namespace cc 179 } // namespace cc
173 180
174 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ 181 #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