| 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. | 50 // If this pile has ever contained any recordings with text. |
| 52 bool has_text() const { return has_text_; } | 51 bool has_text() const { return has_text_; } |
| 53 | 52 |
| 54 bool is_solid_color() const { return is_solid_color_; } | 53 bool is_solid_color() const { return is_solid_color_; } |
| 55 SkColor solid_color() const { return solid_color_; } | 54 SkColor solid_color() const { return solid_color_; } |
| 56 | 55 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // positive. | 128 // positive. |
| 130 bool has_any_recordings_; | 129 bool has_any_recordings_; |
| 131 bool has_text_; | 130 bool has_text_; |
| 132 bool is_mask_; | 131 bool is_mask_; |
| 133 bool is_solid_color_; | 132 bool is_solid_color_; |
| 134 SkColor solid_color_; | 133 SkColor solid_color_; |
| 135 | 134 |
| 136 private: | 135 private: |
| 137 void SetBufferPixels(int buffer_pixels); | 136 void SetBufferPixels(int buffer_pixels); |
| 138 | 137 |
| 139 friend class base::RefCounted<PicturePileBase>; | |
| 140 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); | 138 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); |
| 141 }; | 139 }; |
| 142 | 140 |
| 143 } // namespace cc | 141 } // namespace cc |
| 144 | 142 |
| 145 #endif // CC_RESOURCES_PICTURE_PILE_BASE_H_ | 143 #endif // CC_RESOURCES_PICTURE_PILE_BASE_H_ |
| OLD | NEW |