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.
This commit is contained in:
parent
e62e9e84d5
commit
087eb6005c
1 changed files with 8 additions and 8 deletions
|
@ -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--;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue