Change compositing to take from the center of the pixel in preparation of upcoming anti-aliasing attempt.
This commit is contained in:
parent
212ff2be4e
commit
274bd297f2
@ -168,7 +168,7 @@ except ImportError:
|
||||
imgoff = imgx + (imgy * imgwidth)
|
||||
|
||||
# Calculate what texture pixel data goes here.
|
||||
texloc = inverse.multiply_point(Point(float(imgx), float(imgy)))
|
||||
texloc = inverse.multiply_point(Point(float(imgx + 0.5), float(imgy + 0.5)))
|
||||
texx, texy = texloc.as_tuple()
|
||||
|
||||
# If we're out of bounds, don't update.
|
||||
@ -277,7 +277,7 @@ except ImportError:
|
||||
continue
|
||||
|
||||
# Calculate what texture pixel data goes here.
|
||||
texloc = inverse.multiply_point(Point(float(imgx), float(imgy)))
|
||||
texloc = inverse.multiply_point(Point(float(imgx + 0.5), float(imgy + 0.5)))
|
||||
texx, texy = texloc.as_tuple()
|
||||
|
||||
# If we're out of bounds, don't update.
|
||||
|
@ -212,9 +212,9 @@ extern "C"
|
||||
unsigned int imgoff = imgx + (imgy * work->imgwidth);
|
||||
|
||||
// Calculate what texture pixel data goes here.
|
||||
point_t texloc = work->inverse.multiply_point((point_t){(float)imgx, (float)imgy});
|
||||
int texx = roundf(texloc.x);
|
||||
int texy = roundf(texloc.y);
|
||||
point_t texloc = work->inverse.multiply_point((point_t){(float)imgx + (float)0.5, (float)imgy + (float)0.5});
|
||||
int texx = texloc.x;
|
||||
int texy = texloc.y;
|
||||
|
||||
// If we're out of bounds, don't update.
|
||||
if (texx < 0 or texy < 0 or texx >= (int)work->texwidth or texy >= (int)work->texheight) {
|
||||
|
@ -519,36 +519,7 @@ class AFPRenderer(VerboseOutput):
|
||||
texture = shape.rectangle
|
||||
|
||||
if texture is not None:
|
||||
# See if we can cheat and use the faster blitting method.
|
||||
if (
|
||||
add_color.r == 0.0 and
|
||||
add_color.g == 0.0 and
|
||||
add_color.b == 0.0 and
|
||||
add_color.a == 0.0 and
|
||||
mult_color.r == 1.0 and
|
||||
mult_color.g == 1.0 and
|
||||
mult_color.b == 1.0 and
|
||||
mult_color.a == 1.0 and
|
||||
transform.a == 1.0 and
|
||||
transform.b == 0.0 and
|
||||
transform.c == 0.0 and
|
||||
transform.d == 1.0 and
|
||||
(blend == 0 or blend == 2)
|
||||
):
|
||||
# We can!
|
||||
cutin = transform.multiply_point(Point.identity())
|
||||
cutoff = Point.identity()
|
||||
if cutin.x < 0:
|
||||
cutoff.x = -cutin.x
|
||||
cutin.x = 0
|
||||
if cutin.y < 0:
|
||||
cutoff.y = -cutin.y
|
||||
cutin.y = 0
|
||||
|
||||
img.alpha_composite(texture, cutin.as_tuple(), cutoff.as_tuple())
|
||||
else:
|
||||
# We can't, so do the slow render that's correct.
|
||||
img = affine_composite(img, add_color, mult_color, transform, blend, texture, single_threaded=self.__single_threaded)
|
||||
img = affine_composite(img, add_color, mult_color, transform, blend, texture, single_threaded=self.__single_threaded)
|
||||
elif isinstance(renderable, PlacedDummy):
|
||||
# Nothing to do!
|
||||
pass
|
||||
|
@ -60,7 +60,7 @@ class Point:
|
||||
}
|
||||
|
||||
def as_tuple(self) -> Tuple[int, int]:
|
||||
return (round(self.x), round(self.y))
|
||||
return (int(self.x), int(self.y))
|
||||
|
||||
def add(self, other: "Point") -> "Point":
|
||||
x = self.x + other.x
|
||||
|
Loading…
x
Reference in New Issue
Block a user