mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
imageScaleNNAA: Fix image clipping on rect- instead of image dimensions (#9896)
Fixes GUI scaling filters applied on animated images and 9slice backgrounds.
This commit is contained in:
parent
51de4ae297
commit
f849917bbe
@ -91,7 +91,7 @@ void imageScaleNNAA(video::IImage *src, const core::rect<s32> &srcrect, video::I
|
|||||||
u32 dy, dx;
|
u32 dy, dx;
|
||||||
video::SColor pxl;
|
video::SColor pxl;
|
||||||
|
|
||||||
// Cache rectsngle boundaries.
|
// Cache rectangle boundaries.
|
||||||
double sox = srcrect.UpperLeftCorner.X * 1.0;
|
double sox = srcrect.UpperLeftCorner.X * 1.0;
|
||||||
double soy = srcrect.UpperLeftCorner.Y * 1.0;
|
double soy = srcrect.UpperLeftCorner.Y * 1.0;
|
||||||
double sw = srcrect.getWidth() * 1.0;
|
double sw = srcrect.getWidth() * 1.0;
|
||||||
@ -107,15 +107,15 @@ void imageScaleNNAA(video::IImage *src, const core::rect<s32> &srcrect, video::I
|
|||||||
// Do some basic clipping, and for mirrored/flipped rects,
|
// Do some basic clipping, and for mirrored/flipped rects,
|
||||||
// make sure min/max are in the right order.
|
// make sure min/max are in the right order.
|
||||||
minsx = sox + (dx * sw / dim.Width);
|
minsx = sox + (dx * sw / dim.Width);
|
||||||
minsx = rangelim(minsx, 0, sw);
|
minsx = rangelim(minsx, 0, sox + sw);
|
||||||
maxsx = minsx + sw / dim.Width;
|
maxsx = minsx + sw / dim.Width;
|
||||||
maxsx = rangelim(maxsx, 0, sw);
|
maxsx = rangelim(maxsx, 0, sox + sw);
|
||||||
if (minsx > maxsx)
|
if (minsx > maxsx)
|
||||||
SWAP(double, minsx, maxsx);
|
SWAP(double, minsx, maxsx);
|
||||||
minsy = soy + (dy * sh / dim.Height);
|
minsy = soy + (dy * sh / dim.Height);
|
||||||
minsy = rangelim(minsy, 0, sh);
|
minsy = rangelim(minsy, 0, soy + sh);
|
||||||
maxsy = minsy + sh / dim.Height;
|
maxsy = minsy + sh / dim.Height;
|
||||||
maxsy = rangelim(maxsy, 0, sh);
|
maxsy = rangelim(maxsy, 0, soy + sh);
|
||||||
if (minsy > maxsy)
|
if (minsy > maxsy)
|
||||||
SWAP(double, minsy, maxsy);
|
SWAP(double, minsy, maxsy);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user