libretro-lutro icon indicating copy to clipboard operation
libretro-lutro copied to clipboard

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

Open nstbayless opened this issue 3 years ago • 7 comments

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)

nstbayless avatar Jun 23 '21 22:06 nstbayless

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.

RobLoach avatar Jun 24 '21 13:06 RobLoach

@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).

nstbayless avatar Jun 24 '21 17:06 nstbayless

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

RobLoach avatar Jun 24 '21 23:06 RobLoach

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

new alerts:

  • 1 for Local variable hides global variable

lgtm-com[bot] avatar Jun 25 '21 18:06 lgtm-com[bot]

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.

nstbayless avatar Jun 25 '21 18:06 nstbayless

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

RobLoach avatar Dec 30 '21 20:12 RobLoach

Is this going to be merged?

skrat avatar Apr 22 '23 22:04 skrat