diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-04-13 23:19:04 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-04-13 23:19:04 +0100 |
commit | f37e52c39475e6efd3740c5ae1ec4f290662928f (patch) | |
tree | 88d01618e903975743a3cb74bff9bf8df54c2a45 /image/jpeg.c | |
parent | 7a28131e4953934150967eb7886bc06678e249e8 (diff) | |
download | netsurf-f37e52c39475e6efd3740c5ae1ec4f290662928f.tar.gz netsurf-f37e52c39475e6efd3740c5ae1ec4f290662928f.tar.bz2 |
Move bitmap operations into an operation table.
The generic bitmap handlers provided by each frontend are called back
from the core and therefore should be in an operation table. This was
one of the very few remaining interfaces stopping the core code from
being split into a library.
Diffstat (limited to 'image/jpeg.c')
-rw-r--r-- | image/jpeg.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/image/jpeg.c b/image/jpeg.c index a5d77b55b..309dec0a1 100644 --- a/image/jpeg.c +++ b/image/jpeg.c @@ -23,19 +23,17 @@ * This implementation uses the IJG JPEG library. */ -#include <assert.h> -#include <setjmp.h> -#include <string.h> -#include <stdio.h> +#include <stdbool.h> #include <stdlib.h> - -#include "content/content_protected.h" -#include "desktop/plotters.h" -#include "image/image_cache.h" +#include <setjmp.h> #include "utils/log.h" #include "utils/messages.h" -#include "utils/utils.h" +#include "content/content_protected.h" +#include "desktop/gui_internal.h" + +#include "image/image_cache.h" +#include "image/bitmap.h" #define JPEG_INTERNAL_OPTIONS #include "jpeglib.h" @@ -224,23 +222,23 @@ jpeg_cache_convert(struct content *c) height = cinfo.output_height; /* create opaque bitmap (jpegs cannot be transparent) */ - bitmap = bitmap_create(width, height, BITMAP_NEW | BITMAP_OPAQUE); + bitmap = guit->bitmap->create(width, height, BITMAP_NEW | BITMAP_OPAQUE); if (bitmap == NULL) { /* empty bitmap could not be created */ jpeg_destroy_decompress(&cinfo); return NULL; } - pixels = bitmap_get_buffer(bitmap); + pixels = guit->bitmap->get_buffer(bitmap); if (pixels == NULL) { /* bitmap with no buffer available */ - bitmap_destroy(bitmap); + guit->bitmap->destroy(bitmap); jpeg_destroy_decompress(&cinfo); return NULL; } /* Convert scanlines from jpeg into bitmap */ - rowstride = bitmap_get_rowstride(bitmap); + rowstride = guit->bitmap->get_rowstride(bitmap); do { JSAMPROW scanlines[1]; @@ -265,7 +263,7 @@ jpeg_cache_convert(struct content *c) } #endif } while (cinfo.output_scanline != cinfo.output_height); - bitmap_modified(bitmap); + guit->bitmap->modified(bitmap); jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); |