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_IMPL_H_ | 5 #ifndef CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
6 #define CC_RESOURCES_PICTURE_PILE_IMPL_H_ | 6 #define CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Similar to the above RasterDirect method, but this is a convenience method | 46 // Similar to the above RasterDirect method, but this is a convenience method |
47 // for when it is known that the raster is going to an intermediate bitmap | 47 // for when it is known that the raster is going to an intermediate bitmap |
48 // that itself will then be blended and thus that a canvas clear is required. | 48 // that itself will then be blended and thus that a canvas clear is required. |
49 void RasterToBitmap( | 49 void RasterToBitmap( |
50 SkCanvas* canvas, | 50 SkCanvas* canvas, |
51 gfx::Rect canvas_rect, | 51 gfx::Rect canvas_rect, |
52 float contents_scale, | 52 float contents_scale, |
53 RenderingStatsInstrumentation* stats_instrumentation); | 53 RenderingStatsInstrumentation* stats_instrumentation); |
54 | 54 |
55 // Called when analyzing a tile. We can use AnalysisCanvas as | |
56 // SkDrawPictureCallback, which allows us to early out from analysis. | |
57 void RasterForAnalysis( | |
58 skia::AnalysisCanvas* canvas, | |
59 gfx::Rect canvas_rect, | |
60 float contents_scale); | |
61 | |
62 | |
63 skia::RefPtr<SkPicture> GetFlattenedPicture(); | 55 skia::RefPtr<SkPicture> GetFlattenedPicture(); |
64 | 56 |
65 struct CC_EXPORT Analysis { | 57 struct CC_EXPORT Analysis { |
66 Analysis(); | 58 Analysis(); |
67 ~Analysis(); | 59 ~Analysis(); |
68 | 60 |
69 bool is_solid_color; | 61 bool is_solid_color; |
70 bool has_text; | 62 bool has_text; |
71 SkColor solid_color; | 63 SkColor solid_color; |
72 }; | 64 }; |
73 | 65 |
74 void AnalyzeInRect(gfx::Rect content_rect, | |
75 float contents_scale, | |
76 Analysis* analysis); | |
77 | |
78 class CC_EXPORT PixelRefIterator { | 66 class CC_EXPORT PixelRefIterator { |
79 public: | 67 public: |
80 PixelRefIterator(gfx::Rect content_rect, | 68 PixelRefIterator(gfx::Rect content_rect, |
81 float contents_scale, | 69 float contents_scale, |
82 const PicturePileImpl* picture_pile); | 70 const PicturePileImpl* picture_pile); |
83 ~PixelRefIterator(); | 71 ~PixelRefIterator(); |
84 | 72 |
85 skia::LazyPixelRef* operator->() const { return *pixel_ref_iterator_; } | 73 skia::LazyPixelRef* operator->() const { return *pixel_ref_iterator_; } |
86 skia::LazyPixelRef* operator*() const { return *pixel_ref_iterator_; } | 74 skia::LazyPixelRef* operator*() const { return *pixel_ref_iterator_; } |
87 PixelRefIterator& operator++(); | 75 PixelRefIterator& operator++(); |
88 operator bool() const { return pixel_ref_iterator_; } | 76 operator bool() const { return pixel_ref_iterator_; } |
89 | 77 |
90 private: | 78 private: |
91 void AdvanceToTilePictureWithPixelRefs(); | 79 void AdvanceToTilePictureWithPixelRefs(); |
92 | 80 |
93 const PicturePileImpl* picture_pile_; | 81 const PicturePileImpl* picture_pile_; |
94 gfx::Rect layer_rect_; | 82 gfx::Rect layer_rect_; |
95 TilingData::Iterator tile_iterator_; | 83 TilingData::Iterator tile_iterator_; |
96 Picture::PixelRefIterator pixel_ref_iterator_; | 84 Picture::PixelRefIterator pixel_ref_iterator_; |
97 std::set<const void*> processed_pictures_; | 85 std::set<const void*> processed_pictures_; |
98 }; | 86 }; |
99 | 87 |
| 88 gfx::Rect AnalysisRectForRaster(gfx::Rect content_rect, |
| 89 float contents_scale) const; |
| 90 |
100 void DidBeginTracing(); | 91 void DidBeginTracing(); |
101 | 92 |
102 protected: | 93 protected: |
103 friend class PicturePile; | 94 friend class PicturePile; |
104 friend class PixelRefIterator; | 95 friend class PixelRefIterator; |
105 | 96 |
106 PicturePileImpl(); | 97 PicturePileImpl(); |
107 explicit PicturePileImpl(const PicturePileBase* other); | 98 explicit PicturePileImpl(const PicturePileBase* other); |
108 virtual ~PicturePileImpl(); | 99 virtual ~PicturePileImpl(); |
109 | 100 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // instance. This member variable must be last so that other member | 132 // instance. This member variable must be last so that other member |
142 // variables have already been initialized and can be clonable. | 133 // variables have already been initialized and can be clonable. |
143 const ClonesForDrawing clones_for_drawing_; | 134 const ClonesForDrawing clones_for_drawing_; |
144 | 135 |
145 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); | 136 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); |
146 }; | 137 }; |
147 | 138 |
148 } // namespace cc | 139 } // namespace cc |
149 | 140 |
150 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ | 141 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
OLD | NEW |