libretro / libretro-lutro

An experimental lua game framework for libretro following the LÖVE API
https://lutro.libretro.com
MIT License
153 stars 46 forks source link

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

Open nstbayless opened 3 years ago

nstbayless commented 3 years ago

Summary

RobLoach commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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

lgtm-com[bot] commented 3 years ago

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

new alerts:

nstbayless commented 3 years ago

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 commented 2 years ago

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

skrat commented 1 year ago

Is this going to be merged?