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

Masking Problems (fix inside) #20

Open
aherbig opened this issue Dec 3, 2015 · 1 comment
Open

Masking Problems (fix inside) #20

aherbig opened this issue Dec 3, 2015 · 1 comment

Comments

@aherbig
Copy link

aherbig commented Dec 3, 2015

In the routine:

static void sDrawPlacedObject(SwiffRenderState *state, SwiffPlacedObject *placedObject)
of the SwiffRenderer there are two early returns.

// Bail out if placedObject is hidden
if (placedObjectIsHidden) {
...
}

and

// Bail out if renderBounds is not in the clipBoundingBox
CGRect renderBounds = CGRectApplyAffineTransform([definition renderBounds], newTransform);
if (!CGRectIntersectsRect(renderBounds, state->clipBoundingBox)) {
...
}

If the code returns at those points, the code needed for correct masking that is at the end of sDrawPlacedObject never gets called and there are display errors.

if (placedObjectClipDepth) {
sStartClipping(state, placedObjectClipDepth);
state->isBuildingClippingPath = NO;
state->skipUntilClipDepth = NO;
}

Fixed it by copying that last code snippet right before the return calls above.

@aherbig
Copy link
Author

aherbig commented Dec 7, 2015

actually my solution was wrong, as the clipping path was not yet added to the context.

To make sure the clipping path gets build correctly, I am checking the state->isBuildingClippingPath before bailing out:

// Bail out if placedObject is hidden
if(!state->isBuildingClippingPath && placedObjectIsHidden) {
return;
}

// Bail out if renderBounds is not in the clipBoundingBox
if(!state->isBuildingClippingPath && !CGRectIntersectsRect(renderBounds, state->clipBoundingBox)) {
return;
}

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