Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: cc/resources/picture_pile_impl.h

Issue 14230007: cc: Do GatherPixelRefs from skia at record time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed gather to iterators Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 Analysis { 42 struct 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(const gfx::Rect& content_rect, 55 void AnalyzeInRect(const gfx::Rect& content_rect,
61 float contents_scale, 56 float contents_scale,
62 Analysis* analysis); 57 Analysis* analysis);
63 58
59 class CC_EXPORT LazyPixelRefsIterator {
60 public:
61 LazyPixelRefsIterator(gfx::Rect content_rect,
62 float contents_scale,
63 const PicturePileImpl* picture_pile);
64 ~LazyPixelRefsIterator();
65
66 skia::LazyPixelRef* operator->() const { return current_pixel_ref_; }
67 skia::LazyPixelRef* operator*() const { return current_pixel_ref_; }
68 LazyPixelRefsIterator& 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::LazyPixelRefsIterator picture_refs_iterator_;
76 PictureList picture_list_;
77 skia::LazyPixelRef* current_pixel_ref_;
78 };
79
64 protected: 80 protected:
65 friend class PicturePile; 81 friend class PicturePile;
82 friend class LazyPixelRefsIterator;
66 83
67 explicit PicturePileImpl(bool enable_lcd_text); 84 explicit PicturePileImpl(bool enable_lcd_text);
68 PicturePileImpl(const PicturePileBase* other, bool enable_lcd_text); 85 PicturePileImpl(const PicturePileBase* other, bool enable_lcd_text);
69 virtual ~PicturePileImpl(); 86 virtual ~PicturePileImpl();
70 87
71 private: 88 private:
72 class ClonesForDrawing { 89 class ClonesForDrawing {
73 public: 90 public:
74 ClonesForDrawing(const PicturePileImpl* pile, int num_threads); 91 ClonesForDrawing(const PicturePileImpl* pile, int num_threads);
75 ~ClonesForDrawing(); 92 ~ClonesForDrawing();
(...skipping 14 matching lines...) Expand all
90 // instance. This member variable must be last so that other member 107 // instance. This member variable must be last so that other member
91 // variables have already been initialized and can be clonable. 108 // variables have already been initialized and can be clonable.
92 const ClonesForDrawing clones_for_drawing_; 109 const ClonesForDrawing clones_for_drawing_;
93 110
94 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); 111 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl);
95 }; 112 };
96 113
97 } // namespace cc 114 } // namespace cc
98 115
99 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ 116 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698