[Scummvm-git-logs] scummvm master -> 087eb6005cd624308df319f9c61a3c8cbc02e149

lephilousophe lephilousophe at users.noreply.github.com
Sun Jun 20 10:35:56 UTC 2021


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:
087eb6005c GRAPHICS: Fix triangle rendering with some aspect ratios


Commit: 087eb6005cd624308df319f9c61a3c8cbc02e149
    https://github.com/scummvm/scummvm/commit/087eb6005cd624308df319f9c61a3c8cbc02e149
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2021-06-20T12:30:20+02:00

Commit Message:
GRAPHICS: Fix triangle rendering with some aspect ratios

The test to detect we cross an integer doesn't take into account 0.5
steps
When w = 9 and h = 7, you get dx = 4, dx = 5 and gradient = 0.5
In this case you never get interx + gradient > ipart(interx) + 1 when
interx is an integer.

Changed paths:
    graphics/VectorRendererSpec.cpp


diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index 682c1c1ba4..38db2469dc 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -2198,9 +2198,9 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
 
 		for (int x = x1 + 1; x < x2; x++) {
 #if FIXED_POINT
-			if (intery + gradient > ipart(intery) + 0x100) {
+			if (intery + gradient >= ipart(intery) + 0x100) {
 #else
-			if (intery + gradient > ipart(intery) + 1) {
+			if (intery + gradient >= ipart(intery) + 1) {
 #endif
 				ptr_right++;
 				ptr_left--;
@@ -2253,9 +2253,9 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color
 
 		for (int y = y1 + 1; y < y2; y++) {
 #if FIXED_POINT
-			if (interx + gradient > ipart(interx) + 0x100) {
+			if (interx + gradient >= ipart(interx) + 0x100) {
 #else
-			if (interx + gradient > ipart(interx) + 1) {
+			if (interx + gradient >= ipart(interx) + 1) {
 #endif
 				ptr_right++;
 				ptr_left--;
@@ -2393,9 +2393,9 @@ drawTriangleVertAlgClip(int x1, int y1, int w, int h, bool inverted, PixelType c
 
 		for (int x = x1 + 1; x < x2; x++) {
 #if FIXED_POINT
-			if (intery + gradient > ipart(intery) + 0x100) {
+			if (intery + gradient >= ipart(intery) + 0x100) {
 #else
-			if (intery + gradient > ipart(intery) + 1) {
+			if (intery + gradient >= ipart(intery) + 1) {
 #endif
 				ptr_right++;
 				ptr_left--;
@@ -2454,9 +2454,9 @@ drawTriangleVertAlgClip(int x1, int y1, int w, int h, bool inverted, PixelType c
 
 		for (int y = y1 + 1; y < y2; y++) {
 #if FIXED_POINT
-			if (interx + gradient > ipart(interx) + 0x100) {
+			if (interx + gradient >= ipart(interx) + 0x100) {
 #else
-			if (interx + gradient > ipart(interx) + 1) {
+			if (interx + gradient >= ipart(interx) + 1) {
 #endif
 				ptr_right++;
 				ptr_left--;




More information about the Scummvm-git-logs mailing list