1
0
mirror of synced 2025-01-19 06:27:23 +01:00

No longer take "blank pixels" outside of the screen into consideration for rendering SSAA.

This commit is contained in:
Jennifer Taylor 2021-08-09 20:20:26 +00:00
parent 41a1114469
commit d80c6a5ccd
2 changed files with 26 additions and 3 deletions

View File

@ -199,6 +199,7 @@ def pixel_renderer(
imgx: int,
imgy: int,
imgwidth: int,
imgheight: int,
texwidth: int,
texheight: int,
xscale: float,
@ -299,7 +300,12 @@ def pixel_renderer(
else:
for addy in ypoints:
for addx in xpoints:
texloc = callback(Point(imgx + addx, imgy + addy))
xloc = imgx + addx
yloc = imgy + addy
if xloc < 0.0 or yloc < 0.0 or xloc >= imgwidth or yloc >= imgheight:
continue
texloc = callback(Point(xloc, yloc))
denom += 1
if texloc is None:
@ -367,6 +373,7 @@ def affine_line_renderer(
minx: int,
maxx: int,
imgwidth: int,
imgheight: int,
texwidth: int,
texheight: int,
inverse: Matrix,
@ -394,6 +401,7 @@ def affine_line_renderer(
imgx,
imgy,
imgwidth,
imgheight,
texwidth,
texheight,
1.0 / inverse.xscale,
@ -479,6 +487,7 @@ def affine_composite(
imgx,
imgy,
imgwidth,
imgheight,
texwidth,
texheight,
1.0 / inverse.xscale,
@ -526,6 +535,7 @@ def affine_composite(
minx,
maxx,
imgwidth,
imgheight,
texwidth,
texheight,
inverse,
@ -576,6 +586,7 @@ def perspective_line_renderer(
minx: int,
maxx: int,
imgwidth: int,
imgheight: int,
texwidth: int,
texheight: int,
xscale: float,
@ -613,6 +624,7 @@ def perspective_line_renderer(
imgx,
imgy,
imgwidth,
imgheight,
texwidth,
texheight,
xscale,
@ -698,6 +710,7 @@ def perspective_composite(
imgx,
imgy,
imgwidth,
imgheight,
texwidth,
texheight,
transform.xscale,
@ -745,6 +758,7 @@ def perspective_composite(
minx,
maxx,
imgwidth,
imgheight,
texwidth,
texheight,
transform.xscale,

View File

@ -67,6 +67,7 @@ extern "C"
intcolor_t *imgdata;
unsigned char *maskdata;
unsigned int imgwidth;
unsigned int imgheight;
unsigned int minx;
unsigned int maxx;
unsigned int miny;
@ -393,14 +394,20 @@ extern "C"
int aax = -1;
int aay = -1;
float xloc = (float)imgx + addx;
float yloc = (float)imgy + addy;
if (xloc < 0.0 || yloc < 0.0 || xloc >= (float)work->imgwidth || yloc >= (float)work->imgheight) {
continue;
}
if (work->use_perspective) {
point_t texloc = work->inverse.multiply_point((point_t){(float)imgx + addx, (float)imgy + addy});
point_t texloc = work->inverse.multiply_point((point_t){xloc, yloc});
if (texloc.z > 0.0) {
aax = texloc.x / texloc.z;
aay = texloc.y / texloc.z;
}
} else {
point_t texloc = work->inverse.multiply_point((point_t){(float)imgx + addx, (float)imgy + addy});
point_t texloc = work->inverse.multiply_point((point_t){xloc, yloc});
aax = texloc.x;
aay = texloc.y;
}
@ -530,6 +537,7 @@ extern "C"
work.imgdata = imgdata;
work.maskdata = maskbytes;
work.imgwidth = imgwidth;
work.imgheight = imgheight;
work.minx = minx;
work.maxx = maxx;
work.miny = miny;
@ -576,6 +584,7 @@ extern "C"
work->imgdata = imgdata;
work->maskdata = maskbytes;
work->imgwidth = imgwidth;
work->imgheight = imgheight;
work->minx = minx;
work->maxx = maxx;
work->miny = imgy;