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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 /** | 68 /** |
69 * Scale glyphs to get different point sizes | 69 * Scale glyphs to get different point sizes |
70 */ | 70 */ |
71 kUseScaledGlyphs_Flag = 0x2, | 71 kUseScaledGlyphs_Flag = 0x2, |
72 }; | 72 }; |
73 | 73 |
74 static const int kBaseDFFontSize = 32; | 74 static const int kBaseDFFontSize = 32; |
75 #endif | 75 #endif |
76 }; | 76 }; |
77 | 77 |
| 78 bool SkDrawTreatAAStrokeAsHairline(SkScalar strokeWidth, const SkMatrix&, |
| 79 SkScalar* coverage); |
| 80 |
78 /** | 81 /** |
79 * If the current paint is set to stroke and the stroke-width when applied to | 82 * If the current paint is set to stroke and the stroke-width when applied to |
80 * the matrix is <= 1.0, then this returns true, and sets coverage (simulating | 83 * the matrix is <= 1.0, then this returns true, and sets coverage (simulating |
81 * a stroke by drawing a hairline with partial coverage). If any of these | 84 * a stroke by drawing a hairline with partial coverage). If any of these |
82 * conditions are false, then this returns false and coverage is ignored. | 85 * conditions are false, then this returns false and coverage is ignored. |
83 */ | 86 */ |
84 bool SkDrawTreatAsHairline(const SkPaint&, const SkMatrix&, SkScalar* coverage); | 87 inline bool SkDrawTreatAsHairline(const SkPaint& paint, const SkMatrix& matrix, |
| 88 SkScalar* coverage) { |
| 89 if (SkPaint::kStroke_Style != paint.getStyle()) { |
| 90 return false; |
| 91 } |
| 92 |
| 93 SkScalar strokeWidth = paint.getStrokeWidth(); |
| 94 if (0 == strokeWidth) { |
| 95 *coverage = SK_Scalar1; |
| 96 return true; |
| 97 } |
| 98 |
| 99 if (!paint.isAntiAlias()) { |
| 100 return false; |
| 101 } |
| 102 |
| 103 return SkDrawTreatAAStrokeAsHairline(strokeWidth, matrix, coverage); |
| 104 } |
85 | 105 |
86 #endif | 106 #endif |
OLD | NEW |