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 | 28 class CC_EXPORT PicturePileBase { |
30 : public base::RefCountedThreadSafe<PicturePileBase> { | |
31 public: | 29 public: |
32 PicturePileBase(); | 30 PicturePileBase(); |
33 explicit PicturePileBase(const PicturePileBase* other); | 31 explicit PicturePileBase(const PicturePileBase* other); |
34 | 32 |
35 gfx::Size tiling_size() const { return tiling_.tiling_size(); } | 33 gfx::Size tiling_size() const { return tiling_.tiling_size(); } |
36 void SetMinContentsScale(float min_contents_scale); | 34 void SetMinContentsScale(float min_contents_scale); |
37 | 35 |
38 // 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 |
39 // be recordings outside this rect, but everything inside the rect is | 37 // be recordings outside this rect, but everything inside the rect is |
40 // recorded. | 38 // recorded. |
41 gfx::Rect recorded_viewport() const { return recorded_viewport_; } | 39 gfx::Rect recorded_viewport() const { return recorded_viewport_; } |
42 | 40 |
43 int num_tiles_x() const { return tiling_.num_tiles_x(); } | 41 int num_tiles_x() const { return tiling_.num_tiles_x(); } |
44 int num_tiles_y() const { return tiling_.num_tiles_y(); } | 42 int num_tiles_y() const { return tiling_.num_tiles_y(); } |
45 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); } |
46 bool HasRecordingAt(int x, int y); | 44 bool HasRecordingAt(int x, int y); |
47 bool CanRaster(float contents_scale, const gfx::Rect& content_rect); | 45 bool CanRaster(float contents_scale, const gfx::Rect& content_rect) const; |
48 | 46 |
49 // If this pile contains any valid recordings. May have false positives. | 47 // If this pile contains any valid recordings. May have false positives. |
50 bool HasRecordings() const { return has_any_recordings_; } | 48 bool HasRecordings() const { return has_any_recordings_; } |
51 | 49 |
52 // If this pile has ever contained any recordings with text. | 50 // If this pile has ever contained any recordings with text. |
53 bool has_text() const { return has_text_; } | 51 bool has_text() const { return has_text_; } |
54 | 52 |
55 bool is_solid_color() const { return is_solid_color_; } | 53 bool is_solid_color() const { return is_solid_color_; } |
56 SkColor solid_color() const { return solid_color_; } | 54 SkColor solid_color() const { return solid_color_; } |
57 | 55 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // positive. | 128 // positive. |
131 bool has_any_recordings_; | 129 bool has_any_recordings_; |
132 bool has_text_; | 130 bool has_text_; |
133 bool is_mask_; | 131 bool is_mask_; |
134 bool is_solid_color_; | 132 bool is_solid_color_; |
135 SkColor solid_color_; | 133 SkColor solid_color_; |
136 | 134 |
137 private: | 135 private: |
138 void SetBufferPixels(int buffer_pixels); | 136 void SetBufferPixels(int buffer_pixels); |
139 | 137 |
140 friend class base::RefCountedThreadSafe<PicturePileBase>; | |
141 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); | 138 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); |
142 }; | 139 }; |
143 | 140 |
144 } // namespace cc | 141 } // namespace cc |
145 | 142 |
146 #endif // CC_RESOURCES_PICTURE_PILE_BASE_H_ | 143 #endif // CC_RESOURCES_PICTURE_PILE_BASE_H_ |
OLD | NEW |