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

Side by Side Diff: src/utils/debugger/SkDrawCommand.cpp

Issue 708333002: Revert of Revert of SkDrawCommand scrubbing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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/utils/debugger/SkDrawCommand.h ('k') | no next file » | 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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkDrawCommand.h" 10 #include "SkDrawCommand.h"
11 #include "SkObjectParser.h" 11 #include "SkObjectParser.h"
12 12
13 #include "SkTextBlob.h" 13 #include "SkTextBlob.h"
14 14
15 // TODO(chudy): Refactor into non subclass model. 15 // TODO(chudy): Refactor into non subclass model.
16 16
17 SkDrawCommand::SkDrawCommand(DrawType type) 17 SkDrawCommand::SkDrawCommand(DrawType type)
18 : fDrawType(type) 18 : fDrawType(type)
19 , fOffset(0) 19 , fOffset(0)
20 , fVisible(true) { 20 , fVisible(true) {
21 } 21 }
22 22
23 SkDrawCommand::SkDrawCommand() {
24 fOffset = 0;
25 fVisible = true;
26 }
27
28 SkDrawCommand::~SkDrawCommand() { 23 SkDrawCommand::~SkDrawCommand() {
29 fInfo.deleteAll(); 24 fInfo.deleteAll();
30 } 25 }
31 26
32 const char* SkDrawCommand::GetCommandString(DrawType type) { 27 const char* SkDrawCommand::GetCommandString(DrawType type) {
33 switch (type) { 28 switch (type) {
34 case UNUSED: SkDEBUGFAIL("DrawType UNUSED\n"); break; 29 case UNUSED: SkDEBUGFAIL("DrawType UNUSED\n"); break;
35 case DRAW_CLEAR: return "Clear"; 30 case DRAW_CLEAR: return "Clear";
36 case CLIP_PATH: return "Clip Path"; 31 case CLIP_PATH: return "Clip Path";
37 case CLIP_REGION: return "Clip Region"; 32 case CLIP_REGION: return "Clip Region";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 case POP_CULL: return "PopCull"; 69 case POP_CULL: return "PopCull";
75 default: 70 default:
76 SkDebugf("DrawType error 0x%08x\n", type); 71 SkDebugf("DrawType error 0x%08x\n", type);
77 SkASSERT(0); 72 SkASSERT(0);
78 break; 73 break;
79 } 74 }
80 SkDEBUGFAIL("DrawType UNUSED\n"); 75 SkDEBUGFAIL("DrawType UNUSED\n");
81 return NULL; 76 return NULL;
82 } 77 }
83 78
84 SkString SkDrawCommand::toString() { 79 SkString SkDrawCommand::toString() const {
85 return SkString(GetCommandString(fDrawType)); 80 return SkString(GetCommandString(fDrawType));
86 } 81 }
87 82
88 SkClearCommand::SkClearCommand(SkColor color) : INHERITED(DRAW_CLEAR) { 83 SkClearCommand::SkClearCommand(SkColor color) : INHERITED(DRAW_CLEAR) {
89 fColor = color; 84 fColor = color;
90 fInfo.push(SkObjectParser::CustomTextToString("No Parameters")); 85 fInfo.push(SkObjectParser::CustomTextToString("No Parameters"));
91 } 86 }
92 87
93 void SkClearCommand::execute(SkCanvas* canvas) { 88 void SkClearCommand::execute(SkCanvas* canvas) const {
94 canvas->clear(fColor); 89 canvas->clear(fColor);
95 } 90 }
96 91
97 namespace { 92 namespace {
98 93
99 void xlate_and_scale_to_bounds(SkCanvas* canvas, const SkRect& bounds) { 94 void xlate_and_scale_to_bounds(SkCanvas* canvas, const SkRect& bounds) {
100 const SkISize& size = canvas->getDeviceSize(); 95 const SkISize& size = canvas->getDeviceSize();
101 96
102 static const SkScalar kInsetFrac = 0.9f; // Leave a border around object 97 static const SkScalar kInsetFrac = 0.9f; // Leave a border around object
103 98
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 : INHERITED(CLIP_PATH) { 195 : INHERITED(CLIP_PATH) {
201 fPath = path; 196 fPath = path;
202 fOp = op; 197 fOp = op;
203 fDoAA = doAA; 198 fDoAA = doAA;
204 199
205 fInfo.push(SkObjectParser::PathToString(path)); 200 fInfo.push(SkObjectParser::PathToString(path));
206 fInfo.push(SkObjectParser::RegionOpToString(op)); 201 fInfo.push(SkObjectParser::RegionOpToString(op));
207 fInfo.push(SkObjectParser::BoolToString(doAA)); 202 fInfo.push(SkObjectParser::BoolToString(doAA));
208 } 203 }
209 204
210 void SkClipPathCommand::execute(SkCanvas* canvas) { 205 void SkClipPathCommand::execute(SkCanvas* canvas) const {
211 canvas->clipPath(fPath, fOp, fDoAA); 206 canvas->clipPath(fPath, fOp, fDoAA);
212 } 207 }
213 208
214 bool SkClipPathCommand::render(SkCanvas* canvas) const { 209 bool SkClipPathCommand::render(SkCanvas* canvas) const {
215 render_path(canvas, fPath); 210 render_path(canvas, fPath);
216 return true; 211 return true;
217 } 212 }
218 213
219 SkClipRegionCommand::SkClipRegionCommand(const SkRegion& region, SkRegion::Op op ) 214 SkClipRegionCommand::SkClipRegionCommand(const SkRegion& region, SkRegion::Op op )
220 : INHERITED(CLIP_REGION) { 215 : INHERITED(CLIP_REGION) {
221 fRegion = region; 216 fRegion = region;
222 fOp = op; 217 fOp = op;
223 218
224 fInfo.push(SkObjectParser::RegionToString(region)); 219 fInfo.push(SkObjectParser::RegionToString(region));
225 fInfo.push(SkObjectParser::RegionOpToString(op)); 220 fInfo.push(SkObjectParser::RegionOpToString(op));
226 } 221 }
227 222
228 void SkClipRegionCommand::execute(SkCanvas* canvas) { 223 void SkClipRegionCommand::execute(SkCanvas* canvas) const {
229 canvas->clipRegion(fRegion, fOp); 224 canvas->clipRegion(fRegion, fOp);
230 } 225 }
231 226
232 SkClipRectCommand::SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool d oAA) 227 SkClipRectCommand::SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool d oAA)
233 : INHERITED(CLIP_RECT) { 228 : INHERITED(CLIP_RECT) {
234 fRect = rect; 229 fRect = rect;
235 fOp = op; 230 fOp = op;
236 fDoAA = doAA; 231 fDoAA = doAA;
237 232
238 fInfo.push(SkObjectParser::RectToString(rect)); 233 fInfo.push(SkObjectParser::RectToString(rect));
239 fInfo.push(SkObjectParser::RegionOpToString(op)); 234 fInfo.push(SkObjectParser::RegionOpToString(op));
240 fInfo.push(SkObjectParser::BoolToString(doAA)); 235 fInfo.push(SkObjectParser::BoolToString(doAA));
241 } 236 }
242 237
243 void SkClipRectCommand::execute(SkCanvas* canvas) { 238 void SkClipRectCommand::execute(SkCanvas* canvas) const {
244 canvas->clipRect(fRect, fOp, fDoAA); 239 canvas->clipRect(fRect, fOp, fDoAA);
245 } 240 }
246 241
247 SkClipRRectCommand::SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bo ol doAA) 242 SkClipRRectCommand::SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bo ol doAA)
248 : INHERITED(CLIP_RRECT) { 243 : INHERITED(CLIP_RRECT) {
249 fRRect = rrect; 244 fRRect = rrect;
250 fOp = op; 245 fOp = op;
251 fDoAA = doAA; 246 fDoAA = doAA;
252 247
253 fInfo.push(SkObjectParser::RRectToString(rrect)); 248 fInfo.push(SkObjectParser::RRectToString(rrect));
254 fInfo.push(SkObjectParser::RegionOpToString(op)); 249 fInfo.push(SkObjectParser::RegionOpToString(op));
255 fInfo.push(SkObjectParser::BoolToString(doAA)); 250 fInfo.push(SkObjectParser::BoolToString(doAA));
256 } 251 }
257 252
258 void SkClipRRectCommand::execute(SkCanvas* canvas) { 253 void SkClipRRectCommand::execute(SkCanvas* canvas) const {
259 canvas->clipRRect(fRRect, fOp, fDoAA); 254 canvas->clipRRect(fRRect, fOp, fDoAA);
260 } 255 }
261 256
262 bool SkClipRRectCommand::render(SkCanvas* canvas) const { 257 bool SkClipRRectCommand::render(SkCanvas* canvas) const {
263 render_rrect(canvas, fRRect); 258 render_rrect(canvas, fRRect);
264 return true; 259 return true;
265 } 260 }
266 261
267 SkConcatCommand::SkConcatCommand(const SkMatrix& matrix) 262 SkConcatCommand::SkConcatCommand(const SkMatrix& matrix)
268 : INHERITED(CONCAT) { 263 : INHERITED(CONCAT) {
269 fMatrix = matrix; 264 fMatrix = matrix;
270 265
271 fInfo.push(SkObjectParser::MatrixToString(matrix)); 266 fInfo.push(SkObjectParser::MatrixToString(matrix));
272 } 267 }
273 268
274 void SkConcatCommand::execute(SkCanvas* canvas) { 269 void SkConcatCommand::execute(SkCanvas* canvas) const {
275 canvas->concat(fMatrix); 270 canvas->concat(fMatrix);
276 } 271 }
277 272
278 SkDrawBitmapCommand::SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top, 273 SkDrawBitmapCommand::SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top,
279 const SkPaint* paint) 274 const SkPaint* paint)
280 : INHERITED(DRAW_BITMAP) { 275 : INHERITED(DRAW_BITMAP) {
281 fBitmap = bitmap; 276 fBitmap = bitmap;
282 fLeft = left; 277 fLeft = left;
283 fTop = top; 278 fTop = top;
284 if (paint) { 279 if (paint) {
285 fPaint = *paint; 280 fPaint = *paint;
286 fPaintPtr = &fPaint; 281 fPaintPtr = &fPaint;
287 } else { 282 } else {
288 fPaintPtr = NULL; 283 fPaintPtr = NULL;
289 } 284 }
290 285
291 fInfo.push(SkObjectParser::BitmapToString(bitmap)); 286 fInfo.push(SkObjectParser::BitmapToString(bitmap));
292 fInfo.push(SkObjectParser::ScalarToString(left, "SkScalar left: ")); 287 fInfo.push(SkObjectParser::ScalarToString(left, "SkScalar left: "));
293 fInfo.push(SkObjectParser::ScalarToString(top, "SkScalar top: ")); 288 fInfo.push(SkObjectParser::ScalarToString(top, "SkScalar top: "));
294 if (paint) { 289 if (paint) {
295 fInfo.push(SkObjectParser::PaintToString(*paint)); 290 fInfo.push(SkObjectParser::PaintToString(*paint));
296 } 291 }
297 } 292 }
298 293
299 void SkDrawBitmapCommand::execute(SkCanvas* canvas) { 294 void SkDrawBitmapCommand::execute(SkCanvas* canvas) const {
300 canvas->drawBitmap(fBitmap, fLeft, fTop, fPaintPtr); 295 canvas->drawBitmap(fBitmap, fLeft, fTop, fPaintPtr);
301 } 296 }
302 297
303 bool SkDrawBitmapCommand::render(SkCanvas* canvas) const { 298 bool SkDrawBitmapCommand::render(SkCanvas* canvas) const {
304 render_bitmap(canvas, fBitmap); 299 render_bitmap(canvas, fBitmap);
305 return true; 300 return true;
306 } 301 }
307 302
308 SkDrawBitmapMatrixCommand::SkDrawBitmapMatrixCommand(const SkBitmap& bitmap, 303 SkDrawBitmapMatrixCommand::SkDrawBitmapMatrixCommand(const SkBitmap& bitmap,
309 const SkMatrix& matrix, 304 const SkMatrix& matrix,
310 const SkPaint* paint) 305 const SkPaint* paint)
311 : INHERITED(DRAW_BITMAP_MATRIX) { 306 : INHERITED(DRAW_BITMAP_MATRIX) {
312 fBitmap = bitmap; 307 fBitmap = bitmap;
313 fMatrix = matrix; 308 fMatrix = matrix;
314 if (paint) { 309 if (paint) {
315 fPaint = *paint; 310 fPaint = *paint;
316 fPaintPtr = &fPaint; 311 fPaintPtr = &fPaint;
317 } else { 312 } else {
318 fPaintPtr = NULL; 313 fPaintPtr = NULL;
319 } 314 }
320 315
321 fInfo.push(SkObjectParser::BitmapToString(bitmap)); 316 fInfo.push(SkObjectParser::BitmapToString(bitmap));
322 fInfo.push(SkObjectParser::MatrixToString(matrix)); 317 fInfo.push(SkObjectParser::MatrixToString(matrix));
323 if (paint) { 318 if (paint) {
324 fInfo.push(SkObjectParser::PaintToString(*paint)); 319 fInfo.push(SkObjectParser::PaintToString(*paint));
325 } 320 }
326 } 321 }
327 322
328 void SkDrawBitmapMatrixCommand::execute(SkCanvas* canvas) { 323 void SkDrawBitmapMatrixCommand::execute(SkCanvas* canvas) const {
329 canvas->drawBitmapMatrix(fBitmap, fMatrix, fPaintPtr); 324 canvas->drawBitmapMatrix(fBitmap, fMatrix, fPaintPtr);
330 } 325 }
331 326
332 bool SkDrawBitmapMatrixCommand::render(SkCanvas* canvas) const { 327 bool SkDrawBitmapMatrixCommand::render(SkCanvas* canvas) const {
333 render_bitmap(canvas, fBitmap); 328 render_bitmap(canvas, fBitmap);
334 return true; 329 return true;
335 } 330 }
336 331
337 SkDrawBitmapNineCommand::SkDrawBitmapNineCommand(const SkBitmap& bitmap, const S kIRect& center, 332 SkDrawBitmapNineCommand::SkDrawBitmapNineCommand(const SkBitmap& bitmap, const S kIRect& center,
338 const SkRect& dst, const SkPain t* paint) 333 const SkRect& dst, const SkPain t* paint)
339 : INHERITED(DRAW_BITMAP_NINE) { 334 : INHERITED(DRAW_BITMAP_NINE) {
340 fBitmap = bitmap; 335 fBitmap = bitmap;
341 fCenter = center; 336 fCenter = center;
342 fDst = dst; 337 fDst = dst;
343 if (paint) { 338 if (paint) {
344 fPaint = *paint; 339 fPaint = *paint;
345 fPaintPtr = &fPaint; 340 fPaintPtr = &fPaint;
346 } else { 341 } else {
347 fPaintPtr = NULL; 342 fPaintPtr = NULL;
348 } 343 }
349 344
350 fInfo.push(SkObjectParser::BitmapToString(bitmap)); 345 fInfo.push(SkObjectParser::BitmapToString(bitmap));
351 fInfo.push(SkObjectParser::IRectToString(center)); 346 fInfo.push(SkObjectParser::IRectToString(center));
352 fInfo.push(SkObjectParser::RectToString(dst, "Dst: ")); 347 fInfo.push(SkObjectParser::RectToString(dst, "Dst: "));
353 if (paint) { 348 if (paint) {
354 fInfo.push(SkObjectParser::PaintToString(*paint)); 349 fInfo.push(SkObjectParser::PaintToString(*paint));
355 } 350 }
356 } 351 }
357 352
358 void SkDrawBitmapNineCommand::execute(SkCanvas* canvas) { 353 void SkDrawBitmapNineCommand::execute(SkCanvas* canvas) const {
359 canvas->drawBitmapNine(fBitmap, fCenter, fDst, fPaintPtr); 354 canvas->drawBitmapNine(fBitmap, fCenter, fDst, fPaintPtr);
360 } 355 }
361 356
362 bool SkDrawBitmapNineCommand::render(SkCanvas* canvas) const { 357 bool SkDrawBitmapNineCommand::render(SkCanvas* canvas) const {
363 render_bitmap(canvas, fBitmap); 358 render_bitmap(canvas, fBitmap);
364 return true; 359 return true;
365 } 360 }
366 361
367 SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const S kRect* src, 362 SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const S kRect* src,
368 const SkRect& dst, const SkPain t* paint, 363 const SkRect& dst, const SkPain t* paint,
(...skipping 19 matching lines...) Expand all
388 if (src) { 383 if (src) {
389 fInfo.push(SkObjectParser::RectToString(*src, "Src: ")); 384 fInfo.push(SkObjectParser::RectToString(*src, "Src: "));
390 } 385 }
391 fInfo.push(SkObjectParser::RectToString(dst, "Dst: ")); 386 fInfo.push(SkObjectParser::RectToString(dst, "Dst: "));
392 if (paint) { 387 if (paint) {
393 fInfo.push(SkObjectParser::PaintToString(*paint)); 388 fInfo.push(SkObjectParser::PaintToString(*paint));
394 } 389 }
395 fInfo.push(SkObjectParser::IntToString(fFlags, "Flags: ")); 390 fInfo.push(SkObjectParser::IntToString(fFlags, "Flags: "));
396 } 391 }
397 392
398 void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) { 393 void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) const {
399 canvas->drawBitmapRectToRect(fBitmap, this->srcRect(), fDst, fPaintPtr, fFla gs); 394 canvas->drawBitmapRectToRect(fBitmap, this->srcRect(), fDst, fPaintPtr, fFla gs);
400 } 395 }
401 396
402 bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const { 397 bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const {
403 render_bitmap(canvas, fBitmap, this->srcRect()); 398 render_bitmap(canvas, fBitmap, this->srcRect());
404 return true; 399 return true;
405 } 400 }
406 401
407 SkDrawDataCommand::SkDrawDataCommand(const void* data, size_t length) 402 SkDrawDataCommand::SkDrawDataCommand(const void* data, size_t length)
408 : INHERITED(DRAW_DATA) { 403 : INHERITED(DRAW_DATA) {
409 fData = new char[length]; 404 fData = new char[length];
410 memcpy(fData, data, length); 405 memcpy(fData, data, length);
411 fLength = length; 406 fLength = length;
412 407
413 // TODO: add display of actual data? 408 // TODO: add display of actual data?
414 SkString* str = new SkString; 409 SkString* str = new SkString;
415 str->appendf("length: %d", (int) length); 410 str->appendf("length: %d", (int) length);
416 fInfo.push(str); 411 fInfo.push(str);
417 } 412 }
418 413
419 void SkDrawDataCommand::execute(SkCanvas* canvas) { 414 void SkDrawDataCommand::execute(SkCanvas* canvas) const {
420 canvas->drawData(fData, fLength); 415 canvas->drawData(fData, fLength);
421 } 416 }
422 417
423 SkBeginCommentGroupCommand::SkBeginCommentGroupCommand(const char* description) 418 SkBeginCommentGroupCommand::SkBeginCommentGroupCommand(const char* description)
424 : INHERITED(BEGIN_COMMENT_GROUP) 419 : INHERITED(BEGIN_COMMENT_GROUP)
425 , fDescription(description) { 420 , fDescription(description) {
426 SkString* temp = new SkString; 421 SkString* temp = new SkString;
427 temp->appendf("Description: %s", description); 422 temp->appendf("Description: %s", description);
428 fInfo.push(temp); 423 fInfo.push(temp);
429 } 424 }
(...skipping 13 matching lines...) Expand all
443 438
444 SkDrawOvalCommand::SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint) 439 SkDrawOvalCommand::SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint)
445 : INHERITED(DRAW_OVAL) { 440 : INHERITED(DRAW_OVAL) {
446 fOval = oval; 441 fOval = oval;
447 fPaint = paint; 442 fPaint = paint;
448 443
449 fInfo.push(SkObjectParser::RectToString(oval)); 444 fInfo.push(SkObjectParser::RectToString(oval));
450 fInfo.push(SkObjectParser::PaintToString(paint)); 445 fInfo.push(SkObjectParser::PaintToString(paint));
451 } 446 }
452 447
453 void SkDrawOvalCommand::execute(SkCanvas* canvas) { 448 void SkDrawOvalCommand::execute(SkCanvas* canvas) const {
454 canvas->drawOval(fOval, fPaint); 449 canvas->drawOval(fOval, fPaint);
455 } 450 }
456 451
457 bool SkDrawOvalCommand::render(SkCanvas* canvas) const { 452 bool SkDrawOvalCommand::render(SkCanvas* canvas) const {
458 canvas->clear(0xFFFFFFFF); 453 canvas->clear(0xFFFFFFFF);
459 canvas->save(); 454 canvas->save();
460 455
461 xlate_and_scale_to_bounds(canvas, fOval); 456 xlate_and_scale_to_bounds(canvas, fOval);
462 457
463 SkPaint p; 458 SkPaint p;
464 p.setColor(SK_ColorBLACK); 459 p.setColor(SK_ColorBLACK);
465 p.setStyle(SkPaint::kStroke_Style); 460 p.setStyle(SkPaint::kStroke_Style);
466 461
467 canvas->drawOval(fOval, p); 462 canvas->drawOval(fOval, p);
468 canvas->restore(); 463 canvas->restore();
469 464
470 return true; 465 return true;
471 } 466 }
472 467
473 SkDrawPaintCommand::SkDrawPaintCommand(const SkPaint& paint) 468 SkDrawPaintCommand::SkDrawPaintCommand(const SkPaint& paint)
474 : INHERITED(DRAW_PAINT) { 469 : INHERITED(DRAW_PAINT) {
475 fPaint = paint; 470 fPaint = paint;
476 471
477 fInfo.push(SkObjectParser::PaintToString(paint)); 472 fInfo.push(SkObjectParser::PaintToString(paint));
478 } 473 }
479 474
480 void SkDrawPaintCommand::execute(SkCanvas* canvas) { 475 void SkDrawPaintCommand::execute(SkCanvas* canvas) const {
481 canvas->drawPaint(fPaint); 476 canvas->drawPaint(fPaint);
482 } 477 }
483 478
484 bool SkDrawPaintCommand::render(SkCanvas* canvas) const { 479 bool SkDrawPaintCommand::render(SkCanvas* canvas) const {
485 canvas->clear(0xFFFFFFFF); 480 canvas->clear(0xFFFFFFFF);
486 canvas->drawPaint(fPaint); 481 canvas->drawPaint(fPaint);
487 return true; 482 return true;
488 } 483 }
489 484
490 SkDrawPathCommand::SkDrawPathCommand(const SkPath& path, const SkPaint& paint) 485 SkDrawPathCommand::SkDrawPathCommand(const SkPath& path, const SkPaint& paint)
491 : INHERITED(DRAW_PATH) { 486 : INHERITED(DRAW_PATH) {
492 fPath = path; 487 fPath = path;
493 fPaint = paint; 488 fPaint = paint;
494 489
495 fInfo.push(SkObjectParser::PathToString(path)); 490 fInfo.push(SkObjectParser::PathToString(path));
496 fInfo.push(SkObjectParser::PaintToString(paint)); 491 fInfo.push(SkObjectParser::PaintToString(paint));
497 } 492 }
498 493
499 void SkDrawPathCommand::execute(SkCanvas* canvas) { 494 void SkDrawPathCommand::execute(SkCanvas* canvas) const {
500 canvas->drawPath(fPath, fPaint); 495 canvas->drawPath(fPath, fPaint);
501 } 496 }
502 497
503 bool SkDrawPathCommand::render(SkCanvas* canvas) const { 498 bool SkDrawPathCommand::render(SkCanvas* canvas) const {
504 render_path(canvas, fPath); 499 render_path(canvas, fPath);
505 return true; 500 return true;
506 } 501 }
507 502
508 SkDrawPictureCommand::SkDrawPictureCommand(const SkPicture* picture, 503 SkDrawPictureCommand::SkDrawPictureCommand(const SkPicture* picture,
509 const SkMatrix* matrix, 504 const SkMatrix* matrix,
(...skipping 18 matching lines...) Expand all
528 picture->cullRect().fRight, picture->cullRect().fBottom); 523 picture->cullRect().fRight, picture->cullRect().fBottom);
529 fInfo.push(temp); 524 fInfo.push(temp);
530 if (matrix) { 525 if (matrix) {
531 fInfo.push(SkObjectParser::MatrixToString(*matrix)); 526 fInfo.push(SkObjectParser::MatrixToString(*matrix));
532 } 527 }
533 if (paint) { 528 if (paint) {
534 fInfo.push(SkObjectParser::PaintToString(*paint)); 529 fInfo.push(SkObjectParser::PaintToString(*paint));
535 } 530 }
536 } 531 }
537 532
538 void SkDrawPictureCommand::execute(SkCanvas* canvas) { 533 void SkDrawPictureCommand::execute(SkCanvas* canvas) const {
539 canvas->drawPicture(fPicture, fMatrixPtr, fPaintPtr); 534 canvas->drawPicture(fPicture, fMatrixPtr, fPaintPtr);
540 } 535 }
541 536
542 bool SkDrawPictureCommand::render(SkCanvas* canvas) const { 537 bool SkDrawPictureCommand::render(SkCanvas* canvas) const {
543 canvas->clear(0xFFFFFFFF); 538 canvas->clear(0xFFFFFFFF);
544 canvas->save(); 539 canvas->save();
545 540
546 xlate_and_scale_to_bounds(canvas, fPicture->cullRect()); 541 xlate_and_scale_to_bounds(canvas, fPicture->cullRect());
547 542
548 canvas->drawPicture(fPicture.get()); 543 canvas->drawPicture(fPicture.get());
(...skipping 12 matching lines...) Expand all
561 memcpy(fPts, pts, count * sizeof(SkPoint)); 556 memcpy(fPts, pts, count * sizeof(SkPoint));
562 fPaint = paint; 557 fPaint = paint;
563 558
564 fInfo.push(SkObjectParser::PointsToString(pts, count)); 559 fInfo.push(SkObjectParser::PointsToString(pts, count));
565 fInfo.push(SkObjectParser::ScalarToString(SkIntToScalar((unsigned int)count) , 560 fInfo.push(SkObjectParser::ScalarToString(SkIntToScalar((unsigned int)count) ,
566 "Points: ")); 561 "Points: "));
567 fInfo.push(SkObjectParser::PointModeToString(mode)); 562 fInfo.push(SkObjectParser::PointModeToString(mode));
568 fInfo.push(SkObjectParser::PaintToString(paint)); 563 fInfo.push(SkObjectParser::PaintToString(paint));
569 } 564 }
570 565
571 void SkDrawPointsCommand::execute(SkCanvas* canvas) { 566 void SkDrawPointsCommand::execute(SkCanvas* canvas) const {
572 canvas->drawPoints(fMode, fCount, fPts, fPaint); 567 canvas->drawPoints(fMode, fCount, fPts, fPaint);
573 } 568 }
574 569
575 bool SkDrawPointsCommand::render(SkCanvas* canvas) const { 570 bool SkDrawPointsCommand::render(SkCanvas* canvas) const {
576 canvas->clear(0xFFFFFFFF); 571 canvas->clear(0xFFFFFFFF);
577 canvas->save(); 572 canvas->save();
578 573
579 SkRect bounds; 574 SkRect bounds;
580 575
581 bounds.setEmpty(); 576 bounds.setEmpty();
(...skipping 26 matching lines...) Expand all
608 memcpy(fPos, pos, numPts * sizeof(SkPoint)); 603 memcpy(fPos, pos, numPts * sizeof(SkPoint));
609 604
610 fPaint = paint; 605 fPaint = paint;
611 606
612 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing())); 607 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing()));
613 // TODO(chudy): Test that this works. 608 // TODO(chudy): Test that this works.
614 fInfo.push(SkObjectParser::PointsToString(pos, 1)); 609 fInfo.push(SkObjectParser::PointsToString(pos, 1));
615 fInfo.push(SkObjectParser::PaintToString(paint)); 610 fInfo.push(SkObjectParser::PaintToString(paint));
616 } 611 }
617 612
618 void SkDrawPosTextCommand::execute(SkCanvas* canvas) { 613 void SkDrawPosTextCommand::execute(SkCanvas* canvas) const {
619 canvas->drawPosText(fText, fByteLength, fPos, fPaint); 614 canvas->drawPosText(fText, fByteLength, fPos, fPaint);
620 } 615 }
621 616
622 617
623 SkDrawPosTextHCommand::SkDrawPosTextHCommand(const void* text, size_t byteLength , 618 SkDrawPosTextHCommand::SkDrawPosTextHCommand(const void* text, size_t byteLength ,
624 const SkScalar xpos[], SkScalar con stY, 619 const SkScalar xpos[], SkScalar con stY,
625 const SkPaint& paint) 620 const SkPaint& paint)
626 : INHERITED(DRAW_POS_TEXT_H) { 621 : INHERITED(DRAW_POS_TEXT_H) {
627 size_t numPts = paint.countText(text, byteLength); 622 size_t numPts = paint.countText(text, byteLength);
628 623
629 fText = new char[byteLength]; 624 fText = new char[byteLength];
630 memcpy(fText, text, byteLength); 625 memcpy(fText, text, byteLength);
631 fByteLength = byteLength; 626 fByteLength = byteLength;
632 627
633 fXpos = new SkScalar[numPts]; 628 fXpos = new SkScalar[numPts];
634 memcpy(fXpos, xpos, numPts * sizeof(SkScalar)); 629 memcpy(fXpos, xpos, numPts * sizeof(SkScalar));
635 630
636 fConstY = constY; 631 fConstY = constY;
637 fPaint = paint; 632 fPaint = paint;
638 633
639 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing())); 634 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing()));
640 fInfo.push(SkObjectParser::ScalarToString(xpos[0], "XPOS: ")); 635 fInfo.push(SkObjectParser::ScalarToString(xpos[0], "XPOS: "));
641 fInfo.push(SkObjectParser::ScalarToString(constY, "SkScalar constY: ")); 636 fInfo.push(SkObjectParser::ScalarToString(constY, "SkScalar constY: "));
642 fInfo.push(SkObjectParser::PaintToString(paint)); 637 fInfo.push(SkObjectParser::PaintToString(paint));
643 } 638 }
644 639
645 void SkDrawPosTextHCommand::execute(SkCanvas* canvas) { 640 void SkDrawPosTextHCommand::execute(SkCanvas* canvas) const {
646 canvas->drawPosTextH(fText, fByteLength, fXpos, fConstY, fPaint); 641 canvas->drawPosTextH(fText, fByteLength, fXpos, fConstY, fPaint);
647 } 642 }
648 643
649 SkDrawTextBlobCommand::SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y, 644 SkDrawTextBlobCommand::SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y,
650 const SkPaint& paint) 645 const SkPaint& paint)
651 : INHERITED(DRAW_TEXT_BLOB) 646 : INHERITED(DRAW_TEXT_BLOB)
652 , fBlob(blob) 647 , fBlob(blob)
653 , fXPos(x) 648 , fXPos(x)
654 , fYPos(y) 649 , fYPos(y)
655 , fPaint(paint) { 650 , fPaint(paint) {
656 651
657 blob->ref(); 652 blob->ref();
658 653
659 // FIXME: push blob info 654 // FIXME: push blob info
660 fInfo.push(SkObjectParser::ScalarToString(x, "XPOS: ")); 655 fInfo.push(SkObjectParser::ScalarToString(x, "XPOS: "));
661 fInfo.push(SkObjectParser::ScalarToString(x, "YPOS: ")); 656 fInfo.push(SkObjectParser::ScalarToString(x, "YPOS: "));
662 fInfo.push(SkObjectParser::PaintToString(paint)); 657 fInfo.push(SkObjectParser::PaintToString(paint));
663 } 658 }
664 659
665 void SkDrawTextBlobCommand::execute(SkCanvas* canvas) { 660 void SkDrawTextBlobCommand::execute(SkCanvas* canvas) const {
666 canvas->drawTextBlob(fBlob, fXPos, fYPos, fPaint); 661 canvas->drawTextBlob(fBlob, fXPos, fYPos, fPaint);
667 } 662 }
668 663
669 bool SkDrawTextBlobCommand::render(SkCanvas* canvas) const { 664 bool SkDrawTextBlobCommand::render(SkCanvas* canvas) const {
670 canvas->clear(SK_ColorWHITE); 665 canvas->clear(SK_ColorWHITE);
671 canvas->save(); 666 canvas->save();
672 667
673 SkRect bounds = fBlob->bounds().makeOffset(fXPos, fYPos); 668 SkRect bounds = fBlob->bounds().makeOffset(fXPos, fYPos);
674 xlate_and_scale_to_bounds(canvas, bounds); 669 xlate_and_scale_to_bounds(canvas, bounds);
675 670
676 canvas->drawTextBlob(fBlob.get(), fXPos, fYPos, fPaint); 671 canvas->drawTextBlob(fBlob.get(), fXPos, fYPos, fPaint);
677 672
678 canvas->restore(); 673 canvas->restore();
679 674
680 return true; 675 return true;
681 } 676 }
682 677
683 SkDrawRectCommand::SkDrawRectCommand(const SkRect& rect, const SkPaint& paint) 678 SkDrawRectCommand::SkDrawRectCommand(const SkRect& rect, const SkPaint& paint)
684 : INHERITED(DRAW_RECT) { 679 : INHERITED(DRAW_RECT) {
685 fRect = rect; 680 fRect = rect;
686 fPaint = paint; 681 fPaint = paint;
687 682
688 fInfo.push(SkObjectParser::RectToString(rect)); 683 fInfo.push(SkObjectParser::RectToString(rect));
689 fInfo.push(SkObjectParser::PaintToString(paint)); 684 fInfo.push(SkObjectParser::PaintToString(paint));
690 } 685 }
691 686
692 void SkDrawRectCommand::execute(SkCanvas* canvas) { 687 void SkDrawRectCommand::execute(SkCanvas* canvas) const {
693 canvas->drawRect(fRect, fPaint); 688 canvas->drawRect(fRect, fPaint);
694 } 689 }
695 690
696 SkDrawRRectCommand::SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& pain t) 691 SkDrawRRectCommand::SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& pain t)
697 : INHERITED(DRAW_RRECT) { 692 : INHERITED(DRAW_RRECT) {
698 fRRect = rrect; 693 fRRect = rrect;
699 fPaint = paint; 694 fPaint = paint;
700 695
701 fInfo.push(SkObjectParser::RRectToString(rrect)); 696 fInfo.push(SkObjectParser::RRectToString(rrect));
702 fInfo.push(SkObjectParser::PaintToString(paint)); 697 fInfo.push(SkObjectParser::PaintToString(paint));
703 } 698 }
704 699
705 void SkDrawRRectCommand::execute(SkCanvas* canvas) { 700 void SkDrawRRectCommand::execute(SkCanvas* canvas) const {
706 canvas->drawRRect(fRRect, fPaint); 701 canvas->drawRRect(fRRect, fPaint);
707 } 702 }
708 703
709 bool SkDrawRRectCommand::render(SkCanvas* canvas) const { 704 bool SkDrawRRectCommand::render(SkCanvas* canvas) const {
710 render_rrect(canvas, fRRect); 705 render_rrect(canvas, fRRect);
711 return true; 706 return true;
712 } 707 }
713 708
714 SkDrawDRRectCommand::SkDrawDRRectCommand(const SkRRect& outer, 709 SkDrawDRRectCommand::SkDrawDRRectCommand(const SkRRect& outer,
715 const SkRRect& inner, 710 const SkRRect& inner,
716 const SkPaint& paint) 711 const SkPaint& paint)
717 : INHERITED(DRAW_DRRECT) { 712 : INHERITED(DRAW_DRRECT) {
718 fOuter = outer; 713 fOuter = outer;
719 fInner = inner; 714 fInner = inner;
720 fPaint = paint; 715 fPaint = paint;
721 716
722 fInfo.push(SkObjectParser::RRectToString(outer)); 717 fInfo.push(SkObjectParser::RRectToString(outer));
723 fInfo.push(SkObjectParser::RRectToString(inner)); 718 fInfo.push(SkObjectParser::RRectToString(inner));
724 fInfo.push(SkObjectParser::PaintToString(paint)); 719 fInfo.push(SkObjectParser::PaintToString(paint));
725 } 720 }
726 721
727 void SkDrawDRRectCommand::execute(SkCanvas* canvas) { 722 void SkDrawDRRectCommand::execute(SkCanvas* canvas) const {
728 canvas->drawDRRect(fOuter, fInner, fPaint); 723 canvas->drawDRRect(fOuter, fInner, fPaint);
729 } 724 }
730 725
731 bool SkDrawDRRectCommand::render(SkCanvas* canvas) const { 726 bool SkDrawDRRectCommand::render(SkCanvas* canvas) const {
732 render_drrect(canvas, fOuter, fInner); 727 render_drrect(canvas, fOuter, fInner);
733 return true; 728 return true;
734 } 729 }
735 730
736 SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int t op, 731 SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int t op,
737 const SkPaint* paint) 732 const SkPaint* paint)
738 : INHERITED(DRAW_SPRITE) { 733 : INHERITED(DRAW_SPRITE) {
739 fBitmap = bitmap; 734 fBitmap = bitmap;
740 fLeft = left; 735 fLeft = left;
741 fTop = top; 736 fTop = top;
742 if (paint) { 737 if (paint) {
743 fPaint = *paint; 738 fPaint = *paint;
744 fPaintPtr = &fPaint; 739 fPaintPtr = &fPaint;
745 } else { 740 } else {
746 fPaintPtr = NULL; 741 fPaintPtr = NULL;
747 } 742 }
748 743
749 fInfo.push(SkObjectParser::BitmapToString(bitmap)); 744 fInfo.push(SkObjectParser::BitmapToString(bitmap));
750 fInfo.push(SkObjectParser::IntToString(left, "Left: ")); 745 fInfo.push(SkObjectParser::IntToString(left, "Left: "));
751 fInfo.push(SkObjectParser::IntToString(top, "Top: ")); 746 fInfo.push(SkObjectParser::IntToString(top, "Top: "));
752 if (paint) { 747 if (paint) {
753 fInfo.push(SkObjectParser::PaintToString(*paint)); 748 fInfo.push(SkObjectParser::PaintToString(*paint));
754 } 749 }
755 } 750 }
756 751
757 void SkDrawSpriteCommand::execute(SkCanvas* canvas) { 752 void SkDrawSpriteCommand::execute(SkCanvas* canvas) const {
758 canvas->drawSprite(fBitmap, fLeft, fTop, fPaintPtr); 753 canvas->drawSprite(fBitmap, fLeft, fTop, fPaintPtr);
759 } 754 }
760 755
761 bool SkDrawSpriteCommand::render(SkCanvas* canvas) const { 756 bool SkDrawSpriteCommand::render(SkCanvas* canvas) const {
762 render_bitmap(canvas, fBitmap); 757 render_bitmap(canvas, fBitmap);
763 return true; 758 return true;
764 } 759 }
765 760
766 SkDrawTextCommand::SkDrawTextCommand(const void* text, size_t byteLength, SkScal ar x, SkScalar y, 761 SkDrawTextCommand::SkDrawTextCommand(const void* text, size_t byteLength, SkScal ar x, SkScalar y,
767 const SkPaint& paint) 762 const SkPaint& paint)
768 : INHERITED(DRAW_TEXT) { 763 : INHERITED(DRAW_TEXT) {
769 fText = new char[byteLength]; 764 fText = new char[byteLength];
770 memcpy(fText, text, byteLength); 765 memcpy(fText, text, byteLength);
771 fByteLength = byteLength; 766 fByteLength = byteLength;
772 fX = x; 767 fX = x;
773 fY = y; 768 fY = y;
774 fPaint = paint; 769 fPaint = paint;
775 770
776 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing())); 771 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing()));
777 fInfo.push(SkObjectParser::ScalarToString(x, "SkScalar x: ")); 772 fInfo.push(SkObjectParser::ScalarToString(x, "SkScalar x: "));
778 fInfo.push(SkObjectParser::ScalarToString(y, "SkScalar y: ")); 773 fInfo.push(SkObjectParser::ScalarToString(y, "SkScalar y: "));
779 fInfo.push(SkObjectParser::PaintToString(paint)); 774 fInfo.push(SkObjectParser::PaintToString(paint));
780 } 775 }
781 776
782 void SkDrawTextCommand::execute(SkCanvas* canvas) { 777 void SkDrawTextCommand::execute(SkCanvas* canvas) const {
783 canvas->drawText(fText, fByteLength, fX, fY, fPaint); 778 canvas->drawText(fText, fByteLength, fX, fY, fPaint);
784 } 779 }
785 780
786 SkDrawTextOnPathCommand::SkDrawTextOnPathCommand(const void* text, size_t byteLe ngth, 781 SkDrawTextOnPathCommand::SkDrawTextOnPathCommand(const void* text, size_t byteLe ngth,
787 const SkPath& path, const SkMat rix* matrix, 782 const SkPath& path, const SkMat rix* matrix,
788 const SkPaint& paint) 783 const SkPaint& paint)
789 : INHERITED(DRAW_TEXT_ON_PATH) { 784 : INHERITED(DRAW_TEXT_ON_PATH) {
790 fText = new char[byteLength]; 785 fText = new char[byteLength];
791 memcpy(fText, text, byteLength); 786 memcpy(fText, text, byteLength);
792 fByteLength = byteLength; 787 fByteLength = byteLength;
793 fPath = path; 788 fPath = path;
794 if (matrix) { 789 if (matrix) {
795 fMatrix = *matrix; 790 fMatrix = *matrix;
796 } else { 791 } else {
797 fMatrix.setIdentity(); 792 fMatrix.setIdentity();
798 } 793 }
799 fPaint = paint; 794 fPaint = paint;
800 795
801 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing())); 796 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing()));
802 fInfo.push(SkObjectParser::PathToString(path)); 797 fInfo.push(SkObjectParser::PathToString(path));
803 if (matrix) { 798 if (matrix) {
804 fInfo.push(SkObjectParser::MatrixToString(*matrix)); 799 fInfo.push(SkObjectParser::MatrixToString(*matrix));
805 } 800 }
806 fInfo.push(SkObjectParser::PaintToString(paint)); 801 fInfo.push(SkObjectParser::PaintToString(paint));
807 } 802 }
808 803
809 void SkDrawTextOnPathCommand::execute(SkCanvas* canvas) { 804 void SkDrawTextOnPathCommand::execute(SkCanvas* canvas) const {
810 canvas->drawTextOnPath(fText, fByteLength, fPath, 805 canvas->drawTextOnPath(fText, fByteLength, fPath,
811 fMatrix.isIdentity() ? NULL : &fMatrix, 806 fMatrix.isIdentity() ? NULL : &fMatrix,
812 fPaint); 807 fPaint);
813 } 808 }
814 809
815 SkDrawVerticesCommand::SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int ver texCount, 810 SkDrawVerticesCommand::SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int ver texCount,
816 const SkPoint vertices[], const SkP oint texs[], 811 const SkPoint vertices[], const SkP oint texs[],
817 const SkColor colors[], SkXfermode* xfermode, 812 const SkColor colors[], SkXfermode* xfermode,
818 const uint16_t indices[], int index Count, 813 const uint16_t indices[], int index Count,
819 const SkPaint& paint) 814 const SkPaint& paint)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 } 855 }
861 856
862 SkDrawVerticesCommand::~SkDrawVerticesCommand() { 857 SkDrawVerticesCommand::~SkDrawVerticesCommand() {
863 delete [] fVertices; 858 delete [] fVertices;
864 delete [] fTexs; 859 delete [] fTexs;
865 delete [] fColors; 860 delete [] fColors;
866 SkSafeUnref(fXfermode); 861 SkSafeUnref(fXfermode);
867 delete [] fIndices; 862 delete [] fIndices;
868 } 863 }
869 864
870 void SkDrawVerticesCommand::execute(SkCanvas* canvas) { 865 void SkDrawVerticesCommand::execute(SkCanvas* canvas) const {
871 canvas->drawVertices(fVmode, fVertexCount, fVertices, 866 canvas->drawVertices(fVmode, fVertexCount, fVertices,
872 fTexs, fColors, fXfermode, fIndices, 867 fTexs, fColors, fXfermode, fIndices,
873 fIndexCount, fPaint); 868 fIndexCount, fPaint);
874 } 869 }
875 870
876 SkRestoreCommand::SkRestoreCommand() 871 SkRestoreCommand::SkRestoreCommand()
877 : INHERITED(RESTORE) { 872 : INHERITED(RESTORE) {
878 fInfo.push(SkObjectParser::CustomTextToString("No Parameters")); 873 fInfo.push(SkObjectParser::CustomTextToString("No Parameters"));
879 } 874 }
880 875
881 void SkRestoreCommand::execute(SkCanvas* canvas) { 876 void SkRestoreCommand::execute(SkCanvas* canvas) const {
882 canvas->restore(); 877 canvas->restore();
883 } 878 }
884 879
885 void SkRestoreCommand::trackSaveState(int* state) { 880 void SkRestoreCommand::trackSaveState(int* state) {
886 (*state)--; 881 (*state)--;
887 } 882 }
888 883
889 SkRotateCommand::SkRotateCommand(SkScalar degrees) 884 SkRotateCommand::SkRotateCommand(SkScalar degrees)
890 : INHERITED(ROTATE) { 885 : INHERITED(ROTATE) {
891 fDegrees = degrees; 886 fDegrees = degrees;
892 887
893 fInfo.push(SkObjectParser::ScalarToString(degrees, "SkScalar degrees: ")); 888 fInfo.push(SkObjectParser::ScalarToString(degrees, "SkScalar degrees: "));
894 } 889 }
895 890
896 void SkRotateCommand::execute(SkCanvas* canvas) { 891 void SkRotateCommand::execute(SkCanvas* canvas) const {
897 canvas->rotate(fDegrees); 892 canvas->rotate(fDegrees);
898 } 893 }
899 894
900 SkSaveCommand::SkSaveCommand() 895 SkSaveCommand::SkSaveCommand()
901 : INHERITED(SAVE) { 896 : INHERITED(SAVE) {
902 } 897 }
903 898
904 void SkSaveCommand::execute(SkCanvas* canvas) { 899 void SkSaveCommand::execute(SkCanvas* canvas) const {
905 canvas->save(); 900 canvas->save();
906 } 901 }
907 902
908 void SkSaveCommand::trackSaveState(int* state) { 903 void SkSaveCommand::trackSaveState(int* state) {
909 (*state)++; 904 (*state)++;
910 } 905 }
911 906
912 SkSaveLayerCommand::SkSaveLayerCommand(const SkRect* bounds, const SkPaint* pain t, 907 SkSaveLayerCommand::SkSaveLayerCommand(const SkRect* bounds, const SkPaint* pain t,
913 SkCanvas::SaveFlags flags) 908 SkCanvas::SaveFlags flags)
914 : INHERITED(SAVE_LAYER) { 909 : INHERITED(SAVE_LAYER) {
(...skipping 13 matching lines...) Expand all
928 923
929 if (bounds) { 924 if (bounds) {
930 fInfo.push(SkObjectParser::RectToString(*bounds, "Bounds: ")); 925 fInfo.push(SkObjectParser::RectToString(*bounds, "Bounds: "));
931 } 926 }
932 if (paint) { 927 if (paint) {
933 fInfo.push(SkObjectParser::PaintToString(*paint)); 928 fInfo.push(SkObjectParser::PaintToString(*paint));
934 } 929 }
935 fInfo.push(SkObjectParser::SaveFlagsToString(flags)); 930 fInfo.push(SkObjectParser::SaveFlagsToString(flags));
936 } 931 }
937 932
938 void SkSaveLayerCommand::execute(SkCanvas* canvas) { 933 void SkSaveLayerCommand::execute(SkCanvas* canvas) const {
939 canvas->saveLayer(fBounds.isEmpty() ? NULL : &fBounds, 934 canvas->saveLayer(fBounds.isEmpty() ? NULL : &fBounds,
940 fPaintPtr, 935 fPaintPtr,
941 fFlags); 936 fFlags);
942 } 937 }
943 938
944 void SkSaveLayerCommand::vizExecute(SkCanvas* canvas) { 939 void SkSaveLayerCommand::vizExecute(SkCanvas* canvas) const {
945 canvas->save(); 940 canvas->save();
946 } 941 }
947 942
948 void SkSaveLayerCommand::trackSaveState(int* state) { 943 void SkSaveLayerCommand::trackSaveState(int* state) {
949 (*state)++; 944 (*state)++;
950 } 945 }
951 946
952 SkScaleCommand::SkScaleCommand(SkScalar sx, SkScalar sy) 947 SkScaleCommand::SkScaleCommand(SkScalar sx, SkScalar sy)
953 : INHERITED(SCALE) { 948 : INHERITED(SCALE) {
954 fSx = sx; 949 fSx = sx;
955 fSy = sy; 950 fSy = sy;
956 951
957 fInfo.push(SkObjectParser::ScalarToString(sx, "SkScalar sx: ")); 952 fInfo.push(SkObjectParser::ScalarToString(sx, "SkScalar sx: "));
958 fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: ")); 953 fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: "));
959 } 954 }
960 955
961 void SkScaleCommand::execute(SkCanvas* canvas) { 956 void SkScaleCommand::execute(SkCanvas* canvas) const {
962 canvas->scale(fSx, fSy); 957 canvas->scale(fSx, fSy);
963 } 958 }
964 959
965 SkSetMatrixCommand::SkSetMatrixCommand(const SkMatrix& matrix) 960 SkSetMatrixCommand::SkSetMatrixCommand(const SkMatrix& matrix)
966 : INHERITED(SET_MATRIX) { 961 : INHERITED(SET_MATRIX) {
967 fUserMatrix.reset(); 962 fUserMatrix.reset();
968 fMatrix = matrix; 963 fMatrix = matrix;
969 964
970 fInfo.push(SkObjectParser::MatrixToString(matrix)); 965 fInfo.push(SkObjectParser::MatrixToString(matrix));
971 } 966 }
972 967
973 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { 968 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) {
974 fUserMatrix = userMatrix; 969 fUserMatrix = userMatrix;
975 } 970 }
976 971
977 void SkSetMatrixCommand::execute(SkCanvas* canvas) { 972 void SkSetMatrixCommand::execute(SkCanvas* canvas) const {
978 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); 973 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix);
979 canvas->setMatrix(temp); 974 canvas->setMatrix(temp);
980 } 975 }
981 976
982 SkSkewCommand::SkSkewCommand(SkScalar sx, SkScalar sy) 977 SkSkewCommand::SkSkewCommand(SkScalar sx, SkScalar sy)
983 : INHERITED(SKEW) { 978 : INHERITED(SKEW) {
984 fSx = sx; 979 fSx = sx;
985 fSy = sy; 980 fSy = sy;
986 981
987 fInfo.push(SkObjectParser::ScalarToString(sx, "SkScalar sx: ")); 982 fInfo.push(SkObjectParser::ScalarToString(sx, "SkScalar sx: "));
988 fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: ")); 983 fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: "));
989 } 984 }
990 985
991 void SkSkewCommand::execute(SkCanvas* canvas) { 986 void SkSkewCommand::execute(SkCanvas* canvas) const {
992 canvas->skew(fSx, fSy); 987 canvas->skew(fSx, fSy);
993 } 988 }
994 989
995 SkTranslateCommand::SkTranslateCommand(SkScalar dx, SkScalar dy) 990 SkTranslateCommand::SkTranslateCommand(SkScalar dx, SkScalar dy)
996 : INHERITED(TRANSLATE) { 991 : INHERITED(TRANSLATE) {
997 fDx = dx; 992 fDx = dx;
998 fDy = dy; 993 fDy = dy;
999 994
1000 fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); 995 fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: "));
1001 fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); 996 fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: "));
1002 } 997 }
1003 998
1004 void SkTranslateCommand::execute(SkCanvas* canvas) { 999 void SkTranslateCommand::execute(SkCanvas* canvas) const {
1005 canvas->translate(fDx, fDy); 1000 canvas->translate(fDx, fDy);
1006 } 1001 }
1007 1002
1008 SkPushCullCommand::SkPushCullCommand(const SkRect& cullRect) 1003 SkPushCullCommand::SkPushCullCommand(const SkRect& cullRect)
1009 : INHERITED(PUSH_CULL) 1004 : INHERITED(PUSH_CULL)
1010 , fCullRect(cullRect) { 1005 , fCullRect(cullRect) {
1011 fInfo.push(SkObjectParser::RectToString(cullRect)); 1006 fInfo.push(SkObjectParser::RectToString(cullRect));
1012 } 1007 }
1013 1008
1014 void SkPushCullCommand::execute(SkCanvas* canvas) { 1009 void SkPushCullCommand::execute(SkCanvas* canvas) const {
1015 canvas->pushCull(fCullRect); 1010 canvas->pushCull(fCullRect);
1016 } 1011 }
1017 1012
1018 void SkPushCullCommand::vizExecute(SkCanvas* canvas) { 1013 void SkPushCullCommand::vizExecute(SkCanvas* canvas) const {
1019 canvas->pushCull(fCullRect); 1014 canvas->pushCull(fCullRect);
1020 1015
1021 SkPaint p; 1016 SkPaint p;
1022 p.setColor(SK_ColorCYAN); 1017 p.setColor(SK_ColorCYAN);
1023 p.setStyle(SkPaint::kStroke_Style); 1018 p.setStyle(SkPaint::kStroke_Style);
1024 canvas->drawRect(fCullRect, p); 1019 canvas->drawRect(fCullRect, p);
1025 } 1020 }
1026 1021
1027 SkPopCullCommand::SkPopCullCommand() : INHERITED(POP_CULL) { } 1022 SkPopCullCommand::SkPopCullCommand() : INHERITED(POP_CULL) { }
1028 1023
1029 void SkPopCullCommand::execute(SkCanvas* canvas) { 1024 void SkPopCullCommand::execute(SkCanvas* canvas) const {
1030 canvas->popCull(); 1025 canvas->popCull();
1031 } 1026 }
OLDNEW
« no previous file with comments | « src/utils/debugger/SkDrawCommand.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698