OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BASE_H_ | 5 #ifndef CC_RESOURCES_PICTURE_PILE_BASE_H_ |
6 #define CC_RESOURCES_PICTURE_PILE_BASE_H_ | 6 #define CC_RESOURCES_PICTURE_PILE_BASE_H_ |
7 | 7 |
8 #include <bitset> | 8 #include <bitset> |
9 #include <list> | 9 #include <list> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/memory/ref_counted.h" | |
14 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
15 #include "cc/base/region.h" | 14 #include "cc/base/region.h" |
16 #include "cc/base/tiling_data.h" | 15 #include "cc/base/tiling_data.h" |
17 #include "cc/resources/picture.h" | 16 #include "cc/resources/picture.h" |
18 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
19 | 18 |
20 namespace base { | 19 namespace base { |
21 namespace debug { | 20 namespace debug { |
22 class TracedValue; | 21 class TracedValue; |
23 } | 22 } |
24 class Value; | 23 class Value; |
25 } | 24 } |
26 | 25 |
27 namespace cc { | 26 namespace cc { |
28 | 27 |
29 class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { | 28 class CC_EXPORT PicturePileBase { |
30 public: | 29 public: |
31 PicturePileBase(); | 30 PicturePileBase(); |
32 explicit PicturePileBase(const PicturePileBase* other); | 31 explicit PicturePileBase(const PicturePileBase* other); |
33 | 32 |
34 gfx::Size tiling_size() const { return tiling_.tiling_size(); } | 33 gfx::Size tiling_size() const { return tiling_.tiling_size(); } |
35 void SetMinContentsScale(float min_contents_scale); | 34 void SetMinContentsScale(float min_contents_scale); |
36 | 35 |
37 // If non-empty, all pictures tiles inside this rect are recorded. There may | 36 // If non-empty, all pictures tiles inside this rect are recorded. There may |
38 // be recordings outside this rect, but everything inside the rect is | 37 // be recordings outside this rect, but everything inside the rect is |
39 // recorded. | 38 // recorded. |
40 gfx::Rect recorded_viewport() const { return recorded_viewport_; } | 39 gfx::Rect recorded_viewport() const { return recorded_viewport_; } |
41 | 40 |
42 int num_tiles_x() const { return tiling_.num_tiles_x(); } | 41 int num_tiles_x() const { return tiling_.num_tiles_x(); } |
43 int num_tiles_y() const { return tiling_.num_tiles_y(); } | 42 int num_tiles_y() const { return tiling_.num_tiles_y(); } |
44 gfx::Rect tile_bounds(int x, int y) const { return tiling_.TileBounds(x, y); } | 43 gfx::Rect tile_bounds(int x, int y) const { return tiling_.TileBounds(x, y); } |
45 bool HasRecordingAt(int x, int y); | 44 bool HasRecordingAt(int x, int y); |
46 bool CanRaster(float contents_scale, const gfx::Rect& content_rect); | 45 bool CanRaster(float contents_scale, const gfx::Rect& content_rect) const; |
47 | 46 |
48 // If this pile contains any valid recordings. May have false positives. | 47 // If this pile contains any valid recordings. May have false positives. |
49 bool HasRecordings() const { return has_any_recordings_; } | 48 bool HasRecordings() const { return has_any_recordings_; } |
50 | 49 |
51 // If this pile has ever contained any recordings with text. | |
52 bool has_text() const { return has_text_; } | |
53 | |
54 bool is_solid_color() const { return is_solid_color_; } | 50 bool is_solid_color() const { return is_solid_color_; } |
55 SkColor solid_color() const { return solid_color_; } | 51 SkColor solid_color() const { return solid_color_; } |
56 | 52 |
57 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } | 53 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } |
58 bool is_mask() const { return is_mask_; } | 54 bool is_mask() const { return is_mask_; } |
59 | 55 |
60 static void ComputeTileGridInfo(const gfx::Size& tile_grid_size, | 56 static void ComputeTileGridInfo(const gfx::Size& tile_grid_size, |
61 SkTileGridFactory::TileGridInfo* info); | 57 SkTileGridFactory::TileGridInfo* info); |
62 | 58 |
63 void SetTileGridSize(const gfx::Size& tile_grid_size); | 59 void SetTileGridSize(const gfx::Size& tile_grid_size); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 SkTileGridFactory::TileGridInfo tile_grid_info_; | 117 SkTileGridFactory::TileGridInfo tile_grid_info_; |
122 SkColor background_color_; | 118 SkColor background_color_; |
123 int slow_down_raster_scale_factor_for_debug_; | 119 int slow_down_raster_scale_factor_for_debug_; |
124 bool contents_opaque_; | 120 bool contents_opaque_; |
125 bool contents_fill_bounds_completely_; | 121 bool contents_fill_bounds_completely_; |
126 bool show_debug_picture_borders_; | 122 bool show_debug_picture_borders_; |
127 bool clear_canvas_with_debug_color_; | 123 bool clear_canvas_with_debug_color_; |
128 // A hint about whether there are any recordings. This may be a false | 124 // A hint about whether there are any recordings. This may be a false |
129 // positive. | 125 // positive. |
130 bool has_any_recordings_; | 126 bool has_any_recordings_; |
131 bool has_text_; | |
132 bool is_mask_; | 127 bool is_mask_; |
133 bool is_solid_color_; | 128 bool is_solid_color_; |
134 SkColor solid_color_; | 129 SkColor solid_color_; |
135 | 130 |
136 private: | 131 private: |
137 void SetBufferPixels(int buffer_pixels); | 132 void SetBufferPixels(int buffer_pixels); |
138 | 133 |
139 friend class base::RefCounted<PicturePileBase>; | |
140 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); | 134 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); |
141 }; | 135 }; |
142 | 136 |
143 } // namespace cc | 137 } // namespace cc |
144 | 138 |
145 #endif // CC_RESOURCES_PICTURE_PILE_BASE_H_ | 139 #endif // CC_RESOURCES_PICTURE_PILE_BASE_H_ |
OLD | NEW |