33
34 void PNGAPI
35 my_png_read_stream(png_structp png_ptr, png_bytep data, png_size_t length)
36 {
37 png_uint_32 check;
38
39 SplashStream * stream = (SplashStream*)png_get_io_ptr(png_ptr);
40 check = stream->read(stream, data, length);
41 if (check != length)
42 png_error(png_ptr, "Read Error");
43 }
44
45 int
46 SplashDecodePng(Splash * splash, png_rw_ptr read_func, void *io_ptr)
47 {
48 int stride;
49 ImageFormat srcFormat;
50 png_uint_32 i, rowbytes;
51 volatile png_bytepp row_pointers = NULL;
52 volatile png_bytep image_data = NULL;
53 int success = 0;
54 double gamma;
55
56 png_structp png_ptr = NULL;
57 png_infop info_ptr = NULL;
58
59 png_uint_32 width, height;
60 int bit_depth, color_type;
61
62 ImageRect srcRect, dstRect;
63
64 png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
65 if (!png_ptr) {
66 goto done;
67 }
68
69 info_ptr = png_create_info_struct(png_ptr);
70 if (!info_ptr) {
71 goto done;
72 }
73
|
33
34 void PNGAPI
35 my_png_read_stream(png_structp png_ptr, png_bytep data, png_size_t length)
36 {
37 png_uint_32 check;
38
39 SplashStream * stream = (SplashStream*)png_get_io_ptr(png_ptr);
40 check = stream->read(stream, data, length);
41 if (check != length)
42 png_error(png_ptr, "Read Error");
43 }
44
45 int
46 SplashDecodePng(Splash * splash, png_rw_ptr read_func, void *io_ptr)
47 {
48 int stride;
49 ImageFormat srcFormat;
50 png_uint_32 i, rowbytes;
51 volatile png_bytepp row_pointers = NULL;
52 volatile png_bytep image_data = NULL;
53 volatile int success = 0;
54 double gamma;
55
56 png_structp png_ptr = NULL;
57 png_infop info_ptr = NULL;
58
59 png_uint_32 width, height;
60 int bit_depth, color_type;
61
62 ImageRect srcRect, dstRect;
63
64 png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
65 if (!png_ptr) {
66 goto done;
67 }
68
69 info_ptr = png_create_info_struct(png_ptr);
70 if (!info_ptr) {
71 goto done;
72 }
73
|