diff --git a/bemani/format/afp/blend.py b/bemani/format/afp/blend.py index b226acf..427b009 100644 --- a/bemani/format/afp/blend.py +++ b/bemani/format/afp/blend.py @@ -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. diff --git a/bemani/format/afp/blendaltimpl.cxx b/bemani/format/afp/blendaltimpl.cxx index 784a9e7..a4a6eeb 100644 --- a/bemani/format/afp/blendaltimpl.cxx +++ b/bemani/format/afp/blendaltimpl.cxx @@ -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) { diff --git a/bemani/format/afp/render.py b/bemani/format/afp/render.py index 965a5c3..6501aa6 100644 --- a/bemani/format/afp/render.py +++ b/bemani/format/afp/render.py @@ -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 diff --git a/bemani/format/afp/types/generic.py b/bemani/format/afp/types/generic.py index 00daad7..9d9bef5 100644 --- a/bemani/format/afp/types/generic.py +++ b/bemani/format/afp/types/generic.py @@ -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