Skip to content

Commit

Permalink
WAGE: More robust rectangle drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Dec 27, 2015
1 parent c1d051d commit 5c2f330
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion engines/wage/design.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 5c2f330

Please sign in to comment.