[Scummvm-git-logs] scummvm branch-2-7 -> d4e6573d60bd700bb07ec36f9954733a3abec197

lephilousophe noreply at scummvm.org
Sun Mar 19 16:33:36 UTC 2023


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:
d4e6573d60 GRAPHICS: Fix clipping for circle and rounded squares


Commit: d4e6573d60bd700bb07ec36f9954733a3abec197
    https://github.com/scummvm/scummvm/commit/d4e6573d60bd700bb07ec36f9954733a3abec197
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-03-19T17:32:53+01:00

Commit Message:
GRAPHICS: Fix clipping for circle and rounded squares

Rect::contains expect that bottom right is excluded but circle functions
consider the radius as included.

In addition fix an error in Wu's algorithm for rounded squares.

Changed paths:
    graphics/VectorRendererSpec.cpp


diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index ca01ddb01c1..e6c4d210757 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -1152,7 +1152,7 @@ drawCircle(int x, int y, int r) {
 		x - r < 0 || y - r < 0 || x == 0 || y == 0 || r <= 0)
 		return;
 
-	bool useClippingVersions = !_clippingArea.contains(Common::Rect(x - r, y - r, x + r, y + r));
+	bool useClippingVersions = !_clippingArea.contains(Common::Rect(x - r, y - r, x + r + 1, y + r + 1));
 
 	if (Base::_fillMode != kFillDisabled && Base::_shadowOffset
 		&& x + r + Base::_shadowOffset < Base::_activeSurface->w
@@ -1283,7 +1283,7 @@ drawRoundedSquare(int x, int y, int r, int w, int h) {
 	if (r <= 0)
 		return;
 
-	bool useOriginal = _clippingArea.contains(Common::Rect(x, y, x + w, y + h));
+	bool useOriginal = _clippingArea.contains(Common::Rect(x, y, x + w + 1, y + h + 1));
 
 	if (Base::_fillMode != kFillDisabled && Base::_shadowOffset
 		&& x + w + Base::_shadowOffset + 1 < Base::_activeSurface->w
@@ -4209,7 +4209,7 @@ drawInteriorRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType colo
 
 	} else {
 
-		while (x > 1 + y++) {
+		while (x > y++) {
 			WU_ALGORITHM();
 
 			colorFill<PixelType>(ptr_tl - x - py + 1, ptr_tr + x - py, color);




More information about the Scummvm-git-logs mailing list