mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-02 08:19:19 +00:00
GOB: Make coordinate parameters in Surface::fillRect() signed
And clip to [0, width), [0, height) before drawing. This fixes bug #6864, which is a regression I introduced in 51fd528fe56e00466255d54e1e71b19f34729bfd when I changed all the drawing code to use the Surface class. I thought that having unsigned coordinates makes sense, but for some reason, Fascination sets _destSpriteX (which maps to left in fillRect()) to -1, expecting the drawing code to clip.
This commit is contained in:
parent
66a4b3c805
commit
5bec0cbb9d
@ -470,7 +470,7 @@ void Surface::blitScaled(const Surface &from, Common::Rational scale, int32 tran
|
||||
blitScaled(from, 0, 0, from._width - 1, from._height - 1, 0, 0, scale, transp);
|
||||
}
|
||||
|
||||
void Surface::fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint32 color) {
|
||||
void Surface::fillRect(int16 left, int16 top, int16 right, int16 bottom, uint32 color) {
|
||||
// Just in case those are swapped
|
||||
if (left > right)
|
||||
SWAP(left, right);
|
||||
@ -481,6 +481,11 @@ void Surface::fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uin
|
||||
// Nothing to do
|
||||
return;
|
||||
|
||||
left = CLIP<int32>(left , 0, _width - 1);
|
||||
top = CLIP<int32>(top , 0, _height - 1);
|
||||
right = CLIP<int32>(right , 0, _width - 1);
|
||||
bottom = CLIP<int32>(bottom, 0, _height - 1);
|
||||
|
||||
// Area to actually fill
|
||||
uint16 width = CLIP<int32>(right - left + 1, 0, _width - left);
|
||||
uint16 height = CLIP<int32>(bottom - top + 1, 0, _height - top);
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
void blitScaled(const Surface &from, int16 x, int16 y, Common::Rational scale, int32 transp = -1);
|
||||
void blitScaled(const Surface &from, Common::Rational scale, int32 transp = -1);
|
||||
|
||||
void fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint32 color);
|
||||
void fillRect(int16 left, int16 top, int16 right, int16 bottom, uint32 color);
|
||||
void fill(uint32 color);
|
||||
void clear();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user