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

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

Issue 203203004: Consolidate SkCanvas matrix virtuals. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Funnel everything through concat() Created 6 years, 9 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
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 "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 403
404 void SkDebugCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeS tyle edgeStyle) { 404 void SkDebugCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeS tyle edgeStyle) {
405 this->addDrawCommand(new SkClipRRectCommand(rrect, op, kSoft_ClipEdgeStyle = = edgeStyle)); 405 this->addDrawCommand(new SkClipRRectCommand(rrect, op, kSoft_ClipEdgeStyle = = edgeStyle));
406 } 406 }
407 407
408 void SkDebugCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) { 408 void SkDebugCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) {
409 this->addDrawCommand(new SkClipRegionCommand(region, op)); 409 this->addDrawCommand(new SkClipRegionCommand(region, op));
410 } 410 }
411 411
412 void SkDebugCanvas::didConcat(const SkMatrix& matrix) { 412 void SkDebugCanvas::didConcat(const SkMatrix& matrix) {
413 addDrawCommand(new SkConcatCommand(matrix)); 413 switch (matrix.getType()) {
robertphillips 2014/03/25 15:44:36 indent
f(malita) 2014/03/25 15:58:08 Done.
414 case SkMatrix::kTranslate_Mask:
415 this->addDrawCommand(new SkTranslateCommand(matrix.getTranslateX(),
416 matrix.getTranslateY()));
417 break;
418 case SkMatrix::kScale_Mask:
419 this->addDrawCommand(new SkScaleCommand(matrix.getScaleX(),
420 matrix.getScaleY()));
421 break;
422 default:
robertphillips 2014/03/25 15:44:36 this->
f(malita) 2014/03/25 15:58:08 Done.
423 addDrawCommand(new SkConcatCommand(matrix));
424 break;
425 }
426
414 this->INHERITED::didConcat(matrix); 427 this->INHERITED::didConcat(matrix);
415 } 428 }
416 429
417 void SkDebugCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left, 430 void SkDebugCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left,
418 SkScalar top, const SkPaint* paint = NULL) { 431 SkScalar top, const SkPaint* paint = NULL) {
419 addDrawCommand(new SkDrawBitmapCommand(bitmap, left, top, paint)); 432 addDrawCommand(new SkDrawBitmapCommand(bitmap, left, top, paint));
420 } 433 }
421 434
422 void SkDebugCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, 435 void SkDebugCanvas::drawBitmapRectToRect(const SkBitmap& bitmap,
423 const SkRect* src, const SkRect& dst, 436 const SkRect* src, const SkRect& dst,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 541
529 void SkDebugCanvas::onPopCull() { 542 void SkDebugCanvas::onPopCull() {
530 this->addDrawCommand(new SkPopCullCommand()); 543 this->addDrawCommand(new SkPopCullCommand());
531 } 544 }
532 545
533 void SkDebugCanvas::willRestore() { 546 void SkDebugCanvas::willRestore() {
534 this->addDrawCommand(new SkRestoreCommand()); 547 this->addDrawCommand(new SkRestoreCommand());
535 this->INHERITED::willRestore(); 548 this->INHERITED::willRestore();
536 } 549 }
537 550
538 void SkDebugCanvas::didRotate(SkScalar degrees) {
539 addDrawCommand(new SkRotateCommand(degrees));
540 this->INHERITED::didRotate(degrees);
541 }
542
543 void SkDebugCanvas::willSave(SaveFlags flags) { 551 void SkDebugCanvas::willSave(SaveFlags flags) {
544 this->addDrawCommand(new SkSaveCommand(flags)); 552 this->addDrawCommand(new SkSaveCommand(flags));
545 this->INHERITED::willSave(flags); 553 this->INHERITED::willSave(flags);
546 } 554 }
547 555
548 SkCanvas::SaveLayerStrategy SkDebugCanvas::willSaveLayer(const SkRect* bounds, c onst SkPaint* paint, 556 SkCanvas::SaveLayerStrategy SkDebugCanvas::willSaveLayer(const SkRect* bounds, c onst SkPaint* paint,
549 SaveFlags flags) { 557 SaveFlags flags) {
550 this->addDrawCommand(new SkSaveLayerCommand(bounds, paint, flags)); 558 this->addDrawCommand(new SkSaveLayerCommand(bounds, paint, flags));
551 this->INHERITED::willSaveLayer(bounds, paint, flags); 559 this->INHERITED::willSaveLayer(bounds, paint, flags);
552 // No need for a full layer. 560 // No need for a full layer.
553 return kNoLayer_SaveLayerStrategy; 561 return kNoLayer_SaveLayerStrategy;
554 } 562 }
555 563
556 void SkDebugCanvas::didScale(SkScalar sx, SkScalar sy) {
557 addDrawCommand(new SkScaleCommand(sx, sy));
558 this->INHERITED::didScale(sx, sy);
559 }
560
561 void SkDebugCanvas::didSetMatrix(const SkMatrix& matrix) { 564 void SkDebugCanvas::didSetMatrix(const SkMatrix& matrix) {
562 addDrawCommand(new SkSetMatrixCommand(matrix)); 565 addDrawCommand(new SkSetMatrixCommand(matrix));
563 this->INHERITED::didSetMatrix(matrix); 566 this->INHERITED::didSetMatrix(matrix);
564 } 567 }
565 568
566 void SkDebugCanvas::didSkew(SkScalar sx, SkScalar sy) {
567 addDrawCommand(new SkSkewCommand(sx, sy));
568 this->INHERITED::didSkew(sx, sy);
569 }
570
571 void SkDebugCanvas::didTranslate(SkScalar dx, SkScalar dy) {
572 addDrawCommand(new SkTranslateCommand(dx, dy));
573 this->INHERITED::didTranslate(dx, dy);
574 }
575
576 void SkDebugCanvas::toggleCommand(int index, bool toggle) { 569 void SkDebugCanvas::toggleCommand(int index, bool toggle) {
577 SkASSERT(index < fCommandVector.count()); 570 SkASSERT(index < fCommandVector.count());
578 fCommandVector[index]->setVisible(toggle); 571 fCommandVector[index]->setVisible(toggle);
579 } 572 }
OLDNEW
« src/utils/SkLuaCanvas.cpp ('K') | « src/utils/debugger/SkDebugCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698