| 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 <vector> | 10 #include <vector> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Raster a subrect of this PicturePileImpl into the given canvas. | 31 // Raster a subrect of this PicturePileImpl into the given canvas. |
| 32 // It's only safe to call paint on a cloned version. | 32 // It's only safe to call paint on a cloned version. |
| 33 // It is assumed that contents_scale has already been applied to this canvas. | 33 // It is assumed that contents_scale has already been applied to this canvas. |
| 34 // Return value is the total number of pixels rasterized. | 34 // Return value is the total number of pixels rasterized. |
| 35 int64 Raster( | 35 int64 Raster( |
| 36 SkCanvas* canvas, | 36 SkCanvas* canvas, |
| 37 gfx::Rect canvas_rect, | 37 gfx::Rect canvas_rect, |
| 38 float contents_scale); | 38 float contents_scale); |
| 39 | 39 |
| 40 void GatherPixelRefs( | |
| 41 gfx::Rect content_rect, | |
| 42 float contents_scale, | |
| 43 std::list<skia::LazyPixelRef*>& pixel_refs); | |
| 44 | |
| 45 skia::RefPtr<SkPicture> GetFlattenedPicture(); | 40 skia::RefPtr<SkPicture> GetFlattenedPicture(); |
| 46 | 41 |
| 47 struct CC_EXPORT Analysis { | 42 struct CC_EXPORT Analysis { |
| 48 Analysis(); | 43 Analysis(); |
| 49 ~Analysis(); | 44 ~Analysis(); |
| 50 | 45 |
| 51 bool is_solid_color; | 46 bool is_solid_color; |
| 52 bool is_transparent; | 47 bool is_transparent; |
| 53 bool has_text; | 48 bool has_text; |
| 54 bool is_cheap_to_raster; | 49 bool is_cheap_to_raster; |
| 55 SkColor solid_color; | 50 SkColor solid_color; |
| 56 | 51 |
| 57 skia::AnalysisCanvas::LazyPixelRefList lazy_pixel_refs; | 52 skia::AnalysisCanvas::LazyPixelRefList lazy_pixel_refs; |
| 58 }; | 53 }; |
| 59 | 54 |
| 60 void AnalyzeInRect(gfx::Rect content_rect, | 55 void AnalyzeInRect(gfx::Rect content_rect, |
| 61 float contents_scale, | 56 float contents_scale, |
| 62 Analysis* analysis); | 57 Analysis* analysis); |
| 63 | 58 |
| 59 class CC_EXPORT PixelRefIterator { |
| 60 public: |
| 61 PixelRefIterator(gfx::Rect content_rect, |
| 62 float contents_scale, |
| 63 const PicturePileImpl* picture_pile); |
| 64 ~PixelRefIterator(); |
| 65 |
| 66 skia::LazyPixelRef* operator->() const { return *pixel_ref_iterator_; } |
| 67 skia::LazyPixelRef* operator*() const { return *pixel_ref_iterator_; } |
| 68 PixelRefIterator& operator++(); |
| 69 operator bool() const { return !!*pixel_ref_iterator_; } |
| 70 |
| 71 private: |
| 72 bool AdvanceToTileWithPictures(); |
| 73 void AdvanceToPictureWithPixelRefs(); |
| 74 |
| 75 const PicturePileImpl* picture_pile_; |
| 76 gfx::Rect layer_rect_; |
| 77 TilingData::Iterator tile_iterator_; |
| 78 Picture::PixelRefIterator pixel_ref_iterator_; |
| 79 const PictureList* picture_list_; |
| 80 PictureList::const_iterator picture_list_iterator_; |
| 81 }; |
| 82 |
| 64 protected: | 83 protected: |
| 65 friend class PicturePile; | 84 friend class PicturePile; |
| 85 friend class PixelRefIterator; |
| 66 | 86 |
| 67 explicit PicturePileImpl(bool enable_lcd_text); | 87 explicit PicturePileImpl(bool enable_lcd_text); |
| 68 PicturePileImpl(const PicturePileBase* other, bool enable_lcd_text); | 88 PicturePileImpl(const PicturePileBase* other, bool enable_lcd_text); |
| 69 virtual ~PicturePileImpl(); | 89 virtual ~PicturePileImpl(); |
| 70 | 90 |
| 71 private: | 91 private: |
| 72 class ClonesForDrawing { | 92 class ClonesForDrawing { |
| 73 public: | 93 public: |
| 74 ClonesForDrawing(const PicturePileImpl* pile, int num_threads); | 94 ClonesForDrawing(const PicturePileImpl* pile, int num_threads); |
| 75 ~ClonesForDrawing(); | 95 ~ClonesForDrawing(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 90 // instance. This member variable must be last so that other member | 110 // instance. This member variable must be last so that other member |
| 91 // variables have already been initialized and can be clonable. | 111 // variables have already been initialized and can be clonable. |
| 92 const ClonesForDrawing clones_for_drawing_; | 112 const ClonesForDrawing clones_for_drawing_; |
| 93 | 113 |
| 94 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); | 114 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); |
| 95 }; | 115 }; |
| 96 | 116 |
| 97 } // namespace cc | 117 } // namespace cc |
| 98 | 118 |
| 99 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ | 119 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
| OLD | NEW |