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_USE_SHADOWS | |
65 override | |
jvanverth1
2016/07/21 13:56:53
You don't need override in the definition.
vjiaoblack
2016/07/21 15:11:20
Done.
| |
66 #endif | |
67 { | |
68 #ifdef SK_USE_SHADOWS | |
69 this->SkCanvas::onDrawShadowedPicture(picture, matrix, paint); | |
70 #else | |
71 this->SkCanvas::onDrawPicture(picture, matrix, paint); | |
72 #endif | |
73 } | |
74 | |
61 private: | 75 private: |
62 sk_sp<SkXfermode> fOverdrawXfermode; | 76 sk_sp<SkXfermode> fOverdrawXfermode; |
63 | 77 |
64 bool fOverrideFilterQuality; | 78 bool fOverrideFilterQuality; |
65 SkFilterQuality fFilterQuality; | 79 SkFilterQuality fFilterQuality; |
66 | 80 |
67 typedef SkPaintFilterCanvas INHERITED; | 81 typedef SkPaintFilterCanvas INHERITED; |
68 }; | 82 }; |
69 | 83 |
70 SkDebugCanvas::SkDebugCanvas(int width, int height) | 84 SkDebugCanvas::SkDebugCanvas(int width, int height) |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 | 610 |
597 void SkDebugCanvas::onDrawPicture(const SkPicture* picture, | 611 void SkDebugCanvas::onDrawPicture(const SkPicture* picture, |
598 const SkMatrix* matrix, | 612 const SkMatrix* matrix, |
599 const SkPaint* paint) { | 613 const SkPaint* paint) { |
600 this->addDrawCommand(new SkBeginDrawPictureCommand(picture, matrix, paint)); | 614 this->addDrawCommand(new SkBeginDrawPictureCommand(picture, matrix, paint)); |
601 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); | 615 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); |
602 picture->playback(this); | 616 picture->playback(this); |
603 this->addDrawCommand(new SkEndDrawPictureCommand(SkToBool(matrix) || SkToBoo l(paint))); | 617 this->addDrawCommand(new SkEndDrawPictureCommand(SkToBool(matrix) || SkToBoo l(paint))); |
604 } | 618 } |
605 | 619 |
620 void SkDebugCanvas::onDrawShadowedPicture(const SkPicture* picture, | |
621 const SkMatrix* matrix, | |
622 const SkPaint* paint) { | |
623 this->addDrawCommand(new SkBeginDrawShadowedPictureCommand(picture, matrix, paint)); | |
624 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); | |
625 picture->playback(this); | |
626 this->addDrawCommand(new SkEndDrawShadowedPictureCommand(SkToBool(matrix) || SkToBool(paint))); | |
627 } | |
628 | |
606 void SkDebugCanvas::onDrawPoints(PointMode mode, size_t count, | 629 void SkDebugCanvas::onDrawPoints(PointMode mode, size_t count, |
607 const SkPoint pts[], const SkPaint& paint) { | 630 const SkPoint pts[], const SkPaint& paint) { |
608 this->addDrawCommand(new SkDrawPointsCommand(mode, count, pts, paint)); | 631 this->addDrawCommand(new SkDrawPointsCommand(mode, count, pts, paint)); |
609 } | 632 } |
610 | 633 |
611 void SkDebugCanvas::onDrawPosText(const void* text, size_t byteLength, const SkP oint pos[], | 634 void SkDebugCanvas::onDrawPosText(const void* text, size_t byteLength, const SkP oint pos[], |
612 const SkPaint& paint) { | 635 const SkPaint& paint) { |
613 this->addDrawCommand(new SkDrawPosTextCommand(text, byteLength, pos, paint)) ; | 636 this->addDrawCommand(new SkDrawPosTextCommand(text, byteLength, pos, paint)) ; |
614 } | 637 } |
615 | 638 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 // No need for a full layer. | 707 // No need for a full layer. |
685 return kNoLayer_SaveLayerStrategy; | 708 return kNoLayer_SaveLayerStrategy; |
686 } | 709 } |
687 | 710 |
688 void SkDebugCanvas::didSetMatrix(const SkMatrix& matrix) { | 711 void SkDebugCanvas::didSetMatrix(const SkMatrix& matrix) { |
689 this->addDrawCommand(new SkSetMatrixCommand(matrix)); | 712 this->addDrawCommand(new SkSetMatrixCommand(matrix)); |
690 this->INHERITED::didSetMatrix(matrix); | 713 this->INHERITED::didSetMatrix(matrix); |
691 } | 714 } |
692 | 715 |
693 void SkDebugCanvas::didTranslateZ(SkScalar z) { | 716 void SkDebugCanvas::didTranslateZ(SkScalar z) { |
717 #ifdef SK_USE_SHADOWS | |
694 this->addDrawCommand(new SkTranslateZCommand(z)); | 718 this->addDrawCommand(new SkTranslateZCommand(z)); |
695 this->INHERITED::didTranslateZ(z); | 719 this->INHERITED::didTranslateZ(z); |
720 #endif | |
696 } | 721 } |
697 | 722 |
698 void SkDebugCanvas::toggleCommand(int index, bool toggle) { | 723 void SkDebugCanvas::toggleCommand(int index, bool toggle) { |
699 SkASSERT(index < fCommandVector.count()); | 724 SkASSERT(index < fCommandVector.count()); |
700 fCommandVector[index]->setVisible(toggle); | 725 fCommandVector[index]->setVisible(toggle); |
701 } | 726 } |
702 | 727 |
703 static const char* gFillTypeStrs[] = { | 728 static const char* gFillTypeStrs[] = { |
704 "kWinding_FillType", | 729 "kWinding_FillType", |
705 "kEvenOdd_FillType", | 730 "kEvenOdd_FillType", |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 } | 842 } |
818 | 843 |
819 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { | 844 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { |
820 if (fCalledAddStackData) { | 845 if (fCalledAddStackData) { |
821 fClipStackData.appendf("<br>"); | 846 fClipStackData.appendf("<br>"); |
822 addPathData(devPath, "pathOut"); | 847 addPathData(devPath, "pathOut"); |
823 return true; | 848 return true; |
824 } | 849 } |
825 return false; | 850 return false; |
826 } | 851 } |
OLD | NEW |