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

Side by Side Diff: src/core/SkRecorder.cpp

Issue 831253002: Revert of Revert of move remaining virtual draw methods to onDraw (Closed) Base URL: https://skia.googlesource.com/skia.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
« no previous file with comments | « src/core/SkRecorder.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkRecorder.h" 8 #include "SkRecorder.h"
9 #include "SkPatchUtils.h" 9 #include "SkPatchUtils.h"
10 #include "SkPicture.h" 10 #include "SkPicture.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return dst; 109 return dst;
110 } 110 }
111 111
112 // As above, assuming and copying a terminating \0. 112 // As above, assuming and copying a terminating \0.
113 template <> 113 template <>
114 char* SkRecorder::copy(const char* src) { 114 char* SkRecorder::copy(const char* src) {
115 return this->copy(src, strlen(src)+1); 115 return this->copy(src, strlen(src)+1);
116 } 116 }
117 117
118 118
119 void SkRecorder::drawPaint(const SkPaint& paint) { 119 void SkRecorder::onDrawPaint(const SkPaint& paint) {
120 APPEND(DrawPaint, delay_copy(paint)); 120 APPEND(DrawPaint, delay_copy(paint));
121 } 121 }
122 122
123 void SkRecorder::drawPoints(PointMode mode, 123 void SkRecorder::onDrawPoints(PointMode mode,
124 size_t count, 124 size_t count,
125 const SkPoint pts[], 125 const SkPoint pts[],
126 const SkPaint& paint) { 126 const SkPaint& paint) {
127 APPEND(DrawPoints, delay_copy(paint), mode, SkToUInt(count), this->copy(pts, count)); 127 APPEND(DrawPoints, delay_copy(paint), mode, SkToUInt(count), this->copy(pts, count));
128 } 128 }
129 129
130 void SkRecorder::drawRect(const SkRect& rect, const SkPaint& paint) { 130 void SkRecorder::onDrawRect(const SkRect& rect, const SkPaint& paint) {
131 APPEND(DrawRect, delay_copy(paint), rect); 131 APPEND(DrawRect, delay_copy(paint), rect);
132 } 132 }
133 133
134 void SkRecorder::drawOval(const SkRect& oval, const SkPaint& paint) { 134 void SkRecorder::onDrawOval(const SkRect& oval, const SkPaint& paint) {
135 APPEND(DrawOval, delay_copy(paint), oval); 135 APPEND(DrawOval, delay_copy(paint), oval);
136 } 136 }
137 137
138 void SkRecorder::drawRRect(const SkRRect& rrect, const SkPaint& paint) { 138 void SkRecorder::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
139 APPEND(DrawRRect, delay_copy(paint), rrect); 139 APPEND(DrawRRect, delay_copy(paint), rrect);
140 } 140 }
141 141
142 void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) { 142 void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) {
143 APPEND(DrawDRRect, delay_copy(paint), outer, inner); 143 APPEND(DrawDRRect, delay_copy(paint), outer, inner);
144 } 144 }
145 145
146 void SkRecorder::onDrawDrawable(SkCanvasDrawable* drawable) { 146 void SkRecorder::onDrawDrawable(SkCanvasDrawable* drawable) {
147 if (!fDrawableList) { 147 if (!fDrawableList) {
148 fDrawableList.reset(SkNEW(SkCanvasDrawableList)); 148 fDrawableList.reset(SkNEW(SkCanvasDrawableList));
149 } 149 }
150 fDrawableList->append(drawable); 150 fDrawableList->append(drawable);
151 APPEND(DrawDrawable, drawable->getBounds(), fDrawableList->count() - 1); 151 APPEND(DrawDrawable, drawable->getBounds(), fDrawableList->count() - 1);
152 } 152 }
153 153
154 void SkRecorder::drawPath(const SkPath& path, const SkPaint& paint) { 154 void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) {
155 APPEND(DrawPath, delay_copy(paint), delay_copy(path)); 155 APPEND(DrawPath, delay_copy(paint), delay_copy(path));
156 } 156 }
157 157
158 void SkRecorder::drawBitmap(const SkBitmap& bitmap, 158 void SkRecorder::onDrawBitmap(const SkBitmap& bitmap,
159 SkScalar left, 159 SkScalar left,
160 SkScalar top, 160 SkScalar top,
161 const SkPaint* paint) { 161 const SkPaint* paint) {
162 APPEND(DrawBitmap, this->copy(paint), delay_copy(bitmap), left, top); 162 APPEND(DrawBitmap, this->copy(paint), delay_copy(bitmap), left, top);
163 } 163 }
164 164
165 void SkRecorder::drawBitmapRectToRect(const SkBitmap& bitmap, 165 void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap,
166 const SkRect* src, 166 const SkRect* src,
167 const SkRect& dst, 167 const SkRect& dst,
168 const SkPaint* paint, 168 const SkPaint* paint,
169 DrawBitmapRectFlags flags) { 169 DrawBitmapRectFlags flags) {
170 if (kBleed_DrawBitmapRectFlag == flags) { 170 if (kBleed_DrawBitmapRectFlag == flags) {
171 APPEND(DrawBitmapRectToRectBleed, 171 APPEND(DrawBitmapRectToRectBleed,
172 this->copy(paint), delay_copy(bitmap), this->copy(src), dst); 172 this->copy(paint), delay_copy(bitmap), this->copy(src), dst);
173 return; 173 return;
174 } 174 }
175 SkASSERT(kNone_DrawBitmapRectFlag == flags); 175 SkASSERT(kNone_DrawBitmapRectFlag == flags);
176 APPEND(DrawBitmapRectToRect, 176 APPEND(DrawBitmapRectToRect,
177 this->copy(paint), delay_copy(bitmap), this->copy(src), dst); 177 this->copy(paint), delay_copy(bitmap), this->copy(src), dst);
178 } 178 }
179 179
180 void SkRecorder::drawBitmapNine(const SkBitmap& bitmap, 180 void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap,
181 const SkIRect& center, 181 const SkIRect& center,
182 const SkRect& dst, 182 const SkRect& dst,
183 const SkPaint* paint) { 183 const SkPaint* paint) {
184 APPEND(DrawBitmapNine, this->copy(paint), delay_copy(bitmap), center, dst); 184 APPEND(DrawBitmapNine, this->copy(paint), delay_copy(bitmap), center, dst);
185 } 185 }
186 186
187 void SkRecorder::drawImage(const SkImage* image, SkScalar left, SkScalar top, 187 void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top,
188 const SkPaint* paint) { 188 const SkPaint* paint) {
189 APPEND(DrawImage, this->copy(paint), image, left, top); 189 APPEND(DrawImage, this->copy(paint), image, left, top);
190 } 190 }
191 191
192 void SkRecorder::drawImageRect(const SkImage* image, const SkRect* src, 192 void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src,
193 const SkRect& dst, 193 const SkRect& dst,
194 const SkPaint* paint) { 194 const SkPaint* paint) {
195 APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst); 195 APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst);
196 } 196 }
197 197
198 void SkRecorder::drawSprite(const SkBitmap& bitmap, int left, int top, const SkP aint* paint) { 198 void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const S kPaint* paint) {
199 APPEND(DrawSprite, this->copy(paint), delay_copy(bitmap), left, top); 199 APPEND(DrawSprite, this->copy(paint), delay_copy(bitmap), left, top);
200 } 200 }
201 201
202 void SkRecorder::onDrawText(const void* text, size_t byteLength, 202 void SkRecorder::onDrawText(const void* text, size_t byteLength,
203 SkScalar x, SkScalar y, const SkPaint& paint) { 203 SkScalar x, SkScalar y, const SkPaint& paint) {
204 APPEND(DrawText, 204 APPEND(DrawText,
205 delay_copy(paint), this->copy((const char*)text, byteLength), byteLen gth, x, y); 205 delay_copy(paint), this->copy((const char*)text, byteLength), byteLen gth, x, y);
206 } 206 }
207 207
208 void SkRecorder::onDrawPosText(const void* text, size_t byteLength, 208 void SkRecorder::onDrawPosText(const void* text, size_t byteLength,
(...skipping 29 matching lines...) Expand all
238 238
239 void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, 239 void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
240 const SkPaint& paint) { 240 const SkPaint& paint) {
241 APPEND(DrawTextBlob, delay_copy(paint), blob, x, y); 241 APPEND(DrawTextBlob, delay_copy(paint), blob, x, y);
242 } 242 }
243 243
244 void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, con st SkPaint* paint) { 244 void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, con st SkPaint* paint) {
245 APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I() ); 245 APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I() );
246 } 246 }
247 247
248 void SkRecorder::drawVertices(VertexMode vmode, 248 void SkRecorder::onDrawVertices(VertexMode vmode,
249 int vertexCount, const SkPoint vertices[], 249 int vertexCount, const SkPoint vertices[],
250 const SkPoint texs[], const SkColor colors[], 250 const SkPoint texs[], const SkColor colors[],
251 SkXfermode* xmode, 251 SkXfermode* xmode,
252 const uint16_t indices[], int indexCount, const Sk Paint& paint) { 252 const uint16_t indices[], int indexCount, const SkPaint& paint) {
253 APPEND(DrawVertices, delay_copy(paint), 253 APPEND(DrawVertices, delay_copy(paint),
254 vmode, 254 vmode,
255 vertexCount, 255 vertexCount,
256 this->copy(vertices, vertexCount), 256 this->copy(vertices, vertexCount),
257 texs ? this->copy(texs, vertexCount) : NULL, 257 texs ? this->copy(texs, vertexCount) : NULL,
258 colors ? this->copy(colors, vertexCount) : NULL, 258 colors ? this->copy(colors, vertexCount) : NULL,
259 xmode, 259 xmode,
260 this->copy(indices, indexCount), 260 this->copy(indices, indexCount),
261 indexCount); 261 indexCount);
262 } 262 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 326 }
327 327
328 void SkRecorder::addComment(const char* key, const char* value) { 328 void SkRecorder::addComment(const char* key, const char* value) {
329 APPEND(AddComment, this->copy(key), this->copy(value)); 329 APPEND(AddComment, this->copy(key), this->copy(value));
330 } 330 }
331 331
332 void SkRecorder::endCommentGroup() { 332 void SkRecorder::endCommentGroup() {
333 APPEND(EndCommentGroup); 333 APPEND(EndCommentGroup);
334 } 334 }
335 335
OLDNEW
« no previous file with comments | « src/core/SkRecorder.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698