Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Strokes (fix inside) #19

Open
aherbig opened this issue Dec 3, 2015 · 0 comments
Open

Inconsistent Strokes (fix inside) #19

aherbig opened this issue Dec 3, 2015 · 0 comments

Comments

@aherbig
Copy link

aherbig commented Dec 3, 2015

Hey,

I ran into an issue where the strokes of some pathes varied from frame to frame. Suddenly the pathes got twice as wide. After checking out your code i narrowed the culprit down to the different implementation of "sTracePathStrokeSimple" and "sTracePathStrokeAdvanced" in your "sStrokePath" function.

Before the sTracePathStrokeSimple gets called, you transform the context by calling: CGContextConcatCTM(context, state->affineTransform);
In the routine that calls sTracePathStrokeAdvanced there is no such context-transform, because all point-transformations happen in the sTracePathStrokeAdvanced function.

The problem now is that the Context is not getting scaled for the CGContextDrawPath calls if the code enters the sTracePathStrokeAdvanced routine.

There is a simple fix:
Add the CGContextConcatCTM(context, state->affineTransform); after sTracePathStrokeAdvanced gets called. Like this:

if (isHairline || shouldRound || noScale) {
...
sTracePathStrokeAdvanced(state, operations, floats, lineWidth, state->affineTransform, isHairline, shouldRound, [lineStyle closesStroke]);
CGContextConcatCTM(context, state->affineTransform);
} else {
CGContextConcatCTM(context, state->affineTransform);
sTracePathStrokeSimple(state, operations, floats, [lineStyle closesStroke]);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant