changeset 1368:4c5a78555209

Fix small blank spot on line -2 in "ninja escape" border fade in OD2
author Michael Pavone <pavone@retrodev.com>
date Tue, 23 May 2017 09:39:22 -0700
parents 52c99430ba5f
children 3e7a921718de
files vdp.c
diffstat 1 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/vdp.c	Mon May 22 22:04:07 2017 -0700
+++ b/vdp.c	Tue May 23 09:39:22 2017 -0700
@@ -2014,14 +2014,15 @@
 		if (context->state == PREPARING) {
 			uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
 			uint32_t *dst;
-			if (headless) {
-				dst = context->output;
-			} else {
-				dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2)))
+			dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2)))
 					+ (context->hslot - BG_START_SLOT) * 2;
+			if (dst >= context->done_output) {
+				*dst = bg_color;
 			}
-			*(dst++) = bg_color;
-			*dst = bg_color;
+			dst++;
+			if (dst >= context->done_output) {
+				*dst = bg_color;
+			}
 			external_slot(context);
 		} else {
 			render_sprite_cells(context);
@@ -2031,14 +2032,15 @@
 		if (context->state == PREPARING) {
 			uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
 			uint32_t *dst;
-			if (headless) {
-				dst = context->output;
-			} else {
-				dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2)))
+			dst = ((uint32_t *)(((char *)context->fb) + context->output_pitch * (context->border_top - 2)))
 					+ (context->hslot - BG_START_SLOT) * 2;
+			if (dst >= context->done_output) {
+				*dst = bg_color;
 			}
-			*(dst++) = bg_color;
-			*dst = bg_color;
+			dst++;
+			if (dst >= context->done_output) {
+				*dst = bg_color;
+			}
 			external_slot(context);
 		} else {
 			render_sprite_cells(context);
@@ -2054,11 +2056,7 @@
 		if (context->state == PREPARING) {
 			uint32_t bg_color = context->colors[context->regs[REG_BG_COLOR] & 0x3F];
 			uint32_t *dst;
-			if (headless) {
-				dst = context->output;
-			} else {
-				dst = context->output + (context->hslot - BG_START_SLOT) * 2;
-			}
+			dst = context->output + (context->hslot - BG_START_SLOT) * 2;
 			for (int i = 0; i < LINEBUF_SIZE - 2 * (context->hslot - BG_START_SLOT); i++, dst++)
 			{
 				if (dst >= context->done_output) {
@@ -2579,6 +2577,7 @@
 	{
 		*dst = context->colors[src[src_off & SCROLL_BUFFER_MASK] & 0x3F];
 	}
+	context->done_output = dst;
 	context->buf_a_off = (context->buf_a_off + SCROLL_BUFFER_DRAW) & SCROLL_BUFFER_DRAW;
 	context->buf_b_off = (context->buf_b_off + SCROLL_BUFFER_DRAW) & SCROLL_BUFFER_DRAW;
 }