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 "SkClipStack.h" | 8 #include "SkClipStack.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkDebugCanvas.h" | 10 #include "SkDebugCanvas.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 int height, | 62 int height, |
63 bool overdrawViz, | 63 bool overdrawViz, |
64 bool overrideFilterQuality, | 64 bool overrideFilterQuality, |
65 SkFilterQuality quality) | 65 SkFilterQuality quality) |
66 : INHERITED(width, height) | 66 : INHERITED(width, height) |
67 , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : nullptr) | 67 , fOverdrawXfermode(overdrawViz ? new OverdrawXfermode : nullptr) |
68 , fOverrideFilterQuality(overrideFilterQuality) | 68 , fOverrideFilterQuality(overrideFilterQuality) |
69 , fFilterQuality(quality) {} | 69 , fFilterQuality(quality) {} |
70 | 70 |
71 protected: | 71 protected: |
72 bool onFilter(const SkPaint* paint, Type, SkTLazy<SkPaint>* filteredPaint) c
onst override { | 72 bool onFilter(SkTCopyOnFirstWrite<SkPaint>* paint, Type) const override { |
73 if (paint) { | 73 if (*paint) { |
74 filteredPaint->set(*paint); | |
75 if (nullptr != fOverdrawXfermode.get()) { | 74 if (nullptr != fOverdrawXfermode.get()) { |
76 filteredPaint->get()->setAntiAlias(false); | 75 paint->writable()->setAntiAlias(false); |
77 filteredPaint->get()->setXfermode(fOverdrawXfermode.get()); | 76 paint->writable()->setXfermode(fOverdrawXfermode.get()); |
78 } | 77 } |
79 | 78 |
80 if (fOverrideFilterQuality) { | 79 if (fOverrideFilterQuality) { |
81 filteredPaint->get()->setFilterQuality(fFilterQuality); | 80 paint->writable()->setFilterQuality(fFilterQuality); |
82 } | 81 } |
83 } | 82 } |
84 return true; | 83 return true; |
85 } | 84 } |
86 | 85 |
87 void onDrawPicture(const SkPicture* picture, | 86 void onDrawPicture(const SkPicture* picture, |
88 const SkMatrix* matrix, | 87 const SkMatrix* matrix, |
89 const SkPaint* paint) override { | 88 const SkPaint* paint) override { |
90 // We need to replay the picture onto this canvas in order to filter its
internal paints. | 89 // We need to replay the picture onto this canvas in order to filter its
internal paints. |
91 this->SkCanvas::onDrawPicture(picture, matrix, paint); | 90 this->SkCanvas::onDrawPicture(picture, matrix, paint); |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 } | 661 } |
663 | 662 |
664 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { | 663 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { |
665 if (fCalledAddStackData) { | 664 if (fCalledAddStackData) { |
666 fClipStackData.appendf("<br>"); | 665 fClipStackData.appendf("<br>"); |
667 addPathData(devPath, "pathOut"); | 666 addPathData(devPath, "pathOut"); |
668 return true; | 667 return true; |
669 } | 668 } |
670 return false; | 669 return false; |
671 } | 670 } |
OLD | NEW |