fix memory leak issue with CGMutablePathRef

This commit is contained in:
Horcrux
2016-07-21 18:22:23 +08:00
parent ff2395bcc2
commit 5ee5c2239a
35 changed files with 164 additions and 185 deletions
+11 -3
View File
@@ -1,5 +1,6 @@
import extractBrush from './extractBrush';
import extractOpacity from './extractOpacity';
import _ from 'lodash';
let separator = /\s*,\s*/;
const caps = {
@@ -15,12 +16,19 @@ const joins = {
};
export default function(props) {
let strokeWidth = +props.strokeWidth;
let {stroke} = props;
if (!strokeWidth && !stroke) {
if (!stroke) {
return null;
}
let strokeWidth = +props.strokeWidth;
if (_.isNil(props.strokeWidth)) {
strokeWidth = 1;
} else if (!strokeWidth) {
return;
}
let strokeDasharray = props.strokeDasharray;
if (typeof strokeDasharray === 'string') {
@@ -42,7 +50,7 @@ export default function(props) {
strokeLinecap: caps[props.strokeLinecap] || 0,
strokeLinejoin: joins[props.strokeLinejoin] || 0,
strokeDasharray: strokeDasharray || null,
strokeWidth: strokeWidth || 1,
strokeWidth: strokeWidth,
strokeDashoffset: strokeDasharray ? (+props.strokeDashoffset || 0) : null,
strokeMiterlimit: props.strokeMiterlimit || 4
};