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

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

Issue 63443003: cc: Combine analysis and raster (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove analysis time from rendering stats Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/picture.cc ('k') | cc/resources/picture_pile_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 10 #include <set>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 RenderingStatsInstrumentation* stats_instrumentation);
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 void AnalyzeInRect(gfx::Rect content_rect,
79 float contents_scale,
80 Analysis* analysis,
81 RenderingStatsInstrumentation* stats_instrumentation);
82
83 class CC_EXPORT PixelRefIterator { 66 class CC_EXPORT PixelRefIterator {
84 public: 67 public:
85 PixelRefIterator(gfx::Rect content_rect, 68 PixelRefIterator(gfx::Rect content_rect,
86 float contents_scale, 69 float contents_scale,
87 const PicturePileImpl* picture_pile); 70 const PicturePileImpl* picture_pile);
88 ~PixelRefIterator(); 71 ~PixelRefIterator();
89 72
90 skia::LazyPixelRef* operator->() const { return *pixel_ref_iterator_; } 73 skia::LazyPixelRef* operator->() const { return *pixel_ref_iterator_; }
91 skia::LazyPixelRef* operator*() const { return *pixel_ref_iterator_; } 74 skia::LazyPixelRef* operator*() const { return *pixel_ref_iterator_; }
92 PixelRefIterator& operator++(); 75 PixelRefIterator& operator++();
93 operator bool() const { return pixel_ref_iterator_; } 76 operator bool() const { return pixel_ref_iterator_; }
94 77
95 private: 78 private:
96 void AdvanceToTilePictureWithPixelRefs(); 79 void AdvanceToTilePictureWithPixelRefs();
97 80
98 const PicturePileImpl* picture_pile_; 81 const PicturePileImpl* picture_pile_;
99 gfx::Rect layer_rect_; 82 gfx::Rect layer_rect_;
100 TilingData::Iterator tile_iterator_; 83 TilingData::Iterator tile_iterator_;
101 Picture::PixelRefIterator pixel_ref_iterator_; 84 Picture::PixelRefIterator pixel_ref_iterator_;
102 std::set<const void*> processed_pictures_; 85 std::set<const void*> processed_pictures_;
103 }; 86 };
104 87
88 gfx::Rect AnalysisRectForRaster(gfx::Rect content_rect,
89 float contents_scale) const;
90
105 void DidBeginTracing(); 91 void DidBeginTracing();
106 92
107 protected: 93 protected:
108 friend class PicturePile; 94 friend class PicturePile;
109 friend class PixelRefIterator; 95 friend class PixelRefIterator;
110 96
111 PicturePileImpl(); 97 PicturePileImpl();
112 explicit PicturePileImpl(const PicturePileBase* other); 98 explicit PicturePileImpl(const PicturePileBase* other);
113 virtual ~PicturePileImpl(); 99 virtual ~PicturePileImpl();
114 100
(...skipping 14 matching lines...) Expand all
129 115
130 private: 116 private:
131 typedef std::map<Picture*, Region> PictureRegionMap; 117 typedef std::map<Picture*, Region> PictureRegionMap;
132 void CoalesceRasters(gfx::Rect canvas_rect, 118 void CoalesceRasters(gfx::Rect canvas_rect,
133 gfx::Rect content_rect, 119 gfx::Rect content_rect,
134 float contents_scale, 120 float contents_scale,
135 PictureRegionMap* result); 121 PictureRegionMap* result);
136 122
137 void RasterCommon( 123 void RasterCommon(
138 SkCanvas* canvas, 124 SkCanvas* canvas,
139 SkDrawPictureCallback* callback,
140 gfx::Rect canvas_rect, 125 gfx::Rect canvas_rect,
141 float contents_scale, 126 float contents_scale,
142 RenderingStatsInstrumentation* rendering_stats_instrumentation, 127 RenderingStatsInstrumentation* rendering_stats_instrumentation);
143 bool is_analysis);
144 128
145 // Once instantiated, |clones_for_drawing_| can't be modified. This 129 // Once instantiated, |clones_for_drawing_| can't be modified. This
146 // guarantees thread-safe access during the life time of a PicturePileImpl 130 // guarantees thread-safe access during the life time of a PicturePileImpl
147 // instance. This member variable must be last so that other member 131 // instance. This member variable must be last so that other member
148 // variables have already been initialized and can be clonable. 132 // variables have already been initialized and can be clonable.
149 const ClonesForDrawing clones_for_drawing_; 133 const ClonesForDrawing clones_for_drawing_;
150 134
151 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); 135 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl);
152 }; 136 };
153 137
154 } // namespace cc 138 } // namespace cc
155 139
156 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ 140 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_
OLDNEW
« no previous file with comments | « cc/resources/picture.cc ('k') | cc/resources/picture_pile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698