NetSurf
|
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <png.h>
#include "netsurf/inttypes.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/bitmap.h"
#include "content/llcache.h"
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
#include "desktop/bitmap.h"
#include "image/image_cache.h"
Go to the source code of this file.
Data Structures | |
struct | nspng_content |
struct | png_cache_read_data_s |
Macros | |
#define | png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) |
#define | png_set_expand_gray_1_2_4_to_8(png) png_set_gray_1_2_4_to_8(png) |
Typedefs | |
typedef struct nspng_content | nspng_content |
Enumerations | |
enum | nspng_cberr { CBERR_NONE = 0 , CBERR_LIBPNG , CBERR_NOPRE } |
Callbak error numbers. More... | |
Functions | |
static void | nspng_warning (png_structp png_ptr, png_const_charp warning_message) |
nspng_warning – callback for libpng warnings More... | |
static void | nspng_error (png_structp png_ptr, png_const_charp error_message) |
nspng_error – callback for libpng errors More... | |
static void | nspng_setup_transforms (png_structp png_ptr, png_infop info_ptr) |
static void | info_callback (png_structp png_s, png_infop info) |
info_callback – PNG header has been completely received, prepare to process image data More... | |
static void | row_callback (png_structp png_s, png_bytep new_row, png_uint_32 row_num, int pass) |
static void | end_callback (png_structp png_s, png_infop info) |
static nserror | nspng_create_png_data (nspng_content *png_c) |
static nserror | nspng_create (const content_handler *handler, lwc_string *imime_type, const struct http_parameter *params, struct llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c) |
static bool | nspng_process_data (struct content *c, const char *data, unsigned int size) |
static void | png_cache_read_fn (png_structp png_ptr, png_bytep data, png_size_t length) |
PNG library read fucntion to read data from a memory array. More... | |
static png_bytep * | calc_row_pointers (struct bitmap *bitmap) |
calculate an array of row pointers into a bitmap data area More... | |
static struct bitmap * | png_cache_convert (struct content *c) |
PNG content to bitmap conversion. More... | |
static bool | nspng_convert (struct content *c) |
static nserror | nspng_clone (const struct content *old_c, struct content **new_c) |
CONTENT_FACTORY_REGISTER_TYPES (nspng, nspng_types, nspng_content_handler) | |
Variables | |
static unsigned int | interlace_start [8] = {0, 16, 0, 8, 0, 4, 0} |
static unsigned int | interlace_step [8] = {28, 28, 12, 12, 4, 4, 0} |
static unsigned int | interlace_row_start [8] = {0, 0, 4, 0, 2, 0, 1} |
static unsigned int | interlace_row_step [8] = {8, 8, 8, 4, 4, 2, 2} |
static const content_handler | nspng_content_handler |
static const char * | nspng_types [] |
#define png_set_expand_gray_1_2_4_to_8 | ( | png | ) | png_set_gray_1_2_4_to_8(png) |
typedef struct nspng_content nspng_content |
enum nspng_cberr |
|
static |
calculate an array of row pointers into a bitmap data area
Definition at line 430 of file png.c.
References netsurf_table::bitmap, buffer, gui_bitmap_table::get_buffer, gui_bitmap_table::get_height, gui_bitmap_table::get_rowstride, guit, and height.
Referenced by png_cache_convert().
CONTENT_FACTORY_REGISTER_TYPES | ( | nspng | , |
nspng_types | , | ||
nspng_content_handler | |||
) |
|
static |
Definition at line 267 of file png.c.
Referenced by nspng_create_png_data().
|
static |
info_callback – PNG header has been completely received, prepare to process image data
Definition at line 176 of file png.c.
References nspng_content::base, nspng_content::bitmap, netsurf_table::bitmap, BITMAP_NONE, nspng_content::bpp, CBERR_NOPRE, gui_bitmap_table::create, gui_bitmap_table::get_rowstride, guit, content::height, height, image_cache_speculate(), nspng_content::interlace, NSLOG, nspng_setup_transforms(), png_jmpbuf, PRIsizet, nspng_content::rowbytes, nspng_content::rowstride, content::size, content::width, and width.
Referenced by nspng_create_png_data().
Definition at line 593 of file png.c.
References nspng_content::base, content__clone(), content__get_source_data(), content_destroy(), CONTENT_STATUS_DONE, CONTENT_STATUS_READY, png_cache_read_data_s::data, NSERROR_CLONE_FAILED, NSERROR_NOMEM, NSERROR_OK, nspng_convert(), nspng_create_png_data(), nspng_process_data(), png_cache_read_data_s::size, and content::status.
|
static |
Definition at line 553 of file png.c.
References nspng_content::bitmap, netsurf_table::bitmap, bitmap_format_to_client(), bitmap_test_opaque(), content__set_title(), content_set_done(), content_set_ready(), content_set_status(), guit, content::height, image_cache_add(), nspng_content::info, content::llcache, llcache_handle_get_url(), messages_get_buff(), gui_bitmap_table::modified, nsurl_access_leaf(), nspng_content::png, png_cache_convert(), gui_bitmap_table::set_opaque, and content::width.
Referenced by nspng_clone().
|
static |
Definition at line 308 of file png.c.
References nspng_content::base, content__init(), llcache, NSERROR_NOMEM, NSERROR_OK, and nspng_create_png_data().
|
static |
Definition at line 271 of file png.c.
References nspng_content::base, nspng_content::bitmap, content_broadcast_error(), end_callback(), nspng_content::info, info_callback(), NSERROR_NOMEM, NSERROR_OK, NSERROR_PNG_ERROR, NSLOG, nspng_error(), nspng_warning(), nspng_content::png, png_jmpbuf, and row_callback().
Referenced by nspng_clone(), and nspng_create().
|
static |
nspng_error – callback for libpng errors
Definition at line 86 of file png.c.
References CBERR_LIBPNG, NSLOG, and png_jmpbuf.
Referenced by nspng_create_png_data(), and png_cache_convert().
|
static |
Definition at line 347 of file png.c.
References nspng_content::bitmap, CBERR_NONE, CBERR_NOPRE, content_broadcast_error(), nspng_content::info, nspng_content::no_process_data, NSERROR_PNG_ERROR, NSLOG, nspng_content::png, png_jmpbuf, and content::size.
Referenced by nspng_clone().
|
static |
Definition at line 92 of file png.c.
References BITMAP_LAYOUT_A8B8G8R8, BITMAP_LAYOUT_A8R8G8B8, BITMAP_LAYOUT_B8G8R8A8, bitmap_fmt::layout, and png_set_expand_gray_1_2_4_to_8.
Referenced by info_callback(), and png_cache_convert().
|
static |
nspng_warning – callback for libpng warnings
Definition at line 78 of file png.c.
References NSLOG.
Referenced by nspng_create_png_data(), and png_cache_convert().
PNG content to bitmap conversion.
This routine generates a bitmap object from a PNG image content
Definition at line 461 of file png.c.
References netsurf_table::bitmap, bitmap(), bitmap_format_to_client(), BITMAP_NONE, bitmap_test_opaque(), calc_row_pointers(), content__get_source_data(), gui_bitmap_table::create, png_cache_read_data_s::data, gui_bitmap_table::destroy, guit, height, bitmap_fmt::layout, gui_bitmap_table::modified, nspng_error(), nspng_setup_transforms(), nspng_warning(), bitmap_fmt::pma, png_cache_read_fn(), png_jmpbuf, gui_bitmap_table::set_opaque, png_cache_read_data_s::size, and width.
Referenced by nspng_convert().
|
static |
PNG library read fucntion to read data from a memory array.
Definition at line 409 of file png.c.
References png_cache_read_data_s::data, and png_cache_read_data_s::size.
Referenced by png_cache_convert().
|
static |
Definition at line 214 of file png.c.
References nspng_content::bitmap, netsurf_table::bitmap, buffer, gui_bitmap_table::get_buffer, guit, nspng_content::interlace, interlace_row_start, interlace_row_step, interlace_start, interlace_step, png_jmpbuf, nspng_content::rowbytes, and nspng_content::rowstride.
Referenced by nspng_create_png_data().
|
static |
Definition at line 65 of file png.c.
Referenced by row_callback().
|
static |
Definition at line 66 of file png.c.
Referenced by row_callback().
|
static |
Definition at line 63 of file png.c.
Referenced by row_callback().
|
static |
Definition at line 64 of file png.c.
Referenced by row_callback().
|
static |