From 002c3c1a7c2ae7229afac3f1966892fd42895aec Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 24 Mar 2022 18:09:28 +0000 Subject: Bitmap API: Clean up creation flags. --- content/handlers/image/bmp.c | 4 ++-- content/handlers/image/gif.c | 2 +- content/handlers/image/ico.c | 4 ++-- content/handlers/image/jpeg.c | 2 +- content/handlers/image/nssprite.c | 2 +- content/handlers/image/png.c | 4 ++-- content/handlers/image/rsvg.c | 2 +- content/handlers/image/webp.c | 4 ++-- content/handlers/javascript/duktape/CanvasRenderingContext2D.bnd | 6 +++--- 9 files changed, 15 insertions(+), 15 deletions(-) (limited to 'content') diff --git a/content/handlers/image/bmp.c b/content/handlers/image/bmp.c index 6ef4aacdf..5f9708be4 100644 --- a/content/handlers/image/bmp.c +++ b/content/handlers/image/bmp.c @@ -57,12 +57,12 @@ typedef struct nsbmp_content { */ static void *nsbmp_bitmap_create(int width, int height, unsigned int bmp_state) { - unsigned int bitmap_state = BITMAP_NEW; + unsigned int bitmap_state = BITMAP_NONE; /* set bitmap state based on bmp state */ bitmap_state |= (bmp_state & BMP_OPAQUE) ? BITMAP_OPAQUE : 0; bitmap_state |= (bmp_state & BMP_CLEAR_MEMORY) ? - BITMAP_CLEAR_MEMORY : 0; + BITMAP_CLEAR : 0; /* return the created bitmap */ return guit->bitmap->create(width, height, bitmap_state); diff --git a/content/handlers/image/gif.c b/content/handlers/image/gif.c index 9ecc472bd..f06805d12 100644 --- a/content/handlers/image/gif.c +++ b/content/handlers/image/gif.c @@ -88,7 +88,7 @@ static inline nserror gif__nsgif_error_to_ns(nsgif_error gif_res) */ static void *gif_bitmap_create(int width, int height) { - return guit->bitmap->create(width, height, BITMAP_NEW); + return guit->bitmap->create(width, height, BITMAP_NONE); } static nserror gif_create_gif_data(gif_content *c) diff --git a/content/handlers/image/ico.c b/content/handlers/image/ico.c index 63ca254ba..ac617f79e 100644 --- a/content/handlers/image/ico.c +++ b/content/handlers/image/ico.c @@ -54,12 +54,12 @@ typedef struct nsico_content { */ static void *nsico_bitmap_create(int width, int height, unsigned int bmp_state) { - unsigned int bitmap_state = BITMAP_NEW; + unsigned int bitmap_state = BITMAP_NONE; /* set bitmap state based on bmp state */ bitmap_state |= (bmp_state & BMP_OPAQUE) ? BITMAP_OPAQUE : 0; bitmap_state |= (bmp_state & BMP_CLEAR_MEMORY) ? - BITMAP_CLEAR_MEMORY : 0; + BITMAP_CLEAR : 0; /* return the created bitmap */ return guit->bitmap->create(width, height, bitmap_state); diff --git a/content/handlers/image/jpeg.c b/content/handlers/image/jpeg.c index 549c2b674..9daf06b3f 100644 --- a/content/handlers/image/jpeg.c +++ b/content/handlers/image/jpeg.c @@ -235,7 +235,7 @@ jpeg_cache_convert(struct content *c) height = cinfo.output_height; /* create opaque bitmap (jpegs cannot be transparent) */ - bitmap = guit->bitmap->create(width, height, BITMAP_NEW | BITMAP_OPAQUE); + bitmap = guit->bitmap->create(width, height, BITMAP_OPAQUE); if (bitmap == NULL) { /* empty bitmap could not be created */ jpeg_destroy_decompress(&cinfo); diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c index a4ce6b574..a6c2909f8 100644 --- a/content/handlers/image/nssprite.c +++ b/content/handlers/image/nssprite.c @@ -116,7 +116,7 @@ static bool nssprite_convert(struct content *c) struct rosprite* sprite = sprite_area->sprites[0]; - nssprite->bitmap = guit->bitmap->create(sprite->width, sprite->height, BITMAP_NEW); + nssprite->bitmap = guit->bitmap->create(sprite->width, sprite->height, BITMAP_NONE); if (!nssprite->bitmap) { content_broadcast_error(c, NSERROR_NOMEM, NULL); return false; diff --git a/content/handlers/image/png.c b/content/handlers/image/png.c index a1db3f697..d4c2ae061 100644 --- a/content/handlers/image/png.c +++ b/content/handlers/image/png.c @@ -163,7 +163,7 @@ static void info_callback(png_structp png_s, png_infop info) } /* Claim the required memory for the converted PNG */ - png_c->bitmap = guit->bitmap->create(width, height, BITMAP_NEW); + png_c->bitmap = guit->bitmap->create(width, height, BITMAP_NONE); if (png_c->bitmap == NULL) { /* Failed to create bitmap skip pre-conversion */ longjmp(png_jmpbuf(png_s), CBERR_NOPRE); @@ -483,7 +483,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 = guit->bitmap->create(width, height, BITMAP_NEW); + bitmap = guit->bitmap->create(width, height, BITMAP_NONE); if (bitmap == NULL) { /* cleanup and bail */ goto png_cache_convert_error; diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c index 0051df38f..46179985a 100644 --- a/content/handlers/image/rsvg.c +++ b/content/handlers/image/rsvg.c @@ -187,7 +187,7 @@ static bool rsvg_convert(struct content *c) c->height = rsvgsize.height; if ((d->bitmap = guit->bitmap->create(c->width, c->height, - BITMAP_NEW)) == NULL) { + BITMAP_NONE)) == NULL) { NSLOG(netsurf, INFO, "Failed to create bitmap for rsvg render."); content_broadcast_error(c, NSERROR_NOMEM, NULL); diff --git a/content/handlers/image/webp.c b/content/handlers/image/webp.c index 721e92438..59667a883 100644 --- a/content/handlers/image/webp.c +++ b/content/handlers/image/webp.c @@ -107,9 +107,9 @@ webp_cache_convert(struct content *c) } if (webpfeatures.has_alpha == 0) { - bmap_flags = BITMAP_NEW | BITMAP_OPAQUE; + bmap_flags = BITMAP_OPAQUE; } else { - bmap_flags = BITMAP_NEW; + bmap_flags = BITMAP_NONE; } /* create bitmap */ diff --git a/content/handlers/javascript/duktape/CanvasRenderingContext2D.bnd b/content/handlers/javascript/duktape/CanvasRenderingContext2D.bnd index db3c4efa3..2fe73f4e1 100644 --- a/content/handlers/javascript/duktape/CanvasRenderingContext2D.bnd +++ b/content/handlers/javascript/duktape/CanvasRenderingContext2D.bnd @@ -90,7 +90,7 @@ canvas2d_user_data_handler(dom_node_operation operation, height = guit->bitmap->get_height(bitmap); stride = guit->bitmap->get_rowstride(bitmap); newbitmap = guit->bitmap->create(width, height, - BITMAP_NEW); + BITMAP_NONE); if (newbitmap != NULL) { if (guit->bitmap->get_rowstride(newbitmap) == stride) { // Compatible bitmap, bung the data over @@ -173,7 +173,7 @@ static nserror canvas2d_create_bitmap(dom_node *node, struct bitmap **bitmap_out bitmap = guit->bitmap->create( (int)width, (int)height, - BITMAP_NEW); + BITMAP_NONE); if (bitmap == NULL) { return NSERROR_NOMEM; @@ -242,7 +242,7 @@ canvas2d__handle_dom_event(dom_event *evt, void *pw) /* Okay, we need to reallocate our bitmap and re-cache values */ - newbitmap = guit->bitmap->create(width, height, BITMAP_NEW); + newbitmap = guit->bitmap->create(width, height, BITMAP_NONE); stride = guit->bitmap->get_rowstride(newbitmap); if (newbitmap != NULL) { -- cgit v1.2.3