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 | 10 |
| 11 #include "base/containers/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 #include "cc/base/tiling_data.h" | 13 #include "cc/base/tiling_data.h" |
12 #include "cc/resources/recording_source.h" | 14 #include "cc/resources/recording_source.h" |
13 | 15 |
14 namespace cc { | 16 namespace cc { |
15 class PicturePileImpl; | 17 class PicturePileImpl; |
16 | 18 |
17 class CC_EXPORT PicturePile : public RecordingSource { | 19 class CC_EXPORT PicturePile : public RecordingSource { |
18 public: | 20 public: |
19 PicturePile(); | 21 PicturePile(); |
20 ~PicturePile() override; | 22 ~PicturePile() override; |
21 | 23 |
22 // RecordingSource overrides. | 24 // RecordingSource overrides. |
23 bool UpdateAndExpandInvalidation( | 25 bool UpdateAndExpandInvalidation( |
24 ContentLayerClient* painter, | 26 ContentLayerClient* painter, |
25 Region* invalidation, | 27 Region* invalidation, |
26 SkColor background_color, | |
27 bool contents_opaque, | |
28 bool contents_fill_bounds_completely, | |
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 Picture::RecordingMode recording_mode) override; | 31 Picture::RecordingMode recording_mode) override; |
| 32 scoped_refptr<RasterSource> CreateRasterSource() const override; |
33 gfx::Size GetSize() const final; | 33 gfx::Size GetSize() const final; |
34 void SetEmptyBounds() override; | 34 void SetEmptyBounds() override; |
35 void SetMinContentsScale(float min_contents_scale) override; | 35 void SetMinContentsScale(float min_contents_scale) override; |
| 36 void SetSlowdownRasterScaleFactor(int factor) override; |
| 37 bool IsSuitableForGpuRasterization() const override; |
36 void SetTileGridSize(const gfx::Size& tile_grid_size) override; | 38 void SetTileGridSize(const gfx::Size& tile_grid_size) override; |
37 void SetSlowdownRasterScaleFactor(int factor) override; | |
38 void SetIsMask(bool is_mask) override; | |
39 bool IsSuitableForGpuRasterization() const override; | |
40 scoped_refptr<RasterSource> CreateRasterSource() const override; | |
41 void SetUnsuitableForGpuRasterizationForTesting() override; | 39 void SetUnsuitableForGpuRasterizationForTesting() override; |
42 SkTileGridFactory::TileGridInfo GetTileGridInfoForTesting() const override; | 40 SkTileGridFactory::TileGridInfo GetTileGridInfoForTesting() const override; |
43 | 41 |
44 static void ComputeTileGridInfo(const gfx::Size& tile_grid_size, | 42 static void ComputeTileGridInfo(const gfx::Size& tile_grid_size, |
45 SkTileGridFactory::TileGridInfo* info); | 43 SkTileGridFactory::TileGridInfo* info); |
46 | 44 |
47 protected: | 45 protected: |
48 class CC_EXPORT PictureInfo { | 46 class CC_EXPORT PictureInfo { |
49 public: | 47 public: |
50 enum { INVALIDATION_FRAMES_TRACKED = 32 }; | 48 enum { INVALIDATION_FRAMES_TRACKED = 32 }; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // indices to picture infos. | 86 // indices to picture infos. |
89 PictureMap picture_map_; | 87 PictureMap picture_map_; |
90 TilingData tiling_; | 88 TilingData tiling_; |
91 | 89 |
92 // If non-empty, all pictures tiles inside this rect are recorded. There may | 90 // If non-empty, all pictures tiles inside this rect are recorded. There may |
93 // be recordings outside this rect, but everything inside the rect is | 91 // be recordings outside this rect, but everything inside the rect is |
94 // recorded. | 92 // recorded. |
95 gfx::Rect recorded_viewport_; | 93 gfx::Rect recorded_viewport_; |
96 float min_contents_scale_; | 94 float min_contents_scale_; |
97 SkTileGridFactory::TileGridInfo tile_grid_info_; | 95 SkTileGridFactory::TileGridInfo tile_grid_info_; |
98 SkColor background_color_; | |
99 int slow_down_raster_scale_factor_for_debug_; | 96 int slow_down_raster_scale_factor_for_debug_; |
100 bool contents_opaque_; | |
101 bool contents_fill_bounds_completely_; | |
102 bool clear_canvas_with_debug_color_; | |
103 // A hint about whether there are any recordings. This may be a false | 97 // A hint about whether there are any recordings. This may be a false |
104 // positive. | 98 // positive. |
105 bool has_any_recordings_; | 99 bool has_any_recordings_; |
106 bool is_mask_; | |
107 bool is_solid_color_; | 100 bool is_solid_color_; |
108 SkColor solid_color_; | 101 SkColor solid_color_; |
109 int pixel_record_distance_; | 102 int pixel_record_distance_; |
110 | 103 |
111 private: | 104 private: |
112 friend class PicturePileImpl; | 105 friend class PicturePileImpl; |
113 | 106 |
114 void DetermineIfSolidColor(); | 107 void DetermineIfSolidColor(); |
115 void SetBufferPixels(int buffer_pixels); | 108 void SetBufferPixels(int buffer_pixels); |
116 | 109 |
117 bool is_suitable_for_gpu_rasterization_; | 110 bool is_suitable_for_gpu_rasterization_; |
118 | 111 |
119 DISALLOW_COPY_AND_ASSIGN(PicturePile); | 112 DISALLOW_COPY_AND_ASSIGN(PicturePile); |
120 }; | 113 }; |
121 | 114 |
122 } // namespace cc | 115 } // namespace cc |
123 | 116 |
124 #endif // CC_RESOURCES_PICTURE_PILE_H_ | 117 #endif // CC_RESOURCES_PICTURE_PILE_H_ |
OLD | NEW |