From 976c2aca502358c5f407a109c31d67abd519ac1d Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Tue, 13 Sep 2016 10:09:51 +0300 Subject: [PATCH] grise: fixed artifact due to uninitialized guard-pand in backBuffer and increased the performance slightly by copying the backBuffer to vmem_back, instead of fb_pixels. --- src/grise.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/grise.c b/src/grise.c index 896b7c0..e6cd7ea 100644 --- a/src/grise.c +++ b/src/grise.c @@ -99,7 +99,7 @@ static int init(void) int tmpBitmapW, tmpBitmapH; /* Allocate back buffer */ - backBuffer = (unsigned short*) malloc(BB_SIZE * BB_SIZE * sizeof(unsigned short)); + backBuffer = (unsigned short*) calloc(BB_SIZE * BB_SIZE, sizeof(unsigned short)); /* grise.png contains the background (horizon), baked reflection and normalmap for displacement */ if (!(background = img_load_pixels(BG_FILENAME, &backgroundW, &backgroundH, IMG_FMT_RGBA32))) { @@ -206,14 +206,14 @@ static void draw(void) /* Blit effect to framebuffer */ src = backBuffer + PIXEL_PADDING; - dst = fb_pixels; + dst = vmem_back; for (scanline = 0; scanline < fb_height; scanline++) { memcpy(dst, src, fb_width * 2); src += BB_SIZE; dst += fb_width; } - swap_buffers(fb_pixels); + swap_buffers(0); } /* src and dst can be the same */ @@ -541,4 +541,4 @@ static void rleBlitScaleInv(unsigned short *dst, int dstW, int dstH, int dstStri dst -= dstStride; } -} \ No newline at end of file +} -- 1.7.10.4