From 9debed25e86c0c589dc8c59227c0b24a95a18cc6 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 25 Feb 2023 08:53:00 -0600 Subject: [PATCH] Fix meaning of 'origin'. --- Components/9918/Implementation/Draw.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Components/9918/Implementation/Draw.hpp b/Components/9918/Implementation/Draw.hpp index a4c668edd..3f0fe6e0c 100644 --- a/Components/9918/Implementation/Draw.hpp +++ b/Components/9918/Implementation/Draw.hpp @@ -137,13 +137,14 @@ void Base::draw_sprites(LineBuffer &buffer, int start, int end, int for(int previous_index = index - 1; previous_index >= min_sprite; --previous_index) { // Determine region of overlap (if any). LineBuffer::ActiveSprite &previous = buffer.active_sprites[previous_index]; - const int origin = previous.x - sprite.x; - const int x1 = std::max(0, 0 - origin); + const int origin = sprite.x - previous.x; + const int x1 = std::max(0, -origin); const int x2 = std::min(pixel_width - origin, pixel_width); // Composite sprites. for(int x = x1; x < x2; x++) { - Storage::sprite_cache_[previous_index][x + origin] |= Storage::sprite_cache_[index][x]; + Storage::sprite_cache_[previous_index][x + origin] + |= Storage::sprite_cache_[index][x]; } // If a previous opaque sprite has been found, stop.