OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkCanvasPriv.h" | 8 #include "SkCanvasPriv.h" |
9 #include "SkClipStack.h" | 9 #include "SkClipStack.h" |
10 #include "SkDebugCanvas.h" | 10 #include "SkDebugCanvas.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 return true; | 51 return true; |
52 } | 52 } |
53 | 53 |
54 void onDrawPicture(const SkPicture* picture, | 54 void onDrawPicture(const SkPicture* picture, |
55 const SkMatrix* matrix, | 55 const SkMatrix* matrix, |
56 const SkPaint* paint) override { | 56 const SkPaint* paint) override { |
57 // We need to replay the picture onto this canvas in order to filter its
internal paints. | 57 // We need to replay the picture onto this canvas in order to filter its
internal paints. |
58 this->SkCanvas::onDrawPicture(picture, matrix, paint); | 58 this->SkCanvas::onDrawPicture(picture, matrix, paint); |
59 } | 59 } |
60 | 60 |
61 void onDrawShadowedPicture(const SkPicture* picture, | |
62 const SkMatrix* matrix, | |
63 const SkPaint* paint) { | |
64 #ifdef SK_EXPERIMENTAL_SHADOWING | |
65 this->SkCanvas::onDrawShadowedPicture(picture, matrix, paint); | |
66 #else | |
67 this->SkCanvas::onDrawPicture(picture, matrix, paint); | |
68 #endif | |
69 } | |
70 | |
71 private: | 61 private: |
72 sk_sp<SkXfermode> fOverdrawXfermode; | 62 sk_sp<SkXfermode> fOverdrawXfermode; |
73 | 63 |
74 bool fOverrideFilterQuality; | 64 bool fOverrideFilterQuality; |
75 SkFilterQuality fFilterQuality; | 65 SkFilterQuality fFilterQuality; |
76 | 66 |
77 typedef SkPaintFilterCanvas INHERITED; | 67 typedef SkPaintFilterCanvas INHERITED; |
78 }; | 68 }; |
79 | 69 |
80 SkDebugCanvas::SkDebugCanvas(int width, int height) | 70 SkDebugCanvas::SkDebugCanvas(int width, int height) |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 | 596 |
607 void SkDebugCanvas::onDrawPicture(const SkPicture* picture, | 597 void SkDebugCanvas::onDrawPicture(const SkPicture* picture, |
608 const SkMatrix* matrix, | 598 const SkMatrix* matrix, |
609 const SkPaint* paint) { | 599 const SkPaint* paint) { |
610 this->addDrawCommand(new SkBeginDrawPictureCommand(picture, matrix, paint)); | 600 this->addDrawCommand(new SkBeginDrawPictureCommand(picture, matrix, paint)); |
611 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); | 601 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); |
612 picture->playback(this); | 602 picture->playback(this); |
613 this->addDrawCommand(new SkEndDrawPictureCommand(SkToBool(matrix) || SkToBoo
l(paint))); | 603 this->addDrawCommand(new SkEndDrawPictureCommand(SkToBool(matrix) || SkToBoo
l(paint))); |
614 } | 604 } |
615 | 605 |
616 void SkDebugCanvas::onDrawShadowedPicture(const SkPicture* picture, | |
617 const SkMatrix* matrix, | |
618 const SkPaint* paint) { | |
619 this->addDrawCommand(new SkBeginDrawShadowedPictureCommand(picture, matrix,
paint)); | |
620 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); | |
621 picture->playback(this); | |
622 this->addDrawCommand(new SkEndDrawShadowedPictureCommand(SkToBool(matrix) ||
SkToBool(paint))); | |
623 } | |
624 | |
625 void SkDebugCanvas::onDrawPoints(PointMode mode, size_t count, | 606 void SkDebugCanvas::onDrawPoints(PointMode mode, size_t count, |
626 const SkPoint pts[], const SkPaint& paint) { | 607 const SkPoint pts[], const SkPaint& paint) { |
627 this->addDrawCommand(new SkDrawPointsCommand(mode, count, pts, paint)); | 608 this->addDrawCommand(new SkDrawPointsCommand(mode, count, pts, paint)); |
628 } | 609 } |
629 | 610 |
630 void SkDebugCanvas::onDrawPosText(const void* text, size_t byteLength, const SkP
oint pos[], | 611 void SkDebugCanvas::onDrawPosText(const void* text, size_t byteLength, const SkP
oint pos[], |
631 const SkPaint& paint) { | 612 const SkPaint& paint) { |
632 this->addDrawCommand(new SkDrawPosTextCommand(text, byteLength, pos, paint))
; | 613 this->addDrawCommand(new SkDrawPosTextCommand(text, byteLength, pos, paint))
; |
633 } | 614 } |
634 | 615 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 // No need for a full layer. | 684 // No need for a full layer. |
704 return kNoLayer_SaveLayerStrategy; | 685 return kNoLayer_SaveLayerStrategy; |
705 } | 686 } |
706 | 687 |
707 void SkDebugCanvas::didSetMatrix(const SkMatrix& matrix) { | 688 void SkDebugCanvas::didSetMatrix(const SkMatrix& matrix) { |
708 this->addDrawCommand(new SkSetMatrixCommand(matrix)); | 689 this->addDrawCommand(new SkSetMatrixCommand(matrix)); |
709 this->INHERITED::didSetMatrix(matrix); | 690 this->INHERITED::didSetMatrix(matrix); |
710 } | 691 } |
711 | 692 |
712 void SkDebugCanvas::didTranslateZ(SkScalar z) { | 693 void SkDebugCanvas::didTranslateZ(SkScalar z) { |
713 #ifdef SK_EXPERIMENTAL_SHADOWING | |
714 this->addDrawCommand(new SkTranslateZCommand(z)); | 694 this->addDrawCommand(new SkTranslateZCommand(z)); |
715 this->INHERITED::didTranslateZ(z); | 695 this->INHERITED::didTranslateZ(z); |
716 #endif | |
717 } | 696 } |
718 | 697 |
719 void SkDebugCanvas::toggleCommand(int index, bool toggle) { | 698 void SkDebugCanvas::toggleCommand(int index, bool toggle) { |
720 SkASSERT(index < fCommandVector.count()); | 699 SkASSERT(index < fCommandVector.count()); |
721 fCommandVector[index]->setVisible(toggle); | 700 fCommandVector[index]->setVisible(toggle); |
722 } | 701 } |
723 | 702 |
724 static const char* gFillTypeStrs[] = { | 703 static const char* gFillTypeStrs[] = { |
725 "kWinding_FillType", | 704 "kWinding_FillType", |
726 "kEvenOdd_FillType", | 705 "kEvenOdd_FillType", |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 } | 817 } |
839 | 818 |
840 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { | 819 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { |
841 if (fCalledAddStackData) { | 820 if (fCalledAddStackData) { |
842 fClipStackData.appendf("<br>"); | 821 fClipStackData.appendf("<br>"); |
843 addPathData(devPath, "pathOut"); | 822 addPathData(devPath, "pathOut"); |
844 return true; | 823 return true; |
845 } | 824 } |
846 return false; | 825 return false; |
847 } | 826 } |
OLD | NEW |