mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-23 11:04:44 +00:00
GRAPHICS: Added primitives drawing over bigger rectangles
We do not count right and bottom edges of Common::Rect. But the original primitives.cpp was drawn _with_ this in mind. This introduces *1 methods which will be used by Director, WAGE and MacGUI. Maybe at some moment in the future we will rewrite those.
This commit is contained in:
parent
f18c1ed826
commit
d8a5a284e7
@ -239,19 +239,43 @@ void drawThickLine2(int x1, int y1, int x2, int y2, int thick, int color, void (
|
||||
}
|
||||
|
||||
void drawFilledRect(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data) {
|
||||
for (int y = rect.top; y < rect.bottom; y++)
|
||||
drawHLine(rect.left, rect.right - 1, y, color, plotProc, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Draws filled rectangle _with_ right and bottom edges
|
||||
*/
|
||||
void drawFilledRect1(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data) {
|
||||
for (int y = rect.top; y <= rect.bottom; y++)
|
||||
drawHLine(rect.left, rect.right, y, color, plotProc, data);
|
||||
}
|
||||
|
||||
void drawRect(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data) {
|
||||
drawHLine(rect.left, rect.right - 1, rect.top, color, plotProc, data);
|
||||
drawHLine(rect.left, rect.right - 1, rect.bottom - 1, color, plotProc, data);
|
||||
drawVLine(rect.left, rect.top, rect.bottom - 1, color, plotProc, data);
|
||||
drawVLine(rect.right, rect.top, rect.bottom - 1, color, plotProc, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Draws rectangle outline _with_ right and bottom edges
|
||||
*/
|
||||
void drawRect1(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data) {
|
||||
drawHLine(rect.left, rect.right, rect.top, color, plotProc, data);
|
||||
drawHLine(rect.left, rect.right, rect.bottom, color, plotProc, data);
|
||||
drawVLine(rect.left, rect.top, rect.bottom, color, plotProc, data);
|
||||
drawVLine(rect.right, rect.top, rect.bottom, color, plotProc, data);
|
||||
}
|
||||
|
||||
// http://members.chello.at/easyfilter/bresenham.html
|
||||
void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*plotProc)(int, int, int, void *), void *data) {
|
||||
Common::Rect r(rect.left, rect.top, rect.right - 1, rect.bottom - 1);
|
||||
|
||||
drawRoundRect1(r, arc, color, filled, plotProc, data);
|
||||
}
|
||||
|
||||
// http://members.chello.at/easyfilter/bresenham.html
|
||||
void drawRoundRect1(Common::Rect &rect, int arc, int color, bool filled, void (*plotProc)(int, int, int, void *), void *data) {
|
||||
if (rect.height() < rect.width()) {
|
||||
int x = -arc, y = 0, err = 2-2*arc; /* II. Quadrant */
|
||||
int dy = rect.height() - arc * 2;
|
||||
|
@ -33,8 +33,11 @@ void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, int color
|
||||
void drawThickLine2(int x1, int y1, int x2, int y2, int thick, int color,
|
||||
void (*plotProc)(int, int, int, void *), void *data);
|
||||
void drawFilledRect(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data);
|
||||
void drawFilledRect1(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data);
|
||||
void drawRect(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data);
|
||||
void drawRect1(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data);
|
||||
void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*plotProc)(int, int, int, void *), void *data);
|
||||
void drawRoundRect1(Common::Rect &rect, int arc, int color, bool filled, void (*plotProc)(int, int, int, void *), void *data);
|
||||
void drawPolygonScan(int *polyX, int *polyY, int npoints, Common::Rect &bbox, int color,
|
||||
void (*plotProc)(int, int, int, void *), void *data);
|
||||
void drawEllipse(int x0, int y0, int x1, int y1, int color, bool filled, void (*plotProc)(int, int, int, void *), void *data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user