OLD | NEW |
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_RESOURCES_PICTURE_PILE_H_ | 5 #ifndef CC_RESOURCES_PICTURE_PILE_H_ |
6 #define CC_RESOURCES_PICTURE_PILE_H_ | 6 #define CC_RESOURCES_PICTURE_PILE_H_ |
7 | 7 |
8 #include <bitset> | 8 #include <bitset> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "cc/base/tiling_data.h" | 14 #include "cc/base/tiling_data.h" |
15 #include "cc/resources/picture.h" | 15 #include "cc/resources/picture.h" |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 class PicturePileImpl; | 18 class PicturePileImpl; |
19 | 19 |
20 class CC_EXPORT PicturePile : public RecordingSource { | 20 class CC_EXPORT PicturePile : public RecordingSource { |
21 public: | 21 public: |
22 PicturePile(float min_contents_scale, const gfx::Size& tile_grid_size); | 22 PicturePile(float min_contents_scale, const gfx::Size& tile_grid_size); |
23 ~PicturePile() override; | 23 ~PicturePile() override; |
24 | 24 |
25 // RecordingSource overrides. | 25 // RecordingSource overrides. |
26 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, | 26 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, |
27 Region* invalidation, | 27 Region* invalidation, |
| 28 bool can_use_lcd_text, |
28 const gfx::Size& layer_size, | 29 const gfx::Size& layer_size, |
29 const gfx::Rect& visible_layer_rect, | 30 const gfx::Rect& visible_layer_rect, |
30 int frame_number, | 31 int frame_number, |
31 RecordingMode recording_mode) override; | 32 RecordingMode recording_mode) override; |
32 scoped_refptr<RasterSource> CreateRasterSource( | 33 scoped_refptr<RasterSource> CreateRasterSource() const override; |
33 bool can_use_lcd_text) const override; | |
34 gfx::Size GetSize() const final; | 34 gfx::Size GetSize() const final; |
35 void SetEmptyBounds() override; | 35 void SetEmptyBounds() override; |
36 void SetSlowdownRasterScaleFactor(int factor) override; | 36 void SetSlowdownRasterScaleFactor(int factor) override; |
37 void SetBackgroundColor(SkColor background_color) override; | 37 void SetBackgroundColor(SkColor background_color) override; |
38 void SetRequiresClear(bool requires_clear) override; | 38 void SetRequiresClear(bool requires_clear) override; |
39 bool IsSuitableForGpuRasterization() const override; | 39 bool IsSuitableForGpuRasterization() const override; |
40 void SetUnsuitableForGpuRasterizationForTesting() override; | 40 void SetUnsuitableForGpuRasterizationForTesting() override; |
41 gfx::Size GetTileGridSizeForTesting() const override; | 41 gfx::Size GetTileGridSizeForTesting() const override; |
42 | 42 |
43 protected: | 43 protected: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 PictureMap picture_map_; | 88 PictureMap picture_map_; |
89 TilingData tiling_; | 89 TilingData tiling_; |
90 | 90 |
91 // If non-empty, all pictures tiles inside this rect are recorded. There may | 91 // If non-empty, all pictures tiles inside this rect are recorded. There may |
92 // be recordings outside this rect, but everything inside the rect is | 92 // be recordings outside this rect, but everything inside the rect is |
93 // recorded. | 93 // recorded. |
94 gfx::Rect recorded_viewport_; | 94 gfx::Rect recorded_viewport_; |
95 float min_contents_scale_; | 95 float min_contents_scale_; |
96 gfx::Size tile_grid_size_; | 96 gfx::Size tile_grid_size_; |
97 int slow_down_raster_scale_factor_for_debug_; | 97 int slow_down_raster_scale_factor_for_debug_; |
| 98 bool can_use_lcd_text_; |
98 // A hint about whether there are any recordings. This may be a false | 99 // A hint about whether there are any recordings. This may be a false |
99 // positive. | 100 // positive. |
100 bool has_any_recordings_; | 101 bool has_any_recordings_; |
101 bool clear_canvas_with_debug_color_; | 102 bool clear_canvas_with_debug_color_; |
102 bool requires_clear_; | 103 bool requires_clear_; |
103 bool is_solid_color_; | 104 bool is_solid_color_; |
104 SkColor solid_color_; | 105 SkColor solid_color_; |
105 SkColor background_color_; | 106 SkColor background_color_; |
106 int pixel_record_distance_; | 107 int pixel_record_distance_; |
107 | 108 |
108 private: | 109 private: |
109 friend class PicturePileImpl; | 110 friend class PicturePileImpl; |
110 | 111 |
111 void CreatePictures(ContentLayerClient* painter, | 112 void CreatePictures(ContentLayerClient* painter, |
112 RecordingMode recording_mode, | 113 RecordingMode recording_mode, |
113 const std::vector<gfx::Rect>& record_rects); | 114 const std::vector<gfx::Rect>& record_rects); |
114 void GetInvalidTileRects(const gfx::Rect& interest_rect, | 115 void GetInvalidTileRects(const gfx::Rect& interest_rect, |
115 Region* invalidation, | 116 Region* invalidation, |
116 const gfx::Rect& visible_layer_rect, | 117 const gfx::Rect& visible_layer_rect, |
117 int frame_number, | 118 int frame_number, |
118 std::vector<gfx::Rect>* invalid_tiles); | 119 std::vector<gfx::Rect>* invalid_tiles); |
119 bool ApplyInvalidationAndResize(const gfx::Rect& interest_rect, | 120 bool ApplyInvalidationAndResize(const gfx::Rect& interest_rect, |
120 Region* invalidation, | 121 Region* invalidation, |
121 const gfx::Size& layer_size, | 122 const gfx::Size& layer_size, |
122 int frame_number); | 123 int frame_number, |
| 124 bool can_use_lcd_text_changed); |
123 void DetermineIfSolidColor(); | 125 void DetermineIfSolidColor(); |
124 void SetBufferPixels(int buffer_pixels); | 126 void SetBufferPixels(int buffer_pixels); |
125 | 127 |
126 bool is_suitable_for_gpu_rasterization_; | 128 bool is_suitable_for_gpu_rasterization_; |
127 | 129 |
128 DISALLOW_COPY_AND_ASSIGN(PicturePile); | 130 DISALLOW_COPY_AND_ASSIGN(PicturePile); |
129 }; | 131 }; |
130 | 132 |
131 } // namespace cc | 133 } // namespace cc |
132 | 134 |
133 #endif // CC_RESOURCES_PICTURE_PILE_H_ | 135 #endif // CC_RESOURCES_PICTURE_PILE_H_ |
OLD | NEW |