From d5d02890104ce40ccdf2fca4cfde92dda30e7053 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Fri, 6 Jan 2012 21:57:42 +0000 Subject: Only set opaque on initial alloc, add flag for clearing buffer on realloc. svn path=/trunk/netsurf/; revision=13378 --- atari/bitmap.c | 5 ++++- atari/bitmap.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'atari') diff --git a/atari/bitmap.c b/atari/bitmap.c index 9a0bd96ac..f991d9fc7 100755 --- a/atari/bitmap.c +++ b/atari/bitmap.c @@ -105,6 +105,7 @@ void * bitmap_realloc( int w, int h, short bpp, int rowstride, unsigned int stat assert( 1 == 0 ); /* add some buffer for bad code */ bitmap->pixdata = malloc( newsize + 128 ); + bitmap->opaque = false; } else { int oldsize = bitmap->rowstride * bitmap->height; bool doalloc = ( state == BITMAP_GROW) ? (newsize > oldsize) : (newsize != oldsize); @@ -116,10 +117,12 @@ void * bitmap_realloc( int w, int h, short bpp, int rowstride, unsigned int stat return( NULL ); } } + if( state & BITMAP_CLEAR ){ + memset( bitmap->pixdata, 0x00, newsize + 128 ); + } bitmap->width = w; bitmap->height = h; - bitmap->opaque = false; bitmap->bpp = bpp; bitmap->resized = NULL; bitmap->rowstride = rowstride; diff --git a/atari/bitmap.h b/atari/bitmap.h index 783176053..d1756185d 100755 --- a/atari/bitmap.h +++ b/atari/bitmap.h @@ -22,6 +22,7 @@ #define BITMAP_SHRINK 0 #define BITMAP_GROW 0x1024 #define BITMAP_MONOGLYPH 0x2048 +#define BITMAP_CLEAR 0x4096 struct bitmap { int width; -- cgit v1.2.3