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 #ifndef SkDrawProcs_DEFINED | 8 #ifndef SkDrawProcs_DEFINED |
9 #define SkDrawProcs_DEFINED | 9 #define SkDrawProcs_DEFINED |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 // mask must be kARGB32_Format | 54 // mask must be kARGB32_Format |
55 void blitMaskAsSprite(const SkMask& mask) const; | 55 void blitMaskAsSprite(const SkMask& mask) const; |
56 }; | 56 }; |
57 | 57 |
58 struct SkDrawProcs { | 58 struct SkDrawProcs { |
59 SkDraw1Glyph::Proc fD1GProc; | 59 SkDraw1Glyph::Proc fD1GProc; |
60 }; | 60 }; |
61 | 61 |
62 bool SkDrawTreatAAStrokeAsHairline(SkScalar strokeWidth, const SkMatrix&, | |
63 SkScalar* coverage); | |
64 | |
65 /** | 62 /** |
66 * If the current paint is set to stroke and the stroke-width when applied to | 63 * If the current paint is set to stroke and the stroke-width when applied to |
67 * the matrix is <= 1.0, then this returns true, and sets coverage (simulating | 64 * the matrix is <= 1.0, then this returns true, and sets coverage (simulating |
68 * a stroke by drawing a hairline with partial coverage). If any of these | 65 * a stroke by drawing a hairline with partial coverage). If any of these |
69 * conditions are false, then this returns false and coverage is ignored. | 66 * conditions are false, then this returns false and coverage is ignored. |
70 */ | 67 */ |
71 inline bool SkDrawTreatAsHairline(const SkPaint& paint, const SkMatrix& matrix, | 68 bool SkDrawTreatAsHairline(const SkPaint&, const SkMatrix&, SkScalar* coverage); |
72 SkScalar* coverage) { | |
73 if (SkPaint::kStroke_Style != paint.getStyle()) { | |
74 return false; | |
75 } | |
76 | |
77 SkScalar strokeWidth = paint.getStrokeWidth(); | |
78 if (0 == strokeWidth) { | |
79 *coverage = SK_Scalar1; | |
80 return true; | |
81 } | |
82 | |
83 if (!paint.isAntiAlias()) { | |
84 return false; | |
85 } | |
86 | |
87 return SkDrawTreatAAStrokeAsHairline(strokeWidth, matrix, coverage); | |
88 } | |
89 | 69 |
90 #endif | 70 #endif |
OLD | NEW |