diff options
Diffstat (limited to 'content/handlers/image')
-rw-r--r-- | content/handlers/image/ico.c | 8 | ||||
-rw-r--r-- | content/handlers/image/image_cache.c | 110 | ||||
-rw-r--r-- | content/handlers/image/jpeg.c | 4 | ||||
-rw-r--r-- | content/handlers/image/nssprite.c | 4 | ||||
-rw-r--r-- | content/handlers/image/png.c | 15 | ||||
-rw-r--r-- | content/handlers/image/rsvg.c | 17 |
6 files changed, 89 insertions, 69 deletions
diff --git a/content/handlers/image/ico.c b/content/handlers/image/ico.c index d1865a3b4..85aab9f64 100644 --- a/content/handlers/image/ico.c +++ b/content/handlers/image/ico.c @@ -160,7 +160,7 @@ static bool nsico_convert(struct content *c) bmp = ico_find(ico->ico, 255, 255); if (bmp == NULL) { /* return error */ - LOG("Failed to select icon"); + NSLOG(netsurf, INFO, "Failed to select icon"); return false; } @@ -183,7 +183,7 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data, bmp = ico_find(ico->ico, data->width, data->height); if (bmp == NULL) { /* return error */ - LOG("Failed to select icon"); + NSLOG(netsurf, INFO, "Failed to select icon"); return false; } @@ -192,7 +192,7 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data, if (bmp_decode(bmp) != BMP_OK) { return false; } else { - LOG("Decoding bitmap"); + NSLOG(netsurf, INFO, "Decoding bitmap"); guit->bitmap->modified(bmp->bitmap); } @@ -255,7 +255,7 @@ static void *nsico_get_internal(const struct content *c, void *context) bmp = ico_find(ico->ico, 16, 16); if (bmp == NULL) { /* return error */ - LOG("Failed to select icon"); + NSLOG(netsurf, INFO, "Failed to select icon"); return NULL; } diff --git a/content/handlers/image/image_cache.c b/content/handlers/image/image_cache.c index 02107f75f..7fba11fb9 100644 --- a/content/handlers/image/image_cache.c +++ b/content/handlers/image/image_cache.c @@ -256,11 +256,12 @@ static void image_cache__free_bitmap(struct image_cache_entry_s *centry) { if (centry->bitmap != NULL) { #ifdef IMAGE_CACHE_VERBOSE - LOG("Freeing bitmap %p size %d age %d redraw count %d", - centry->bitmap, - centry->bitmap_size, - image_cache->current_age - centry->bitmap_age, - centry->redraw_count); + NSLOG(netsurf, INFO, + "Freeing bitmap %p size %d age %d redraw count %d", + centry->bitmap, + centry->bitmap_size, + image_cache->current_age - centry->bitmap_age, + centry->redraw_count); #endif guit->bitmap->destroy(centry->bitmap); centry->bitmap = NULL; @@ -281,7 +282,7 @@ static void image_cache__free_bitmap(struct image_cache_entry_s *centry) static void image_cache__free_entry(struct image_cache_entry_s *centry) { #ifdef IMAGE_CACHE_VERBOSE - LOG("freeing %p ", centry); + NSLOG(netsurf, INFO, "freeing %p ", centry); #endif if (centry->redraw_count == 0) { @@ -331,7 +332,7 @@ static void image_cache__background_update(void *p) icache->current_age += icache->params.bg_clean_time; #ifdef IMAGE_CACHE_VERBOSE - LOG("Cache age %ds", icache->current_age / 1000); + NSLOG(netsurf, INFO, "Cache age %ds", icache->current_age / 1000); #endif image_cache__clean(icache); @@ -383,13 +384,16 @@ bool image_cache_speculate(struct content *c) if ((image_cache->total_bitmap_size < image_cache->params.limit) && (c->size <= image_cache->params.speculative_small)) { #ifdef IMAGE_CACHE_VERBOSE - LOG("content size (%d) is smaller than minimum (%d)", c->size, SPECULATE_SMALL); + NSLOG(netsurf, INFO, + "content size (%d) is smaller than minimum (%d)", + c->size, + SPECULATE_SMALL); #endif decision = true; } #ifdef IMAGE_CACHE_VERBOSE - LOG("returning %d", decision); + NSLOG(netsurf, INFO, "returning %d", decision); #endif return decision; } @@ -422,8 +426,10 @@ image_cache_init(const struct image_cache_parameters *image_cache_parameters) image_cache__background_update, image_cache); - LOG("Image cache initialised with a limit of %" PRIsizet " hysteresis of %"PRIsizet, - image_cache->params.limit, image_cache->params.hysteresis); + NSLOG(netsurf, INFO, + "Image cache initialised with a limit of %"PRIsizet" hysteresis of %"PRIsizet, + image_cache->params.limit, + image_cache->params.hysteresis); return NSERROR_OK; } @@ -435,8 +441,8 @@ nserror image_cache_fini(void) guit->misc->schedule(-1, image_cache__background_update, image_cache); - LOG("Size at finish %" PRIsizet " (in %d)", - image_cache->total_bitmap_size, image_cache->bitmap_count); + NSLOG(netsurf, INFO, "Size at finish %"PRIsizet" (in %d)", + image_cache->total_bitmap_size, image_cache->bitmap_count); while (image_cache->entries != NULL) { image_cache__free_entry(image_cache->entries); @@ -446,11 +452,13 @@ nserror image_cache_fini(void) image_cache->miss_count + image_cache->fail_count; - LOG("Age %ds", image_cache->current_age / 1000); - LOG("Peak size %" PRIsizet " (in %d)", - image_cache->max_bitmap_size, image_cache->max_bitmap_size_count); - LOG("Peak image count %d (size %" PRIsizet ")", - image_cache->max_bitmap_count, image_cache->max_bitmap_count_size); + NSLOG(netsurf, INFO, "Age %ds", image_cache->current_age / 1000); + NSLOG(netsurf, INFO, "Peak size %"PRIsizet" (in %d)", + image_cache->max_bitmap_size, + image_cache->max_bitmap_size_count); + NSLOG(netsurf, INFO, "Peak image count %d (size %"PRIsizet")", + image_cache->max_bitmap_count, + image_cache->max_bitmap_count_size); if (op_count > 0) { uint64_t op_size; @@ -459,35 +467,39 @@ nserror image_cache_fini(void) image_cache->miss_size + image_cache->fail_size; - LOG("Cache total/hit/miss/fail (counts) %d/%d/%d/%d (100%%/%d%%/%d%%/%d%%)", - op_count, - image_cache->hit_count, - image_cache->miss_count, - image_cache->fail_count, - (image_cache->hit_count * 100) / op_count, - (image_cache->miss_count * 100) / op_count, - (image_cache->fail_count * 100) / op_count); - LOG("Cache total/hit/miss/fail (size) %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64" (100%%/%"PRId64"%%/%"PRId64"%%/%"PRId64"%%)", - op_size, - image_cache->hit_size, - image_cache->miss_size, - image_cache->fail_size, - (image_cache->hit_size * 100) / op_size, - (image_cache->miss_size * 100) / op_size, - (image_cache->fail_size * 100) / op_size); + NSLOG(netsurf, INFO, + "Cache total/hit/miss/fail (counts) %d/%d/%d/%d (100%%/%d%%/%d%%/%d%%)", + op_count, + image_cache->hit_count, + image_cache->miss_count, + image_cache->fail_count, + (image_cache->hit_count * 100) / op_count, + (image_cache->miss_count * 100) / op_count, + (image_cache->fail_count * 100) / op_count); + NSLOG(netsurf, INFO, + "Cache total/hit/miss/fail (size) %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64" (100%%/%"PRId64"%%/%"PRId64"%%/%"PRId64"%%)", + op_size, + image_cache->hit_size, + image_cache->miss_size, + image_cache->fail_size, + (image_cache->hit_size * 100) / op_size, + (image_cache->miss_size * 100) / op_size, + (image_cache->fail_size * 100) / op_size); } - LOG("Total images never rendered: %d (includes %d that were converted)", - image_cache->total_unrendered, - image_cache->specultive_miss_count); + NSLOG(netsurf, INFO, + "Total images never rendered: %d (includes %d that were converted)", + image_cache->total_unrendered, + image_cache->specultive_miss_count); - LOG("Total number of excessive conversions: %d (from %d images converted more than once)", - image_cache->total_extra_conversions, - image_cache->total_extra_conversions_count); + NSLOG(netsurf, INFO, + "Total number of excessive conversions: %d (from %d images converted more than once)", + image_cache->total_extra_conversions, + image_cache->total_extra_conversions_count); - LOG("Bitmap of size %d had most (%d) conversions", - image_cache->peak_conversions_size, - image_cache->peak_conversions); + NSLOG(netsurf, INFO, "Bitmap of size %d had most (%d) conversions", + image_cache->peak_conversions_size, + image_cache->peak_conversions); free(image_cache); @@ -519,7 +531,8 @@ nserror image_cache_add(struct content *content, centry->bitmap_size = content->width * content->height * 4; } - LOG("centry %p, content %p, bitmap %p", centry, content, bitmap); + NSLOG(netsurf, INFO, "centry %p, content %p, bitmap %p", centry, + content, bitmap); centry->convert = convert; @@ -558,7 +571,8 @@ nserror image_cache_remove(struct content *content) /* get the cache entry */ centry = image_cache__find(content); if (centry == NULL) { - LOG("Could not find cache entry for content (%p)", content); + NSLOG(netsurf, INFO, + "Could not find cache entry for content (%p)", content); return NSERROR_NOT_FOUND; } @@ -788,7 +802,8 @@ bool image_cache_redraw(struct content *c, /* get the cache entry */ centry = image_cache__find(c); if (centry == NULL) { - LOG("Could not find cache entry for content (%p)", c); + NSLOG(netsurf, INFO, + "Could not find cache entry for content (%p)", c); return false; } @@ -827,7 +842,8 @@ void image_cache_destroy(struct content *content) /* get the cache entry */ centry = image_cache__find(content); if (centry == NULL) { - LOG("Could not find cache entry for content (%p)", content); + NSLOG(netsurf, INFO, + "Could not find cache entry for content (%p)", content); } else { image_cache__free_entry(centry); } diff --git a/content/handlers/image/jpeg.c b/content/handlers/image/jpeg.c index c5aca1c9b..44b1c5271 100644 --- a/content/handlers/image/jpeg.c +++ b/content/handlers/image/jpeg.c @@ -142,7 +142,7 @@ static void nsjpeg_term_source(j_decompress_ptr cinfo) static void nsjpeg_error_log(j_common_ptr cinfo) { cinfo->err->format_message(cinfo, nsjpeg_error_buffer); - LOG("%s", nsjpeg_error_buffer); + NSLOG(netsurf, INFO, "%s", nsjpeg_error_buffer); } @@ -156,7 +156,7 @@ static void nsjpeg_error_exit(j_common_ptr cinfo) jmp_buf *setjmp_buffer = (jmp_buf *) cinfo->client_data; cinfo->err->format_message(cinfo, nsjpeg_error_buffer); - LOG("%s", nsjpeg_error_buffer); + NSLOG(netsurf, INFO, "%s", nsjpeg_error_buffer); longjmp(*setjmp_buffer, 1); } diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c index c9fe1b585..269c24356 100644 --- a/content/handlers/image/nssprite.c +++ b/content/handlers/image/nssprite.c @@ -48,10 +48,10 @@ typedef struct nssprite_content { #define ERRCHK(x) do { \ rosprite_error err = x; \ if (err == ROSPRITE_EOF) { \ - LOG("Got ROSPRITE_EOF when loading sprite file"); \ + NSLOG(netsurf, INFO, "Got ROSPRITE_EOF when loading sprite file"); \ goto ro_sprite_error; \ } else if (err == ROSPRITE_BADMODE) { \ - LOG("Got ROSPRITE_BADMODE when loading sprite file"); \ + NSLOG(netsurf, INFO, "Got ROSPRITE_BADMODE when loading sprite file"); \ goto ro_sprite_error; \ } else if (err == ROSPRITE_OK) { \ } else { \ diff --git a/content/handlers/image/png.c b/content/handlers/image/png.c index 288f6c3e4..7a4ce3010 100644 --- a/content/handlers/image/png.c +++ b/content/handlers/image/png.c @@ -74,7 +74,7 @@ enum nspng_cberr { */ static void nspng_warning(png_structp png_ptr, png_const_charp warning_message) { - LOG("%s", warning_message); + NSLOG(netsurf, INFO, "%s", warning_message); } /** @@ -82,7 +82,7 @@ static void nspng_warning(png_structp png_ptr, png_const_charp warning_message) */ static void nspng_error(png_structp png_ptr, png_const_charp error_message) { - LOG("%s", error_message); + NSLOG(netsurf, INFO, "%s", error_message); longjmp(png_jmpbuf(png_ptr), CBERR_LIBPNG); } @@ -175,10 +175,8 @@ static void info_callback(png_structp png_s, png_infop info) png_c->rowbytes = png_get_rowbytes(png_s, info); png_c->interlace = (interlace == PNG_INTERLACE_ADAM7); - LOG("size %li * %li, rowbytes %" PRIsizet, - (unsigned long)width, - (unsigned long)height, - png_c->rowbytes); + NSLOG(netsurf, INFO, "size %li * %li, rowbytes %"PRIsizet, + (unsigned long)width, (unsigned long)height, png_c->rowbytes); } static void row_callback(png_structp png_s, png_bytep new_row, @@ -260,7 +258,7 @@ static nserror nspng_create_png_data(nspng_content *png_c) if (setjmp(png_jmpbuf(png_c->png))) { png_destroy_read_struct(&png_c->png, &png_c->info, 0); - LOG("Failed to set callbacks"); + NSLOG(netsurf, INFO, "Failed to set callbacks"); png_c->png = NULL; png_c->info = NULL; @@ -350,7 +348,8 @@ static bool nspng_process_data(struct content *c, const char *data, * up png conversion and signal the content * error */ - LOG("Fatal PNG error during header, error content"); + NSLOG(netsurf, INFO, + "Fatal PNG error during header, error content"); png_destroy_read_struct(&png_c->png, &png_c->info, 0); png_c->png = NULL; diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c index f6732e23f..ca2d81eeb 100644 --- a/content/handlers/image/rsvg.c +++ b/content/handlers/image/rsvg.c @@ -68,7 +68,7 @@ static nserror rsvg_create_svg_data(rsvg_content *c) c->bitmap = NULL; if ((c->rsvgh = rsvg_handle_new()) == NULL) { - LOG("rsvg_handle_new() returned NULL."); + NSLOG(netsurf, INFO, "rsvg_handle_new() returned NULL."); content_broadcast_errorcode(&c->base, NSERROR_NOMEM); return NSERROR_NOMEM; } @@ -116,7 +116,8 @@ static bool rsvg_process_data(struct content *c, const char *data, if (rsvg_handle_write(d->rsvgh, (const guchar *)data, (gsize)size, &err) == FALSE) { - LOG("rsvg_handle_write returned an error: %s", err->message); + NSLOG(netsurf, INFO, + "rsvg_handle_write returned an error: %s", err->message); content_broadcast_errorcode(c, NSERROR_SVG_ERROR); return false; } @@ -160,7 +161,8 @@ static bool rsvg_convert(struct content *c) GError *err = NULL; if (rsvg_handle_close(d->rsvgh, &err) == FALSE) { - LOG("rsvg_handle_close returned an error: %s", err->message); + NSLOG(netsurf, INFO, + "rsvg_handle_close returned an error: %s", err->message); content_broadcast_errorcode(c, NSERROR_SVG_ERROR); return false; } @@ -177,7 +179,8 @@ static bool rsvg_convert(struct content *c) if ((d->bitmap = guit->bitmap->create(c->width, c->height, BITMAP_NEW)) == NULL) { - LOG("Failed to create bitmap for rsvg render."); + NSLOG(netsurf, INFO, + "Failed to create bitmap for rsvg render."); content_broadcast_errorcode(c, NSERROR_NOMEM); return false; } @@ -187,13 +190,15 @@ static bool rsvg_convert(struct content *c) CAIRO_FORMAT_ARGB32, c->width, c->height, guit->bitmap->get_rowstride(d->bitmap))) == NULL) { - LOG("Failed to create Cairo image surface for rsvg render."); + NSLOG(netsurf, INFO, + "Failed to create Cairo image surface for rsvg render."); content_broadcast_errorcode(c, NSERROR_NOMEM); return false; } if ((d->ct = cairo_create(d->cs)) == NULL) { - LOG("Failed to create Cairo drawing context for rsvg render."); + NSLOG(netsurf, INFO, + "Failed to create Cairo drawing context for rsvg render."); content_broadcast_errorcode(c, NSERROR_NOMEM); return false; } |