[Scummvm-git-logs] scummvm master -> 553f9b56aef4dd2d8ffa6799ef5f0f3db6d8fb1e

SupSuper supsuper at gmail.com
Fri Feb 12 00:33:23 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
553f9b56ae AGS: Fix assert when drawing rectangles with swapped coordinates


Commit: 553f9b56aef4dd2d8ffa6799ef5f0f3db6d8fb1e
    https://github.com/scummvm/scummvm/commit/553f9b56aef4dd2d8ffa6799ef5f0f3db6d8fb1e
Author: SupSuper (supsuper at gmail.com)
Date: 2021-02-12T00:33:10Z

Commit Message:
AGS: Fix assert when drawing rectangles with swapped coordinates

Allegro automatically swaps the coordinates when drawing,
so ScummVM needs to do the same.

Changed paths:
    engines/ags/lib/allegro/gfx.cpp


diff --git a/engines/ags/lib/allegro/gfx.cpp b/engines/ags/lib/allegro/gfx.cpp
index a1ad0e4ea5..1acca4d923 100644
--- a/engines/ags/lib/allegro/gfx.cpp
+++ b/engines/ags/lib/allegro/gfx.cpp
@@ -510,11 +510,19 @@ void line(BITMAP *bmp, int x1, int y1, int x2, int y2, int color) {
 
 void rect(BITMAP *bmp, int x1, int y1, int x2, int y2, int color) {
 	Graphics::ManagedSurface &surf = **bmp;
+	if (x1 > x2)
+		SWAP(x1, x2);
+	if (y1 > y2)
+		SWAP(y1, y2);
 	surf.frameRect(Common::Rect(x1, y1, x2, y2), color);
 }
 
 void rectfill(BITMAP *bmp, int x1, int y1, int x2, int y2, int color) {
 	Graphics::ManagedSurface &surf = **bmp;
+	if (x1 > x2)
+		SWAP(x1, x2);
+	if (y1 > y2)
+		SWAP(y1, y2);
 	surf.fillRect(Common::Rect(x1, y1, x2, y2), color);
 }
 




More information about the Scummvm-git-logs mailing list