summaryrefslogtreecommitdiff
path: root/image/png.c
diff options
context:
space:
mode:
Diffstat (limited to 'image/png.c')
-rw-r--r--image/png.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/image/png.c b/image/png.c
index acf375e14..de2059f5a 100644
--- a/image/png.c
+++ b/image/png.c
@@ -18,25 +18,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
#include <stdbool.h>
-#include <string.h>
#include <stdlib.h>
-
#include <png.h>
-#include "desktop/plotters.h"
-
+#include "utils/log.h"
+#include "utils/messages.h"
#include "content/content_protected.h"
+#include "desktop/gui_internal.h"
-#include "image/bitmap.h"
#include "image/image_cache.h"
+#include "image/bitmap.h"
#include "image/png.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-
/* accommodate for old versions of libpng (beware security holes!) */
#ifndef png_jmpbuf
@@ -164,14 +158,14 @@ static void info_callback(png_structp png_s, png_infop info)
}
/* Claim the required memory for the converted PNG */
- png_c->bitmap = bitmap_create(width, height, BITMAP_NEW);
+ png_c->bitmap = guit->bitmap->create(width, height, BITMAP_NEW);
if (png_c->bitmap == NULL) {
/* Failed to create bitmap skip pre-conversion */
longjmp(png_jmpbuf(png_s), CBERR_NOPRE);
}
- png_c->rowstride = bitmap_get_rowstride(png_c->bitmap);
- png_c->bpp = bitmap_get_bpp(png_c->bitmap);
+ png_c->rowstride = guit->bitmap->get_rowstride(png_c->bitmap);
+ png_c->bpp = guit->bitmap->get_bpp(png_c->bitmap);
nspng_setup_transforms(png_s, info);
@@ -198,7 +192,7 @@ static void row_callback(png_structp png_s, png_bytep new_row,
return;
/* Get bitmap buffer */
- buffer = bitmap_get_buffer(png_c->bitmap);
+ buffer = guit->bitmap->get_buffer(png_c->bitmap);
if (buffer == NULL) {
/* No buffer, bail out */
longjmp(png_jmpbuf(png_s), 1);
@@ -404,9 +398,9 @@ png_cache_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
*/
static png_bytep *calc_row_pointers(struct bitmap *bitmap)
{
- int height = bitmap_get_height(bitmap);
- unsigned char *buffer= bitmap_get_buffer(bitmap);
- size_t rowstride = bitmap_get_rowstride(bitmap);
+ int height = guit->bitmap->get_height(bitmap);
+ unsigned char *buffer= guit->bitmap->get_buffer(bitmap);
+ size_t rowstride = guit->bitmap->get_rowstride(bitmap);
png_bytep *row_ptrs;
int hloop;
@@ -481,7 +475,7 @@ png_cache_convert(struct content *c)
height = png_get_image_height(png_ptr, info_ptr);
/* Claim the required memory for the converted PNG */
- bitmap = bitmap_create(width, height, BITMAP_NEW);
+ bitmap = guit->bitmap->create(width, height, BITMAP_NEW);
if (bitmap == NULL) {
/* cleanup and bail */
goto png_cache_convert_error;
@@ -500,8 +494,9 @@ png_cache_convert_error:
free((png_bytep *) row_pointers);
- if (bitmap != NULL)
- bitmap_modified((struct bitmap *)bitmap);
+ if (bitmap != NULL) {
+ guit->bitmap->modified((struct bitmap *)bitmap);
+ }
return (struct bitmap *)bitmap;
}
@@ -527,8 +522,8 @@ static bool nspng_convert(struct content *c)
}
if (png_c->bitmap != NULL) {
- bitmap_set_opaque(png_c->bitmap, bitmap_test_opaque(png_c->bitmap));
- bitmap_modified(png_c->bitmap);
+ guit->bitmap->set_opaque(png_c->bitmap, guit->bitmap->test_opaque(png_c->bitmap));
+ guit->bitmap->modified(png_c->bitmap);
}
image_cache_add(c, png_c->bitmap, png_cache_convert);