| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 unsigned b = SkGetPackedB32(c); | 46 unsigned b = SkGetPackedB32(c); |
| 47 | 47 |
| 48 unsigned x = (r * 5 + g * 7 + b * 4) >> 4; | 48 unsigned x = (r * 5 + g * 7 + b * 4) >> 4; |
| 49 | 49 |
| 50 return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT)); | 50 return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 class SkGrayScaleColorFilter : public SkColorFilter { | 53 class SkGrayScaleColorFilter : public SkColorFilter { |
| 54 public: | 54 public: |
| 55 virtual void filterSpan(const SkPMColor src[], int count, | 55 virtual void filterSpan(const SkPMColor src[], int count, |
| 56 SkPMColor result[]) const SK_OVERRIDE { | 56 SkPMColor result[]) const override { |
| 57 for (int i = 0; i < count; i++) | 57 for (int i = 0; i < count; i++) |
| 58 result[i] = rgb2gray(src[i]); | 58 result[i] = rgb2gray(src[i]); |
| 59 } | 59 } |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 class SkChannelMaskColorFilter : public SkColorFilter { | 62 class SkChannelMaskColorFilter : public SkColorFilter { |
| 63 public: | 63 public: |
| 64 SkChannelMaskColorFilter(U8CPU redMask, U8CPU greenMask, U8CPU blueMask) { | 64 SkChannelMaskColorFilter(U8CPU redMask, U8CPU greenMask, U8CPU blueMask) { |
| 65 fMask = SkPackARGB32(0xFF, redMask, greenMask, blueMask); | 65 fMask = SkPackARGB32(0xFF, redMask, greenMask, blueMask); |
| 66 } | 66 } |
| 67 | 67 |
| 68 virtual void filterSpan(const SkPMColor src[], int count, | 68 virtual void filterSpan(const SkPMColor src[], int count, |
| 69 SkPMColor result[]) const SK_OVERRIDE { | 69 SkPMColor result[]) const override { |
| 70 SkPMColor mask = fMask; | 70 SkPMColor mask = fMask; |
| 71 for (int i = 0; i < count; i++) { | 71 for (int i = 0; i < count; i++) { |
| 72 result[i] = src[i] & mask; | 72 result[i] = src[i] & mask; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 SkPMColor fMask; | 77 SkPMColor fMask; |
| 78 }; | 78 }; |
| 79 | 79 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 class Dot2DPathEffect : public Sk2DPathEffect { | 162 class Dot2DPathEffect : public Sk2DPathEffect { |
| 163 public: | 163 public: |
| 164 Dot2DPathEffect(SkScalar radius, const SkMatrix& matrix) | 164 Dot2DPathEffect(SkScalar radius, const SkMatrix& matrix) |
| 165 : Sk2DPathEffect(matrix), fRadius(radius) {} | 165 : Sk2DPathEffect(matrix), fRadius(radius) {} |
| 166 | 166 |
| 167 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect) | 167 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect) |
| 168 | 168 |
| 169 protected: | 169 protected: |
| 170 void next(const SkPoint& loc, int u, int v, SkPath* dst) const SK_OVERRIDE { | 170 void next(const SkPoint& loc, int u, int v, SkPath* dst) const override { |
| 171 dst->addCircle(loc.fX, loc.fY, fRadius); | 171 dst->addCircle(loc.fX, loc.fY, fRadius); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { | 174 void flatten(SkWriteBuffer& buffer) const override { |
| 175 this->INHERITED::flatten(buffer); | 175 this->INHERITED::flatten(buffer); |
| 176 buffer.writeScalar(fRadius); | 176 buffer.writeScalar(fRadius); |
| 177 } | 177 } |
| 178 | 178 |
| 179 private: | 179 private: |
| 180 SkScalar fRadius; | 180 SkScalar fRadius; |
| 181 | 181 |
| 182 typedef Sk2DPathEffect INHERITED; | 182 typedef Sk2DPathEffect INHERITED; |
| 183 }; | 183 }; |
| 184 | 184 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 private: | 577 private: |
| 578 SkPoint fClickPt; | 578 SkPoint fClickPt; |
| 579 SkBitmap fBug, fTb, fTx; | 579 SkBitmap fBug, fTb, fTx; |
| 580 typedef SampleView INHERITED; | 580 typedef SampleView INHERITED; |
| 581 }; | 581 }; |
| 582 | 582 |
| 583 ////////////////////////////////////////////////////////////////////////////// | 583 ////////////////////////////////////////////////////////////////////////////// |
| 584 | 584 |
| 585 static SkView* MyFactory() { return new DemoView; } | 585 static SkView* MyFactory() { return new DemoView; } |
| 586 static SkViewRegister reg(MyFactory); | 586 static SkViewRegister reg(MyFactory); |
| OLD | NEW |