X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=pngwrite.c;h=4328f69c29ae8b6929299fc520a09f760d60511e;hb=6f1d4d9e2434fdc38ff64bce5cff59c7698540b6;hp=4e58d776a965475464ffd70ccd99bcb71ddc58a8;hpb=f125affdc66153880ba8dc33d8369e5a0dc9a6a7;p=platform%2Fupstream%2Flibpng.git diff --git a/pngwrite.c b/pngwrite.c index 4e58d77..4328f69 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -128,6 +128,10 @@ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr) * the application continues writing the PNG. So check the 'invalid' * flag here too. */ +#ifdef PNG_WRITE_APNG_SUPPORTED + if (info_ptr->valid & PNG_INFO_acTL) + png_write_acTL(png_ptr, info_ptr->num_frames, info_ptr->num_plays); +#endif #ifdef PNG_GAMMA_SUPPORTED # ifdef PNG_WRITE_gAMA_SUPPORTED if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 && @@ -370,6 +374,11 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) png_benign_error(png_ptr, "Wrote palette index exceeding num_palette"); #endif +#ifdef PNG_WRITE_APNG_SUPPORTED + if (png_ptr->num_frames_written != png_ptr->num_frames_to_write) + png_error(png_ptr, "Not enough frames written"); +#endif + /* See if user wants us to write information chunks */ if (info_ptr != NULL) { @@ -1030,10 +1039,38 @@ png_set_filter(png_structrp png_ptr, int method, int filters) case 7: png_app_error(png_ptr, "Unknown row filter for method 0"); #endif /* WRITE_FILTER */ /* FALLTHROUGH */ +#ifdef __TIZEN__ + /* 'switch ~ case' is dead code. + * If filters is #PNG_FILTER_VALUE_NONE, #PNG_FILTER_VALUE_SUB ..., + * filter flag will be assigned to 'png_ptr->do_filter'. But + * 'png_ptr->do_filter' is overwritten as 'filters' at below code. + * Issue code(#1155) is 'png_ptr->do_filter = (png_byte)filters;'. + * So the result of 'switch ~ case' has been lost at the line. + * To keep the value of 'switch ~ case', we fixed it to apply + * the result into 'filters'. + * It will be updated into 'png_ptr->do_filter' at #1155 line. + */ + case PNG_FILTER_VALUE_NONE: + filters = PNG_FILTER_NONE; break; +#else case PNG_FILTER_VALUE_NONE: png_ptr->do_filter = PNG_FILTER_NONE; break; +#endif /* __TIZEN__ */ #ifdef PNG_WRITE_FILTER_SUPPORTED +#ifdef __TIZEN__ + case PNG_FILTER_VALUE_SUB: + filters = PNG_FILTER_SUB; break; + + case PNG_FILTER_VALUE_UP: + filters = PNG_FILTER_UP; break; + + case PNG_FILTER_VALUE_AVG: + filters = PNG_FILTER_AVG; break; + + case PNG_FILTER_VALUE_PAETH: + filters = PNG_FILTER_PAETH; break; +#else case PNG_FILTER_VALUE_SUB: png_ptr->do_filter = PNG_FILTER_SUB; break; @@ -1045,7 +1082,7 @@ png_set_filter(png_structrp png_ptr, int method, int filters) case PNG_FILTER_VALUE_PAETH: png_ptr->do_filter = PNG_FILTER_PAETH; break; - +#endif /* __TIZEN__ */ default: png_ptr->do_filter = (png_byte)filters; break; #else @@ -1471,6 +1508,43 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr, } #endif +#ifdef PNG_WRITE_APNG_SUPPORTED +void PNGAPI +png_write_frame_head(png_structp png_ptr, png_infop info_ptr, + png_bytepp row_pointers, png_uint_32 width, png_uint_32 height, + png_uint_32 x_offset, png_uint_32 y_offset, + png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op, + png_byte blend_op) +{ + png_debug(1, "in png_write_frame_head"); + + /* there is a chance this has been set after png_write_info was called, + * so it would be set but not written. is there a way to be sure? */ + if (!(info_ptr->valid & PNG_INFO_acTL)) + png_error(png_ptr, "png_write_frame_head(): acTL not set"); + + png_write_reset(png_ptr); + + png_write_reinit(png_ptr, info_ptr, width, height); + + if ( !(png_ptr->num_frames_written == 0 && + (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) ) ) + png_write_fcTL(png_ptr, width, height, x_offset, y_offset, + delay_num, delay_den, dispose_op, blend_op); + + PNG_UNUSED(row_pointers) +} + +void PNGAPI +png_write_frame_tail(png_structp png_ptr, png_infop info_ptr) +{ + png_debug(1, "in png_write_frame_tail"); + + png_ptr->num_frames_written++; + + PNG_UNUSED(info_ptr) +} +#endif /* PNG_WRITE_APNG_SUPPORTED */ #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED /* Initialize the write structure - general purpose utility. */