[Scummvm-git-logs] scummvm master -> d8a5a284e79a38e745301693921d92ab4ee9148b

sev- noreply at scummvm.org
Wed Jul 13 21:02:03 UTC 2022


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:
d8a5a284e7 GRAPHICS: Added primitives drawing over bigger rectangles


Commit: d8a5a284e79a38e745301693921d92ab4ee9148b
    https://github.com/scummvm/scummvm/commit/d8a5a284e79a38e745301693921d92ab4ee9148b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-07-13T23:01:48+02:00

Commit Message:
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.

Changed paths:
    graphics/primitives.cpp
    graphics/primitives.h


diff --git a/graphics/primitives.cpp b/graphics/primitives.cpp
index 271a4b66952..7d24703f8cb 100644
--- a/graphics/primitives.cpp
+++ b/graphics/primitives.cpp
@@ -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;
diff --git a/graphics/primitives.h b/graphics/primitives.h
index dcd70c0a5d4..5b1464ef9e1 100644
--- a/graphics/primitives.h
+++ b/graphics/primitives.h
@@ -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);




More information about the Scummvm-git-logs mailing list