Chromium Code Reviews| 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 LazyPixelRefIterator { | |
| 60 public: | |
| 61 LazyPixelRefIterator(gfx::Rect content_rect, | |
| 62 float contents_scale, | |
|
enne (OOO)
2013/04/23 01:59:39
style nit: incorrect indentation
vmpstr
2013/04/23 20:02:23
Fixed.
| |
| 63 const PicturePileImpl* picture_pile); | |
| 64 ~LazyPixelRefIterator(); | |
| 65 | |
| 66 skia::LazyPixelRef* operator->() const { return current_pixel_ref_; } | |
| 67 skia::LazyPixelRef* operator*() const { return current_pixel_ref_; } | |
| 68 LazyPixelRefIterator& operator++(); | |
| 69 operator bool() const { return !!current_pixel_ref_; } | |
| 70 | |
| 71 private: | |
| 72 const PicturePileImpl* picture_pile_; | |
| 73 gfx::Rect layer_rect_; | |
| 74 TilingData::Iterator tile_iterator_; | |
| 75 Picture::LazyPixelRefIterator picture_refs_iterator_; | |
| 76 const PictureList* picture_list_; | |
| 77 PictureList::const_iterator picture_list_iterator_; | |
| 78 skia::LazyPixelRef* current_pixel_ref_; | |
| 79 }; | |
| 80 | |
| 64 protected: | 81 protected: |
| 65 friend class PicturePile; | 82 friend class PicturePile; |
| 83 friend class LazyPixelRefIterator; | |
| 66 | 84 |
| 67 explicit PicturePileImpl(bool enable_lcd_text); | 85 explicit PicturePileImpl(bool enable_lcd_text); |
| 68 PicturePileImpl(const PicturePileBase* other, bool enable_lcd_text); | 86 PicturePileImpl(const PicturePileBase* other, bool enable_lcd_text); |
| 69 virtual ~PicturePileImpl(); | 87 virtual ~PicturePileImpl(); |
| 70 | 88 |
| 71 private: | 89 private: |
| 72 class ClonesForDrawing { | 90 class ClonesForDrawing { |
| 73 public: | 91 public: |
| 74 ClonesForDrawing(const PicturePileImpl* pile, int num_threads); | 92 ClonesForDrawing(const PicturePileImpl* pile, int num_threads); |
| 75 ~ClonesForDrawing(); | 93 ~ClonesForDrawing(); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 90 // instance. This member variable must be last so that other member | 108 // instance. This member variable must be last so that other member |
| 91 // variables have already been initialized and can be clonable. | 109 // variables have already been initialized and can be clonable. |
| 92 const ClonesForDrawing clones_for_drawing_; | 110 const ClonesForDrawing clones_for_drawing_; |
| 93 | 111 |
| 94 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); | 112 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); |
| 95 }; | 113 }; |
| 96 | 114 |
| 97 } // namespace cc | 115 } // namespace cc |
| 98 | 116 |
| 99 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ | 117 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
| OLD | NEW |