add comment to explain coordinate packing logic
This commit is contained in:
parent
79376bbc58
commit
fc776eeb16
@ -85,6 +85,7 @@ void drawPixelCallback2D(int16_t x, int16_t y, uint8_t red, uint8_t green, uint8
|
|||||||
// simple nearest-neighbor scaling
|
// simple nearest-neighbor scaling
|
||||||
int outY = (int)y * activeSeg->vHeight() / gifHeight;
|
int outY = (int)y * activeSeg->vHeight() / gifHeight;
|
||||||
int outX = (int)x * activeSeg->vWidth() / gifWidth;
|
int outX = (int)x * activeSeg->vWidth() / gifWidth;
|
||||||
|
// Pack coordinates uniquely: outY into upper 16 bits, outX into lower 16 bits
|
||||||
if (((outY << 16) | outX) == lastCoordinate) return; // skip setting same coordinate again
|
if (((outY << 16) | outX) == lastCoordinate) return; // skip setting same coordinate again
|
||||||
lastCoordinate = (outY << 16) | outX; // since input is a "scanline" this is sufficient to identify a "unique" coordinate
|
lastCoordinate = (outY << 16) | outX; // since input is a "scanline" this is sufficient to identify a "unique" coordinate
|
||||||
// set multiple pixels if upscaling
|
// set multiple pixels if upscaling
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user