From 0022fc4ec755c6ce4cdef1c70fa49bbbd2d5c196 Mon Sep 17 00:00:00 2001 From: yoya Date: Sat, 30 Oct 2010 13:44:02 +0000 Subject: [PATCH] =?utf8?q?Jpeg=20|=20GIF,PNG=20=E3=81=A7=20tag=20=E3=81=AE?= =?utf8?q?=E7=95=B0=E3=81=AA=E3=82=8B=E6=96=B9=E3=81=AB=E5=85=A5=E3=82=8C?= =?utf8?q?=E6=9B=BF=E3=81=88=E3=82=8B=E9=9A=9B=E3=81=AB=20tag=20=E3=82=92?= =?utf8?q?=E5=A4=89=E6=8F=9B=E3=81=97=E5=88=87=E3=82=8C=E3=81=A6=E3=81=AA?= =?utf8?q?=E3=81=84=E4=B8=8D=E5=85=B7=E5=90=88=E3=82=92=E4=BF=AE=E6=AD=A3?= =?utf8?q?=E3=80=82=20(=E5=8F=A4=E3=81=84=20tag=20=E3=81=A7=20detail=20obj?= =?utf8?q?ect=20=E3=82=92=20create=20=E3=81=97=E3=81=A6=E3=81=9F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/swfed/trunk@328 7c90b180-03d5-4157-b861-58a559ae9d1e --- src/swf_tag.c | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/swf_tag.c b/src/swf_tag.c index f64035a..5e33aac 100644 --- a/src/swf_tag.c +++ b/src/swf_tag.c @@ -386,25 +386,24 @@ swf_tag_replace_jpeg_data(swf_tag_t *tag, int image_id, if (! isBitmapTag(tag->tag)) { return 1; } - tag_info = get_swf_tag_info(tag->tag); + tag_info = get_swf_tag_info(tag->tag); // Bitmap Tag detail_handler = tag_info->detail_handler(); if (detail_handler->identity(tag, image_id)) { return 1; } - /* - if (tag->detail) { + + if (tag->detail && (! isBitsJPEGTag(tag->tag))) { detail_handler->destroy(tag); tag->detail = NULL; } - */ if (alpha_data && (alpha_data_len > 0)) { - tag->tag = 35; + tag->tag = 35; // DefineBitsJPEG3 } else { - if (tag->tag != 6) { - tag->tag = 21; - } + tag->tag = 21; // DefineBitsJPEG2 } - + + tag_info = get_swf_tag_info(tag->tag); // JPEG Tag + detail_handler = tag_info->detail_handler(); if (tag->detail == NULL) { tag->detail = detail_handler->create(); } @@ -462,24 +461,28 @@ swf_tag_replace_png_data(swf_tag_t *tag, int image_id, if (! isBitmapTag(tag->tag)) { return 1; } - tag_info = get_swf_tag_info(tag->tag); + tag_info = get_swf_tag_info(tag->tag); // Bitmap Tag detail_handler = tag_info->detail_handler(); if (detail_handler->identity(tag, image_id)) { return 1; } - if (tag->detail) { + + if (tag->detail && (! isBitsLosslessTag(tag->tag))) { detail_handler->destroy(tag); tag->detail = NULL; } if (tag->tag == 20) { - tag->tag = 20; + tag->tag = 20; // DefineBitsLossless } else { - tag->tag = 36; + tag->tag = 36; // DefineBitsLossless2 } - tag_info = get_swf_tag_info(tag->tag); + tag_info = get_swf_tag_info(tag->tag); // Lossless Tag detail_handler = tag_info->detail_handler(); - tag->detail = detail_handler->create(); + if (tag->detail == NULL) { + tag->detail = detail_handler->create(); + } + result= swf_tag_lossless_replace_png_data(tag->detail, image_id, png_data, png_data_len, tag); if (result == 0) { @@ -511,24 +514,28 @@ swf_tag_replace_gif_data(swf_tag_t *tag, int image_id, if (! isBitmapTag(tag->tag)) { return 1; } - tag_info = get_swf_tag_info(tag->tag); + tag_info = get_swf_tag_info(tag->tag); // Bitmap Tag detail_handler = tag_info->detail_handler(); if (detail_handler->identity(tag, image_id)) { return 1; } - if (tag->detail) { + + if (tag->detail && (! isBitsLosslessTag(tag->tag))) { detail_handler->destroy(tag); tag->detail = NULL; } if (tag->tag == 20) { - tag->tag = 20; + tag->tag = 20; // DefineBitsLossless } else { - tag->tag = 36; + tag->tag = 36; // DefineBitsLossless2 } - tag_info = get_swf_tag_info(tag->tag); + tag_info = get_swf_tag_info(tag->tag); // Lossless Tag detail_handler = tag_info->detail_handler(); - tag->detail = detail_handler->create(); + if (tag->detail == NULL) { + tag->detail = detail_handler->create(); + } + result= swf_tag_lossless_replace_gif_data(tag->detail, image_id, gif_data, gif_data_len, tag); if (result == 0) { -- 2.11.0