Fix brush fill with stroke

This commit is contained in:
Horcrux
2017-01-13 16:47:25 +08:00
parent 3069f9408a
commit b19a7d144f
+11 -4
View File
@@ -213,15 +213,22 @@
CGContextSetLineDash(context, self.strokeDashoffset, dash.array, dash.count); CGContextSetLineDash(context, self.strokeDashoffset, dash.array, dash.count);
} }
BOOL strokeColor = [self.stroke applyStrokeColor:context opacity:self.strokeOpacity]; if (!fillColor) {
if (!fillColor || !strokeColor) {
CGContextAddPath(context, path); CGContextAddPath(context, path);
CGContextReplacePathWithStrokedPath(context); CGContextReplacePathWithStrokedPath(context);
CGContextClip(context); CGContextClip(context);
} }
if (!strokeColor) { if (![self.stroke applyStrokeColor:context opacity:self.strokeOpacity]) {
// draw fill
CGContextAddPath(context, path);
CGContextDrawPath(context, mode);
// draw stroke
CGContextAddPath(context, path);
CGContextReplacePathWithStrokedPath(context);
CGContextClip(context);
[self.stroke paint:context [self.stroke paint:context
opacity:self.strokeOpacity opacity:self.strokeOpacity
brushConverter:[[self getSvgView] getDefinedBrushConverter:self.stroke.brushRef] brushConverter:[[self getSvgView] getDefinedBrushConverter:self.stroke.brushRef]