summaryrefslogtreecommitdiff
path: root/atari/bitmap.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-10-14 20:03:18 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-10-14 20:03:18 +0100
commitd88a8399371dad124136b4e12b9e7b7156ad3c69 (patch)
tree4fd3c0299efaf00d905045532aa8a45cb63b2c12 /atari/bitmap.c
parentdbed8312c8b21ac4efaebee5b646a37a0c398b55 (diff)
downloadnetsurf-d88a8399371dad124136b4e12b9e7b7156ad3c69.tar.gz
netsurf-d88a8399371dad124136b4e12b9e7b7156ad3c69.tar.bz2
Remove suspension of bmp/gif images. It's completely redundant with the convert on demand core image cache.
Diffstat (limited to 'atari/bitmap.c')
-rwxr-xr-xatari/bitmap.c171
1 files changed, 79 insertions, 92 deletions
diff --git a/atari/bitmap.c b/atari/bitmap.c
index 1201ac88a..1b5611fde 100755
--- a/atari/bitmap.c
+++ b/atari/bitmap.c
@@ -29,36 +29,36 @@
#include "atari/plot/plot.h"
#include "utils/log.h"
-
+
/*
bpp: bits per pixel,
-*/
-int init_mfdb(int bpp, int w, int h, uint32_t flags, MFDB * out )
-{
- int dststride;
- dststride = MFDB_STRIDE( w );
- int size = MFDB_SIZE( bpp, dststride, h );
- if( bpp > 0 ) {
- if( (flags & MFDB_FLAG_NOALLOC) == 0 ) {
- out->fd_addr = malloc( size );
- if( out->fd_addr == NULL ){
- return( 0 );
- }
- if( (flags & MFDB_FLAG_ZEROMEM) ){
- memset( out->fd_addr, 0, size );
- }
- }
- out->fd_stand = (flags & MFDB_FLAG_STAND) ? 1 : 0;
- out->fd_nplanes = (short)bpp;
- out->fd_r1 = out->fd_r2 = out->fd_r3 = 0;
- } else {
- memset( out, 0, sizeof(MFDB) );
- }
- out->fd_w = dststride;
- out->fd_h = h;
- out->fd_wdwidth = dststride >> 4;
- return( size );
+*/
+int init_mfdb(int bpp, int w, int h, uint32_t flags, MFDB * out )
+{
+ int dststride;
+ dststride = MFDB_STRIDE( w );
+ int size = MFDB_SIZE( bpp, dststride, h );
+ if( bpp > 0 ) {
+ if( (flags & MFDB_FLAG_NOALLOC) == 0 ) {
+ out->fd_addr = malloc( size );
+ if( out->fd_addr == NULL ){
+ return( 0 );
+ }
+ if( (flags & MFDB_FLAG_ZEROMEM) ){
+ memset( out->fd_addr, 0, size );
+ }
+ }
+ out->fd_stand = (flags & MFDB_FLAG_STAND) ? 1 : 0;
+ out->fd_nplanes = (short)bpp;
+ out->fd_r1 = out->fd_r2 = out->fd_r3 = 0;
+ } else {
+ memset( out, 0, sizeof(MFDB) );
+ }
+ out->fd_w = dststride;
+ out->fd_h = h;
+ out->fd_wdwidth = dststride >> 4;
+ return( size );
}
@@ -311,19 +311,6 @@ void bitmap_modified(void *bitmap)
}
-
-/**
- * The bitmap image can be suspended.
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \param private_word a private word to be returned later
- * \param suspend the function to be called upon suspension
- * \param resume the function to be called when resuming
- */
-void bitmap_set_suspendable(void *bitmap, void *private_word,
- void (*invalidate)(void *bitmap, void *private_word)) {
-}
-
/**
* Sets whether a bitmap should be plotted opaque
*
@@ -430,58 +417,58 @@ size_t bitmap_get_bpp(void *bitmap)
}
bool bitmap_resize(struct bitmap *img, HermesHandle hermes_h,
- HermesFormat *fmt, int nw, int nh)
-{
- short bpp = bitmap_get_bpp( img );
- int stride = bitmap_get_rowstride( img );
- int err;
-
- if( img->resized != NULL ) {
- if( img->resized->width != nw || img->resized->height != nh ) {
- bitmap_destroy( img->resized );
- img->resized = NULL;
- } else {
- /* the bitmap is already resized */
- return(true);
- }
- }
-
- /* allocate the mem for resized bitmap */
- img->resized = bitmap_create_ex( nw, nh, bpp, nw*bpp, 0, NULL );
- if( img->resized == NULL ) {
- printf("W: %d, H: %d, bpp: %d\n", nw, nh, bpp);
- assert(img->resized);
- return(false);
- }
-
- /* allocate an converter, only for resizing */
- err = Hermes_ConverterRequest( hermes_h,
- fmt,
- fmt
- );
- if( err == 0 ) {
- return(false);
- }
-
- err = Hermes_ConverterCopy( hermes_h,
- img->pixdata,
- 0, /* x src coord of top left in pixel coords */
- 0, /* y src coord of top left in pixel coords */
- bitmap_get_width( img ), bitmap_get_height( img ),
- stride, /* stride as bytes */
- img->resized->pixdata,
- 0, /* x dst coord of top left in pixel coords */
- 0, /* y dst coord of top left in pixel coords */
- nw, nh,
- bitmap_get_rowstride(img->resized) /* stride as bytes */
- );
- if( err == 0 ) {
- bitmap_destroy( img->resized );
- img->resized = NULL;
- return(false);
- }
-
- return(true);
+ HermesFormat *fmt, int nw, int nh)
+{
+ short bpp = bitmap_get_bpp( img );
+ int stride = bitmap_get_rowstride( img );
+ int err;
+
+ if( img->resized != NULL ) {
+ if( img->resized->width != nw || img->resized->height != nh ) {
+ bitmap_destroy( img->resized );
+ img->resized = NULL;
+ } else {
+ /* the bitmap is already resized */
+ return(true);
+ }
+ }
+
+ /* allocate the mem for resized bitmap */
+ img->resized = bitmap_create_ex( nw, nh, bpp, nw*bpp, 0, NULL );
+ if( img->resized == NULL ) {
+ printf("W: %d, H: %d, bpp: %d\n", nw, nh, bpp);
+ assert(img->resized);
+ return(false);
+ }
+
+ /* allocate an converter, only for resizing */
+ err = Hermes_ConverterRequest( hermes_h,
+ fmt,
+ fmt
+ );
+ if( err == 0 ) {
+ return(false);
+ }
+
+ err = Hermes_ConverterCopy( hermes_h,
+ img->pixdata,
+ 0, /* x src coord of top left in pixel coords */
+ 0, /* y src coord of top left in pixel coords */
+ bitmap_get_width( img ), bitmap_get_height( img ),
+ stride, /* stride as bytes */
+ img->resized->pixdata,
+ 0, /* x dst coord of top left in pixel coords */
+ 0, /* y dst coord of top left in pixel coords */
+ nw, nh,
+ bitmap_get_rowstride(img->resized) /* stride as bytes */
+ );
+ if( err == 0 ) {
+ bitmap_destroy( img->resized );
+ img->resized = NULL;
+ return(false);
+ }
+
+ return(true);
}
/*