diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2012-10-14 20:03:18 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2012-10-14 20:03:18 +0100 |
commit | d88a8399371dad124136b4e12b9e7b7156ad3c69 (patch) | |
tree | 4fd3c0299efaf00d905045532aa8a45cb63b2c12 | |
parent | dbed8312c8b21ac4efaebee5b646a37a0c398b55 (diff) | |
download | netsurf-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.
-rw-r--r-- | amiga/bitmap.c | 13 | ||||
-rwxr-xr-x | atari/bitmap.c | 171 | ||||
-rw-r--r-- | beos/bitmap.cpp | 14 | ||||
-rw-r--r-- | cocoa/bitmap.m | 7 | ||||
-rw-r--r-- | framebuffer/bitmap.c | 13 | ||||
-rw-r--r-- | gtk/bitmap.c | 12 | ||||
-rw-r--r-- | image/bitmap.h | 2 | ||||
-rw-r--r-- | image/bmp.c | 1 | ||||
-rw-r--r-- | image/gif.c | 10 | ||||
-rw-r--r-- | monkey/bitmap.c | 6 | ||||
-rw-r--r-- | riscos/bitmap.c | 17 | ||||
-rw-r--r-- | windows/bitmap.c | 13 |
12 files changed, 79 insertions, 200 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c index ee1506525..3a2bc7060 100644 --- a/amiga/bitmap.c +++ b/amiga/bitmap.c @@ -183,19 +183,6 @@ void bitmap_modified(void *bitmap) { bm->native_mask = NULL; } - -/** - * 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 * 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); } /* diff --git a/beos/bitmap.cpp b/beos/bitmap.cpp index fed692315..83dedf780 100644 --- a/beos/bitmap.cpp +++ b/beos/bitmap.cpp @@ -298,20 +298,6 @@ void bitmap_modified(void *vbitmap) { nsbeos_bitmap_free_pretiles(bitmap); } - -/** - * The bitmap image can be suspended. - * - * \param vbitmap 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 *vbitmap, void *private_word, - void (*invalidate)(void *vbitmap, void *private_word)) { - struct bitmap *bitmap = (struct bitmap *)vbitmap; -} - int bitmap_get_width(void *vbitmap){ struct bitmap *bitmap = (struct bitmap *)vbitmap; return bitmap->primary->Bounds().Width() + 1; diff --git a/cocoa/bitmap.m b/cocoa/bitmap.m index 8c6afe344..45b1d3b19 100644 --- a/cocoa/bitmap.m +++ b/cocoa/bitmap.m @@ -156,13 +156,6 @@ void bitmap_modified(void *bitmap) } } -void bitmap_set_suspendable(void *bitmap, void *private_word, - void (*invalidate)(void *bitmap, void *private_word)) - -{ - // nothing to do -} - CGImageRef cocoa_get_cgimage( void *bitmap ) { NSMapTable *cache = cocoa_get_bitmap_cache(); diff --git a/framebuffer/bitmap.c b/framebuffer/bitmap.c index 491ee1594..c93c14b76 100644 --- a/framebuffer/bitmap.c +++ b/framebuffer/bitmap.c @@ -144,19 +144,6 @@ bool bitmap_save(void *bitmap, const char *path, unsigned flags) 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 wether a bitmap should be plotted opaque * diff --git a/gtk/bitmap.c b/gtk/bitmap.c index 7d8e82ddb..0f89c6748 100644 --- a/gtk/bitmap.c +++ b/gtk/bitmap.c @@ -319,18 +319,6 @@ void bitmap_modified(void *vbitmap) { gbitmap->converted = true; } - -/** - * 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 invalidate the function to be called upon suspension - */ -void bitmap_set_suspendable(void *vbitmap, void *private_word, - void (*invalidate)(void *vbitmap, void *private_word)) { -} - int bitmap_get_width(void *vbitmap){ struct bitmap *gbitmap = (struct bitmap *)vbitmap; assert(gbitmap); diff --git a/image/bitmap.h b/image/bitmap.h index ee837f5d7..b85d89c83 100644 --- a/image/bitmap.h +++ b/image/bitmap.h @@ -81,8 +81,6 @@ size_t bitmap_get_bpp(void *bitmap); void bitmap_destroy(void *bitmap); bool bitmap_save(void *bitmap, const char *path, unsigned flags); void bitmap_modified(void *bitmap); -void bitmap_set_suspendable(void *bitmap, void *private_word, - void (*invalidate)(void *bitmap, void *private_word)); int bitmap_get_width(void *bitmap); int bitmap_get_height(void *bitmap); diff --git a/image/bmp.c b/image/bmp.c index 9ca86fd82..c23f9dd54 100644 --- a/image/bmp.c +++ b/image/bmp.c @@ -120,7 +120,6 @@ static void *nsbmp_bitmap_create(int width, int height, unsigned int bmp_state) bmp_bitmap_callback_vt bmp_bitmap_callbacks = { .bitmap_create = nsbmp_bitmap_create, .bitmap_destroy = bitmap_destroy, - .bitmap_set_suspendable = bitmap_set_suspendable, .bitmap_get_buffer = bitmap_get_buffer, .bitmap_get_bpp = bitmap_get_bpp }; diff --git a/image/gif.c b/image/gif.c index b3781f837..93316e03e 100644 --- a/image/gif.c +++ b/image/gif.c @@ -235,13 +235,6 @@ static void nsgif_animate(void *p) content_broadcast(&gif->base, CONTENT_MSG_REDRAW, data); } -static void nsgif_invalidate(void *bitmap, void *private_word) -{ - struct gif_animation *gif = (struct gif_animation *)private_word; - - gif->decoded_frame = -1; -} - static bool nsgif_convert(struct content *c) { nsgif_content *gif = (nsgif_content *) c; @@ -294,9 +287,6 @@ static bool nsgif_convert(struct content *c) gif->current_frame = 0; if (gif->gif->frame_count_partial > 1) schedule(gif->gif->frames[0].frame_delay, nsgif_animate, c); - else - bitmap_set_suspendable(gif->gif->frame_image, gif->gif, - nsgif_invalidate); /* Exit as a success */ content_set_ready(c); diff --git a/monkey/bitmap.c b/monkey/bitmap.c index 31d2a23dc..79bab8cd5 100644 --- a/monkey/bitmap.c +++ b/monkey/bitmap.c @@ -108,12 +108,6 @@ void bitmap_modified(void *bitmap) bmap->state |= BITMAP_MODIFIED; } -void bitmap_set_suspendable(void *bitmap, void *private_word, - void (*invalidate)(void *bitmap, void *private_word)) -{ - -} - int bitmap_get_width(void *bitmap) { struct bitmap *bmap = bitmap; diff --git a/riscos/bitmap.c b/riscos/bitmap.c index 257d7ced2..6caaf3e2a 100644 --- a/riscos/bitmap.c +++ b/riscos/bitmap.c @@ -782,23 +782,6 @@ void bitmap_modified(void *vbitmap) { /** - * 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 invalidate the function to be called upon suspension - */ -void bitmap_set_suspendable(void *vbitmap, void *private_word, - void (*invalidate)(void *bitmap, void *private_word)) { - struct bitmap *bitmap = (struct bitmap *) vbitmap; - - bitmap->private_word = private_word; - bitmap->invalidate = invalidate; - bitmap_suspendable++; -} - - -/** * Performs routine maintenance. */ void bitmap_maintain(void) diff --git a/windows/bitmap.c b/windows/bitmap.c index 378dc8bb9..0f75ea823 100644 --- a/windows/bitmap.c +++ b/windows/bitmap.c @@ -177,19 +177,6 @@ bool bitmap_save(void *bitmap, const char *path, unsigned flags) 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 * |