mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.0.9beta6.tar
This commit is contained in:
23
pngwrite.c
23
pngwrite.c
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* libpng 1.0.9beta5 - December 15, 2000
|
||||
* libpng 1.0.9beta6 - December 18, 2000
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@@ -28,6 +28,13 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
|
||||
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
|
||||
{
|
||||
png_write_sig(png_ptr); /* write PNG signature */
|
||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||
if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted))
|
||||
{
|
||||
png_warning(png_ptr,"MNG features are not allowed in a PNG datastream\n");
|
||||
png_ptr->mng_features_permitted=0;
|
||||
}
|
||||
#endif
|
||||
/* write IHDR information. */
|
||||
png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
|
||||
info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
|
||||
@@ -774,6 +781,15 @@ png_write_row(png_structp png_ptr, png_bytep row)
|
||||
png_do_write_transformations(png_ptr);
|
||||
|
||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||
/* Write filter_method 64 (intrapixel differencing) only if
|
||||
* 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
|
||||
* 2. Libpng did not write a PNG signature (this filter_method is only
|
||||
* used in PNG datastreams that are embedded in MNG datastreams) and
|
||||
* 3. The application called png_permit_mng_features with a mask that
|
||||
* included PNG_FLAG_MNG_FILTER_64 and
|
||||
* 4. The filter_method is 64 and
|
||||
* 5. The color_type is RGB or RGBA
|
||||
*/
|
||||
if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||
(png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
|
||||
{
|
||||
@@ -977,6 +993,11 @@ void PNGAPI
|
||||
png_set_filter(png_structp png_ptr, int method, int filters)
|
||||
{
|
||||
png_debug(1, "in png_set_filter\n");
|
||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||
if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||
(method == PNG_INTRAPIXEL_DIFFERENCING))
|
||||
method = PNG_FILTER_TYPE_BASE;
|
||||
#endif
|
||||
if (method == PNG_FILTER_TYPE_BASE)
|
||||
{
|
||||
switch (filters & (PNG_ALL_FILTERS | 0x07))
|
||||
|
||||
Reference in New Issue
Block a user