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

Scissor rect support for DisplayObjectContainer #277

Merged
merged 1 commit into from
Feb 7, 2013

Conversation

tconkling
Copy link
Contributor

Hey Daniel,

I've ported my similar pull request from Sparrow (PrimaryFeather/Sparrow-Framework#1070) to Starling. Basically, this adds a scissorRect getter/setter to DisplayObjectContainer. It shouldn't add any CPU overhead for code that doesn't use it.

(This also fixes a bug in the existing Starling scissor-rect code: RenderSupport.finishQuadBatch() needs to be called when the scissor rect changes)

@zenrobin
Copy link

zenrobin commented Feb 5, 2013

Thanks for this improvement / fix, Tim!

@PrimaryFeather PrimaryFeather merged commit 0cad6ae into Gamua:master Feb 7, 2013
@PrimaryFeather
Copy link
Contributor

Thanks Tim, I've merged this into the core! It makes sense to have this functionality built in, especially while there are no real masks.

A few notes, though:

  • I have renamed the property "clipRect". I'm sure this is what you actually wanted (you named it that way in Sparrow, too), but you don't wanted to change my "scissorRect" naming in the RenderSupport class. However, I think this naming is more intuitive, anyway. And it's not exactly the same as the scissor rectangle, anyway, because that acts in screen (pixel) coordinates. This way, it's intuitive to see that it's not exactly the same.
  • I have moved the property from the "DisplayObjectContainer" class to the Sprite class. I haven't got any hard facts here, but I felt it would be better to have it just in this subclass, and not forcing it on every container (just like the flatten functionality).

What's not yet supported is flattened sprites that have clipped children. But I don't think that's critical for now; it would mean several internal changes at other places.

In any case, I hope you're fine with those changes! Thanks a lot for your efforts! =)

@jamikado
Copy link

jamikado commented Feb 7, 2013

Not sure how much of a problem this is (my guess is significant, though I havent upgraded to the latest Feathers and Starling source drops yet), but Feathers currently already has a clipRect property on its base FeathersControl class which all other controls inherit. I know Josh has this as a temporary solution for masks, but I'd guess there might be issues with someone using Feathers and Starling with this new shared name property of 'clipRect'

@PrimaryFeather
Copy link
Contributor

You're right, Jeff! I guess that Josh can fix this problem rather quickly, by removing his custom implementation and using Starling's new properties instead. In any case, thanks for the heads-up!

@tconkling
Copy link
Contributor Author

Huzzah! Thanks, Daniel

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

Successfully merging this pull request may close these issues.

None yet

5 participants