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

Painter updates: scaling (HAVE_SCALING=1) and clip rect on clear #215

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

nstbayless
Copy link

@nstbayless nstbayless commented Jun 23, 2021

Summary

  • pntr_clear is now affected by the clip rect, as per the love 2d api documentation.
  • build with make HAVE_SCALING=1 to enable scaling in pntr_draw. (This allows images to be scaled when drawn)
  • draw offset is applied correctly now (subtracted, not added)

@RobLoach
Copy link
Member

RobLoach commented Jun 24, 2021

This is great! Thanks for the addition... Would you mind adding a test or an example for this somewhere? Also, I thought some of this was handled by HAVE_COMPOSITION when drawing images when scaled? Perhaps that was different.

@nstbayless
Copy link
Author

@RobLoach, I've now added a unit test for scaling (test/graphics/scale.lua). It also tests that image offset is correctly applied (the ox, oy field in love.graphics.draw). Image offset was previously applied incorrectly -- it should be subtracted, not added. There's a nice explanation whhy here.

Also, I thought some of this was handled by HAVE_COMPOSITION when drawing images when scaled?

From the looks of the code, HAVE_COMPOSITION only affects how transparency is resolved. From the README:

make HAVE_COMPOSITION=1` Enables alpha-blending.

By the way, one thing I'm not sure about is how to check from the lua test side of things if lutro was compile with HAVE_TRANSFORM (or HAVE_COMPOSITION). Ideally the scaling test should be skipped if HAVE_COMPOSITION is disabled (or the makefile should ensure that tests are built with both fields enabled somehow).

@RobLoach
Copy link
Member

Hmmm, we could possibly expose something like love.config.transform or love.config.composition or something?

@lgtm-com
Copy link

lgtm-com bot commented Jun 25, 2021

This pull request introduces 1 alert when merging e4f931d into 81e078f - view on LGTM.com

new alerts:

  • 1 for Local variable hides global variable

@nstbayless
Copy link
Author

Hmmm, we could possibly expose something like love.config.transform or love.config.composition or something?

Okay, I've added this. See diff in lutro.c.

@RobLoach
Copy link
Member

@nstbayless Apologies for being away. Is this good to merge???? Looks pretty awesome.

@skrat
Copy link

skrat commented Apr 22, 2023

Is this going to be merged?

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.

3 participants