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 "SkStrokeRec.h" | 8 #include "SkStrokeRec.h" |
9 #include "SkPaintDefaults.h" | 9 #include "SkPaintDefaults.h" |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 void SkStrokeRec::setStrokeStyle(SkScalar width, bool strokeAndFill) { | 91 void SkStrokeRec::setStrokeStyle(SkScalar width, bool strokeAndFill) { |
92 if (strokeAndFill && (0 == width)) { | 92 if (strokeAndFill && (0 == width)) { |
93 // hairline+fill == fill | 93 // hairline+fill == fill |
94 this->setFillStyle(); | 94 this->setFillStyle(); |
95 } else { | 95 } else { |
96 fWidth = width; | 96 fWidth = width; |
97 fStrokeAndFill = strokeAndFill; | 97 fStrokeAndFill = strokeAndFill; |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
| 101 void SkStrokeRec::setResScale(SkScalar rs) { |
| 102 SkASSERT(rs > 0 && SkScalarIsFinite(rs)); |
| 103 fResScale = rs; |
| 104 } |
| 105 |
101 #include "SkStroke.h" | 106 #include "SkStroke.h" |
102 | 107 |
103 #if !defined SK_LEGACY_STROKE_CURVES && defined SK_DEBUG | 108 #if !defined SK_LEGACY_STROKE_CURVES && defined SK_DEBUG |
104 // enables tweaking these values at runtime from SampleApp | 109 // enables tweaking these values at runtime from SampleApp |
105 bool gDebugStrokerErrorSet = false; | 110 bool gDebugStrokerErrorSet = false; |
106 SkScalar gDebugStrokerError; | 111 SkScalar gDebugStrokerError; |
107 #endif | 112 #endif |
108 | 113 |
109 bool SkStrokeRec::applyToPath(SkPath* dst, const SkPath& src) const { | 114 bool SkStrokeRec::applyToPath(SkPath* dst, const SkPath& src) const { |
110 if (fWidth <= 0) { // hairline or fill | 115 if (fWidth <= 0) { // hairline or fill |
(...skipping 20 matching lines...) Expand all Loading... |
131 paint->setStyle(SkPaint::kFill_Style); | 136 paint->setStyle(SkPaint::kFill_Style); |
132 return; | 137 return; |
133 } | 138 } |
134 | 139 |
135 paint->setStyle(fStrokeAndFill ? SkPaint::kStrokeAndFill_Style : SkPaint::kS
troke_Style); | 140 paint->setStyle(fStrokeAndFill ? SkPaint::kStrokeAndFill_Style : SkPaint::kS
troke_Style); |
136 paint->setStrokeWidth(fWidth); | 141 paint->setStrokeWidth(fWidth); |
137 paint->setStrokeMiter(fMiterLimit); | 142 paint->setStrokeMiter(fMiterLimit); |
138 paint->setStrokeCap(fCap); | 143 paint->setStrokeCap(fCap); |
139 paint->setStrokeJoin(fJoin); | 144 paint->setStrokeJoin(fJoin); |
140 } | 145 } |
OLD | NEW |