Skip to content

Commit

Permalink
WAGE: Completed drawFilledEllipse
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Dec 27, 2015
1 parent 9ae6992 commit cce763e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
19 changes: 6 additions & 13 deletions engines/wage/design.cpp
Expand Up @@ -450,18 +450,12 @@ void Design::drawHLine(int x1, int x2, int y, int color, void (*plotProc)(int, i
(*plotProc)(x, y, color, data);
}

void Design::patternVLine(Graphics::Surface *surface, Patterns &patterns, byte fillType, int x, int y1, int y2, int x0, int y0) {
void Design::drawVLine(int x, int y1, int y2, int color, void (*plotProc)(int, int, int, void *), void *data) {
if (y1 > y2)
SWAP(y1, y2);

if (fillType > patterns.size())
return;

for (int y = y1; y < y2; y++)
if (x >= 0 && x < surface->w && y >= 0 && y < surface->h)
*((byte *)surface->getBasePtr(x, y)) =
(patterns[fillType - 1][(y - y0) % 8] & (1 << (7 - (x - x0) % 8))) ?
kColorBlack : kColorWhite;
for (int y = y1; y < y2; x++)
(*plotProc)(x, y, color, data);
}

/* Bresenham as presented in Foley & Van Dam */
Expand All @@ -475,15 +469,14 @@ void Design::drawThickLine (int x1, int y1, int x2, int y2, int thick, int color
int dx = abs(x2 - x1);
int dy = abs(y2 - y1);

/*
if (dx == 0) {
patternVLine(surface, patterns, fillType, x1, y1, y2, x1, y1);
drawVLine(x1, y1, y2, color, plotProc, data);
return;
} else if (dy == 0) {
patternHLine(surface, patterns, fillType, x1, x2, y1, x1, y1);
drawHLine(x1, x2, y1, color, plotProc, data);
return;
}
*/

if (dy <= dx) {
/* More-or-less horizontal. use wid for vertical stroke */
/* Doug Claar: watch out for NaN in atan2 (2.0.5) */
Expand Down
2 changes: 1 addition & 1 deletion engines/wage/design.h
Expand Up @@ -98,7 +98,7 @@ class Design {
void (*plotProc)(int, int, int, void *), void *data);
void drawFilledEllipse(int x0, int y0, int x1, int y1, void (*plotProc)(int, int, int, void *), void *data);
void drawHLine(int x1, int x2, int y, int color, void (*plotProc)(int, int, int, void *), void *data);
void patternVLine(Graphics::Surface *surface, Patterns &patterns, byte fillType, int x, int y1, int y2, int x0, int y0);
void drawVLine(int x, int y1, int y2, int color, void (*plotProc)(int, int, int, void *), void *data);
void drawThickLine (int x1, int y1, int x2, int y2, int thick, int color,
void (*plotProc)(int, int, int, void *), void *data);
};
Expand Down

0 comments on commit cce763e

Please sign in to comment.