From 5c2f3301f0b02d080de43f06efabec117903cec2 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 21 Dec 2015 20:08:08 +0100 Subject: [PATCH] WAGE: More robust rectangle drawing --- engines/wage/design.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp index 0b9db3b2a238..f347c33f410c 100644 --- a/engines/wage/design.cpp +++ b/engines/wage/design.cpp @@ -169,6 +169,12 @@ void Design::drawRect(Graphics::Surface *surface, Common::ReadStream &in, bool m int16 x1 = in.readSint16BE(); int16 y2 = in.readSint16BE(); int16 x2 = in.readSint16BE(); + + if (x1 > x2) + SWAP(x1, x2); + if (y1 > y2) + SWAP(y1, y2); + Common::Rect outer(x1, y1, x2, y2); plotData pd(surface, &patterns, borderFillType); @@ -200,6 +206,12 @@ void Design::drawRoundRect(Graphics::Surface *surface, Common::ReadStream &in, b int16 y2 = in.readSint16BE(); int16 x2 = in.readSint16BE(); int16 arc = in.readSint16BE(); + + if (x1 > x2) + SWAP(x1, x2); + if (y1 > y2) + SWAP(y1, y2); + Common::Rect outer(x1, y1, x2, y2); plotData pd(surface, &patterns, borderFillType); @@ -215,7 +227,7 @@ void Design::drawRoundRect(Graphics::Surface *surface, Common::ReadStream &in, b pd.fillType = fillType; if (fillType > patterns.size()) { - warning("Transparent roundrect"); + warning("Transparent roundrect, border: %d", borderThickness); } drawFilledRoundRect(inner, arc/2, kColorBlack, drawPixel, &pd);