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, | |
29 const gfx::Size& layer_size, | 28 const gfx::Size& layer_size, |
30 const gfx::Rect& visible_layer_rect, | 29 const gfx::Rect& visible_layer_rect, |
31 int frame_number, | 30 int frame_number, |
32 RecordingMode recording_mode) override; | 31 RecordingMode recording_mode) override; |
33 scoped_refptr<RasterSource> CreateRasterSource() const override; | 32 scoped_refptr<RasterSource> CreateRasterSource( |
| 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_; | |
99 // A hint about whether there are any recordings. This may be a false | 98 // A hint about whether there are any recordings. This may be a false |
100 // positive. | 99 // positive. |
101 bool has_any_recordings_; | 100 bool has_any_recordings_; |
102 bool clear_canvas_with_debug_color_; | 101 bool clear_canvas_with_debug_color_; |
103 bool requires_clear_; | 102 bool requires_clear_; |
104 bool is_solid_color_; | 103 bool is_solid_color_; |
105 SkColor solid_color_; | 104 SkColor solid_color_; |
106 SkColor background_color_; | 105 SkColor background_color_; |
107 int pixel_record_distance_; | 106 int pixel_record_distance_; |
108 | 107 |
109 private: | 108 private: |
110 friend class PicturePileImpl; | 109 friend class PicturePileImpl; |
111 | 110 |
112 void CreatePictures(ContentLayerClient* painter, | 111 void CreatePictures(ContentLayerClient* painter, |
113 RecordingMode recording_mode, | 112 RecordingMode recording_mode, |
114 const std::vector<gfx::Rect>& record_rects); | 113 const std::vector<gfx::Rect>& record_rects); |
115 void GetInvalidTileRects(const gfx::Rect& interest_rect, | 114 void GetInvalidTileRects(const gfx::Rect& interest_rect, |
116 Region* invalidation, | 115 Region* invalidation, |
117 const gfx::Rect& visible_layer_rect, | 116 const gfx::Rect& visible_layer_rect, |
118 int frame_number, | 117 int frame_number, |
119 std::vector<gfx::Rect>* invalid_tiles); | 118 std::vector<gfx::Rect>* invalid_tiles); |
120 bool ApplyInvalidationAndResize(const gfx::Rect& interest_rect, | 119 bool ApplyInvalidationAndResize(const gfx::Rect& interest_rect, |
121 Region* invalidation, | 120 Region* invalidation, |
122 const gfx::Size& layer_size, | 121 const gfx::Size& layer_size, |
123 int frame_number, | 122 int frame_number); |
124 bool can_use_lcd_text_changed); | |
125 void DetermineIfSolidColor(); | 123 void DetermineIfSolidColor(); |
126 void SetBufferPixels(int buffer_pixels); | 124 void SetBufferPixels(int buffer_pixels); |
127 | 125 |
128 bool is_suitable_for_gpu_rasterization_; | 126 bool is_suitable_for_gpu_rasterization_; |
129 | 127 |
130 DISALLOW_COPY_AND_ASSIGN(PicturePile); | 128 DISALLOW_COPY_AND_ASSIGN(PicturePile); |
131 }; | 129 }; |
132 | 130 |
133 } // namespace cc | 131 } // namespace cc |
134 | 132 |
135 #endif // CC_RESOURCES_PICTURE_PILE_H_ | 133 #endif // CC_RESOURCES_PICTURE_PILE_H_ |
OLD | NEW |