| OLD | NEW |
| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 if (prev != bitmap.getColor(0,0)) { | 83 if (prev != bitmap.getColor(0,0)) { |
| 84 layer = i; | 84 layer = i; |
| 85 } | 85 } |
| 86 prev = bitmap.getColor(0,0); | 86 prev = bitmap.getColor(0,0); |
| 87 } | 87 } |
| 88 return layer; | 88 return layer; |
| 89 } | 89 } |
| 90 | 90 |
| 91 class OverdrawXfermode : public SkXfermode { | 91 class OverdrawXfermode : public SkXfermode { |
| 92 public: | 92 public: |
| 93 SkPMColor xferColor(SkPMColor src, SkPMColor dst) const SK_OVERRIDE { | 93 SkPMColor xferColor(SkPMColor src, SkPMColor dst) const override { |
| 94 // This table encodes the color progression of the overdraw visualizatio
n | 94 // This table encodes the color progression of the overdraw visualizatio
n |
| 95 static const SkPMColor gTable[] = { | 95 static const SkPMColor gTable[] = { |
| 96 SkPackARGB32(0x00, 0x00, 0x00, 0x00), | 96 SkPackARGB32(0x00, 0x00, 0x00, 0x00), |
| 97 SkPackARGB32(0xFF, 128, 158, 255), | 97 SkPackARGB32(0xFF, 128, 158, 255), |
| 98 SkPackARGB32(0xFF, 170, 185, 212), | 98 SkPackARGB32(0xFF, 170, 185, 212), |
| 99 SkPackARGB32(0xFF, 213, 195, 170), | 99 SkPackARGB32(0xFF, 213, 195, 170), |
| 100 SkPackARGB32(0xFF, 255, 192, 127), | 100 SkPackARGB32(0xFF, 255, 192, 127), |
| 101 SkPackARGB32(0xFF, 255, 185, 85), | 101 SkPackARGB32(0xFF, 255, 185, 85), |
| 102 SkPackARGB32(0xFF, 255, 165, 42), | 102 SkPackARGB32(0xFF, 255, 165, 42), |
| 103 SkPackARGB32(0xFF, 255, 135, 0), | 103 SkPackARGB32(0xFF, 255, 135, 0), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 116 idx = 7 - (SkColorGetB(dst)+21)/42; | 116 idx = 7 - (SkColorGetB(dst)+21)/42; |
| 117 } else { // 7-9 | 117 } else { // 7-9 |
| 118 idx = 10 - (SkColorGetG(dst)+22)/45; | 118 idx = 10 - (SkColorGetG(dst)+22)/45; |
| 119 } | 119 } |
| 120 ++idx; | 120 ++idx; |
| 121 SkASSERT(idx < (int)SK_ARRAY_COUNT(gTable)); | 121 SkASSERT(idx < (int)SK_ARRAY_COUNT(gTable)); |
| 122 | 122 |
| 123 return gTable[idx]; | 123 return gTable[idx]; |
| 124 } | 124 } |
| 125 | 125 |
| 126 Factory getFactory() const SK_OVERRIDE { return NULL; } | 126 Factory getFactory() const override { return NULL; } |
| 127 #ifndef SK_IGNORE_TO_STRING | 127 #ifndef SK_IGNORE_TO_STRING |
| 128 virtual void toString(SkString* str) const SK_OVERRIDE { str->set("OverdrawX
fermode"); } | 128 virtual void toString(SkString* str) const override { str->set("OverdrawXfer
mode"); } |
| 129 #endif | 129 #endif |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 class SkOverdrawFilter : public SkDrawFilter { | 132 class SkOverdrawFilter : public SkDrawFilter { |
| 133 public: | 133 public: |
| 134 SkOverdrawFilter() { | 134 SkOverdrawFilter() { |
| 135 fXferMode = SkNEW(OverdrawXfermode); | 135 fXferMode = SkNEW(OverdrawXfermode); |
| 136 } | 136 } |
| 137 | 137 |
| 138 virtual ~SkOverdrawFilter() { | 138 virtual ~SkOverdrawFilter() { |
| 139 delete fXferMode; | 139 delete fXferMode; |
| 140 } | 140 } |
| 141 | 141 |
| 142 bool filter(SkPaint* p, Type) SK_OVERRIDE { | 142 bool filter(SkPaint* p, Type) override { |
| 143 p->setXfermode(fXferMode); | 143 p->setXfermode(fXferMode); |
| 144 p->setAntiAlias(false); | 144 p->setAntiAlias(false); |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 protected: | 148 protected: |
| 149 SkXfermode* fXferMode; | 149 SkXfermode* fXferMode; |
| 150 | 150 |
| 151 private: | 151 private: |
| 152 typedef SkDrawFilter INHERITED; | 152 typedef SkDrawFilter INHERITED; |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 // SkTexOverrideFilter modifies every paint to use the specified | 155 // SkTexOverrideFilter modifies every paint to use the specified |
| 156 // texture filtering mode | 156 // texture filtering mode |
| 157 class SkTexOverrideFilter : public SkDrawFilter { | 157 class SkTexOverrideFilter : public SkDrawFilter { |
| 158 public: | 158 public: |
| 159 SkTexOverrideFilter() : fFilterQuality(kNone_SkFilterQuality) { | 159 SkTexOverrideFilter() : fFilterQuality(kNone_SkFilterQuality) { |
| 160 } | 160 } |
| 161 | 161 |
| 162 void setFilterQuality(SkFilterQuality filterQuality) { | 162 void setFilterQuality(SkFilterQuality filterQuality) { |
| 163 fFilterQuality = filterQuality; | 163 fFilterQuality = filterQuality; |
| 164 } | 164 } |
| 165 | 165 |
| 166 bool filter(SkPaint* p, Type) SK_OVERRIDE { | 166 bool filter(SkPaint* p, Type) override { |
| 167 p->setFilterQuality(fFilterQuality); | 167 p->setFilterQuality(fFilterQuality); |
| 168 return true; | 168 return true; |
| 169 } | 169 } |
| 170 | 170 |
| 171 protected: | 171 protected: |
| 172 SkFilterQuality fFilterQuality; | 172 SkFilterQuality fFilterQuality; |
| 173 | 173 |
| 174 private: | 174 private: |
| 175 typedef SkDrawFilter INHERITED; | 175 typedef SkDrawFilter INHERITED; |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 class SkDebugClipVisitor : public SkCanvas::ClipVisitor { | 178 class SkDebugClipVisitor : public SkCanvas::ClipVisitor { |
| 179 public: | 179 public: |
| 180 SkDebugClipVisitor(SkCanvas* canvas) : fCanvas(canvas) {} | 180 SkDebugClipVisitor(SkCanvas* canvas) : fCanvas(canvas) {} |
| 181 | 181 |
| 182 void clipRect(const SkRect& r, SkRegion::Op, bool doAA) SK_OVERRIDE { | 182 void clipRect(const SkRect& r, SkRegion::Op, bool doAA) override { |
| 183 SkPaint p; | 183 SkPaint p; |
| 184 p.setColor(SK_ColorRED); | 184 p.setColor(SK_ColorRED); |
| 185 p.setStyle(SkPaint::kStroke_Style); | 185 p.setStyle(SkPaint::kStroke_Style); |
| 186 p.setAntiAlias(doAA); | 186 p.setAntiAlias(doAA); |
| 187 fCanvas->drawRect(r, p); | 187 fCanvas->drawRect(r, p); |
| 188 } | 188 } |
| 189 void clipRRect(const SkRRect& rr, SkRegion::Op, bool doAA) SK_OVERRIDE { | 189 void clipRRect(const SkRRect& rr, SkRegion::Op, bool doAA) override { |
| 190 SkPaint p; | 190 SkPaint p; |
| 191 p.setColor(SK_ColorGREEN); | 191 p.setColor(SK_ColorGREEN); |
| 192 p.setStyle(SkPaint::kStroke_Style); | 192 p.setStyle(SkPaint::kStroke_Style); |
| 193 p.setAntiAlias(doAA); | 193 p.setAntiAlias(doAA); |
| 194 fCanvas->drawRRect(rr, p); | 194 fCanvas->drawRRect(rr, p); |
| 195 } | 195 } |
| 196 void clipPath(const SkPath& path, SkRegion::Op, bool doAA) SK_OVERRIDE { | 196 void clipPath(const SkPath& path, SkRegion::Op, bool doAA) override { |
| 197 SkPaint p; | 197 SkPaint p; |
| 198 p.setColor(SK_ColorBLUE); | 198 p.setColor(SK_ColorBLUE); |
| 199 p.setStyle(SkPaint::kStroke_Style); | 199 p.setStyle(SkPaint::kStroke_Style); |
| 200 p.setAntiAlias(doAA); | 200 p.setAntiAlias(doAA); |
| 201 fCanvas->drawPath(path, p); | 201 fCanvas->drawPath(path, p); |
| 202 } | 202 } |
| 203 | 203 |
| 204 protected: | 204 protected: |
| 205 SkCanvas* fCanvas; | 205 SkCanvas* fCanvas; |
| 206 | 206 |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 } | 673 } |
| 674 | 674 |
| 675 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { | 675 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { |
| 676 if (fCalledAddStackData) { | 676 if (fCalledAddStackData) { |
| 677 fClipStackData.appendf("<br>"); | 677 fClipStackData.appendf("<br>"); |
| 678 addPathData(devPath, "pathOut"); | 678 addPathData(devPath, "pathOut"); |
| 679 return true; | 679 return true; |
| 680 } | 680 } |
| 681 return false; | 681 return false; |
| 682 } | 682 } |
| OLD | NEW |