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

Side by Side Diff: sky/engine/platform/graphics/ProfilingCanvas.cpp

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #include "sky/engine/config.h"
32 #include "sky/engine/platform/graphics/ProfilingCanvas.h"
33
34 #include "sky/engine/wtf/CurrentTime.h"
35
36 namespace blink {
37
38 class AutoStamper {
39 public:
40 explicit AutoStamper(ProfilingCanvas*);
41 ~AutoStamper();
42
43 private:
44 ProfilingCanvas* m_profilingCanvas;
45 double m_startTime;
46 };
47
48 AutoStamper::AutoStamper(ProfilingCanvas* profilingCanvas) : m_profilingCanvas(p rofilingCanvas)
49 {
50 profilingCanvas->m_depthCount++;
51 m_startTime = WTF::monotonicallyIncreasingTime();
52 }
53
54 AutoStamper::~AutoStamper()
55 {
56 m_profilingCanvas->m_depthCount--;
57 if (m_profilingCanvas->m_depthCount)
58 return;
59 double delta = WTF::monotonicallyIncreasingTime() - m_startTime;
60 m_profilingCanvas->m_timings->append(delta);
61 }
62
63 ProfilingCanvas::ProfilingCanvas(SkBitmap bitmap) : InterceptingCanvas(bitmap)
64 {
65 }
66
67 void ProfilingCanvas::setTimings(Vector<double>* timings)
68 {
69 m_timings = timings;
70 }
71
72 void ProfilingCanvas::drawPaint(const SkPaint& paint)
73 {
74 AutoStamper stamper(this);
75 this->SkCanvas::drawPaint(paint);
76 }
77
78 void ProfilingCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts [], const SkPaint& paint)
79 {
80 AutoStamper stamper(this);
81 this->SkCanvas::drawPoints(mode, count, pts, paint);
82 }
83
84 void ProfilingCanvas::drawRect(const SkRect& rect, const SkPaint& paint)
85 {
86 AutoStamper stamper(this);
87 this->SkCanvas::drawRect(rect, paint);
88 }
89
90 void ProfilingCanvas::drawOval(const SkRect& rect, const SkPaint& paint)
91 {
92 AutoStamper stamper(this);
93 this->SkCanvas::drawOval(rect, paint);
94 }
95
96 void ProfilingCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint)
97 {
98 AutoStamper stamper(this);
99 this->SkCanvas::drawRRect(rrect, paint);
100 }
101
102 void ProfilingCanvas::drawPath(const SkPath& path, const SkPaint& paint)
103 {
104 AutoStamper stamper(this);
105 this->SkCanvas::drawPath(path, paint);
106 }
107
108 void ProfilingCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint)
109 {
110 AutoStamper stamper(this);
111 this->SkCanvas::drawBitmap(bitmap, left, top, paint);
112 }
113
114 void ProfilingCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
115 const SkPaint* paint, DrawBitmapRectFlags flags)
116 {
117 AutoStamper stamper(this);
118 this->SkCanvas::drawBitmapRectToRect(bitmap, src, dst, paint, flags);
119 }
120
121 void ProfilingCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& cent er, const SkRect& dst, const SkPaint* paint)
122 {
123 AutoStamper stamper(this);
124 this->SkCanvas::drawBitmapNine(bitmap, center, dst, paint);
125 }
126
127 void ProfilingCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, cons t SkPaint* paint)
128 {
129 AutoStamper stamper(this);
130 this->SkCanvas::drawSprite(bitmap, left, top, paint);
131 }
132
133 void ProfilingCanvas::drawVertices(VertexMode vmode, int vertexCount, const SkPo int vertices[], const SkPoint texs[],
134 const SkColor colors[], SkXfermode* xmode, const uint16_t indices[], int ind exCount, const SkPaint& paint)
135 {
136 AutoStamper stamper(this);
137 this->SkCanvas::drawVertices(vmode, vertexCount, vertices, texs, colors, xmo de, indices, indexCount, paint);
138 }
139
140 void ProfilingCanvas::drawData(const void* data, size_t length)
141 {
142 AutoStamper stamper(this);
143 this->SkCanvas::drawData(data, length);
144 }
145
146 void ProfilingCanvas::beginCommentGroup(const char* description)
147 {
148 AutoStamper stamper(this);
149 this->SkCanvas::beginCommentGroup(description);
150 }
151
152 void ProfilingCanvas::addComment(const char* keyword, const char* value)
153 {
154 AutoStamper stamper(this);
155 this->SkCanvas::addComment(keyword, value);
156 }
157
158 void ProfilingCanvas::endCommentGroup()
159 {
160 AutoStamper stamper(this);
161 this->SkCanvas::endCommentGroup();
162 }
163
164 void ProfilingCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, c onst SkPaint& paint)
165 {
166 AutoStamper stamper(this);
167 this->SkCanvas::onDrawDRRect(outer, inner, paint);
168 }
169
170 void ProfilingCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x , SkScalar y, const SkPaint& paint)
171 {
172 AutoStamper stamper(this);
173 this->SkCanvas::onDrawText(text, byteLength, x, y, paint);
174 }
175
176 void ProfilingCanvas::onDrawPosText(const void* text, size_t byteLength, const S kPoint pos[], const SkPaint& paint)
177 {
178 AutoStamper stamper(this);
179 this->SkCanvas::onDrawPosText(text, byteLength, pos, paint);
180 }
181
182 void ProfilingCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkPaint& paint)
183 {
184 AutoStamper stamper(this);
185 this->SkCanvas::onDrawPosTextH(text, byteLength, xpos, constY, paint);
186 }
187
188 void ProfilingCanvas::onDrawTextOnPath(const void* text, size_t byteLength, cons t SkPath& path, const SkMatrix* matrix, const SkPaint& paint)
189 {
190 AutoStamper stamper(this);
191 this->SkCanvas::onDrawTextOnPath(text, byteLength, path, matrix, paint);
192 }
193
194 void ProfilingCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeSt yle edgeStyle)
195 {
196 AutoStamper stamper(this);
197 this->SkCanvas::onClipRect(rect, op, edgeStyle);
198 }
199
200 void ProfilingCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdg eStyle edgeStyle)
201 {
202 AutoStamper stamper(this);
203 this->SkCanvas::onClipRRect(rrect, op, edgeStyle);
204 }
205
206 void ProfilingCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeSt yle edgeStyle)
207 {
208 AutoStamper stamper(this);
209 this->SkCanvas::onClipPath(path, op, edgeStyle);
210 }
211
212 void ProfilingCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op)
213 {
214 AutoStamper stamper(this);
215 this->SkCanvas::onClipRegion(region, op);
216 }
217
218 void ProfilingCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* ma trix, const SkPaint* paint)
219 {
220 AutoStamper stamper(this);
221 this->SkCanvas::onDrawPicture(picture, matrix, paint);
222 }
223
224 void ProfilingCanvas::didSetMatrix(const SkMatrix& matrix)
225 {
226 AutoStamper stamper(this);
227 this->SkCanvas::didSetMatrix(matrix);
228 }
229
230 void ProfilingCanvas::didConcat(const SkMatrix& matrix)
231 {
232 AutoStamper stamper(this);
233 this->SkCanvas::didConcat(matrix);
234 }
235
236 void ProfilingCanvas::willSave()
237 {
238 AutoStamper stamper(this);
239 this->SkCanvas::willSave();
240 }
241
242 SkCanvas::SaveLayerStrategy ProfilingCanvas::willSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags)
243 {
244 AutoStamper stamper(this);
245 return this->SkCanvas::willSaveLayer(bounds, paint, flags);
246 }
247
248 void ProfilingCanvas::willRestore()
249 {
250 AutoStamper stamper(this);
251 this->SkCanvas::willRestore();
252 }
253
254 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/platform/graphics/ProfilingCanvas.h ('k') | sky/engine/platform/graphics/ReplayingCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698