< prev index next >

src/java.desktop/share/native/libsplashscreen/libpng/pngget.c

Print this page




  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 /* pngget.c - retrieval of values from info struct
  26  *
  27  * This file is available under and governed by the GNU General Public
  28  * License version 2 only, as published by the Free Software Foundation.
  29  * However, the following notice accompanied the original version of this
  30  * file and, per its terms, should not be removed:
  31  *
  32  * Last changed in libpng 1.6.17 [March 26, 2015]
  33  * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
  34  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  35  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  36  *
  37  * This code is released under the libpng license.
  38  * For conditions of distribution and use, see the disclaimer
  39  * and license in png.h
  40  *
  41  */
  42 
  43 #include "pngpriv.h"
  44 
  45 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
  46 
  47 png_uint_32 PNGAPI
  48 png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
  49     png_uint_32 flag)
  50 {
  51    if (png_ptr != NULL && info_ptr != NULL)
  52       return(info_ptr->valid & flag);
  53 


 349     * .00000110100000001001110101001001
 350     */
 351    png_uint_32 t1001, t1101;
 352    ppm >>= 1;                  /* .1 */
 353    t1001 = ppm + (ppm >> 3);   /* .1001 */
 354    t1101 = t1001 + (ppm >> 1); /* .1101 */
 355    ppm >>= 20;                 /* .000000000000000000001 */
 356    t1101 += t1101 >> 15;       /* .1101000000000001101 */
 357    t1001 >>= 11;               /* .000000000001001 */
 358    t1001 += t1001 >> 12;       /* .000000000001001000000001001 */
 359    ppm += t1001;               /* .000000000001001000001001001 */
 360    ppm += t1101;               /* .110100000001001110101001001 */
 361    return (ppm + 16) >> 5;/* .00000110100000001001110101001001 */
 362 #else
 363    /* The argument is a PNG unsigned integer, so it is not permitted
 364     * to be bigger than 2^31.
 365     */
 366    png_fixed_point result;
 367    if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
 368        5000) != 0)
 369       return result;
 370 
 371    /* Overflow. */
 372    return 0;
 373 #endif
 374 }
 375 
 376 png_uint_32 PNGAPI
 377 png_get_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
 378 {
 379    return ppi_from_ppm(png_get_pixels_per_meter(png_ptr, info_ptr));
 380 }
 381 
 382 png_uint_32 PNGAPI
 383 png_get_x_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
 384 {
 385    return ppi_from_ppm(png_get_x_pixels_per_meter(png_ptr, info_ptr));
 386 }
 387 
 388 png_uint_32 PNGAPI
 389 png_get_y_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)




  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 /* pngget.c - retrieval of values from info struct
  26  *
  27  * This file is available under and governed by the GNU General Public
  28  * License version 2 only, as published by the Free Software Foundation.
  29  * However, the following notice accompanied the original version of this
  30  * file and, per its terms, should not be removed:
  31 
  32  * Last changed in libpng 1.6.26 [October 20, 2016]
  33  * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  34  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  35  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  36  *
  37  * This code is released under the libpng license.
  38  * For conditions of distribution and use, see the disclaimer
  39  * and license in png.h
  40  *
  41  */
  42 
  43 #include "pngpriv.h"
  44 
  45 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
  46 
  47 png_uint_32 PNGAPI
  48 png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
  49     png_uint_32 flag)
  50 {
  51    if (png_ptr != NULL && info_ptr != NULL)
  52       return(info_ptr->valid & flag);
  53 


 349     * .00000110100000001001110101001001
 350     */
 351    png_uint_32 t1001, t1101;
 352    ppm >>= 1;                  /* .1 */
 353    t1001 = ppm + (ppm >> 3);   /* .1001 */
 354    t1101 = t1001 + (ppm >> 1); /* .1101 */
 355    ppm >>= 20;                 /* .000000000000000000001 */
 356    t1101 += t1101 >> 15;       /* .1101000000000001101 */
 357    t1001 >>= 11;               /* .000000000001001 */
 358    t1001 += t1001 >> 12;       /* .000000000001001000000001001 */
 359    ppm += t1001;               /* .000000000001001000001001001 */
 360    ppm += t1101;               /* .110100000001001110101001001 */
 361    return (ppm + 16) >> 5;/* .00000110100000001001110101001001 */
 362 #else
 363    /* The argument is a PNG unsigned integer, so it is not permitted
 364     * to be bigger than 2^31.
 365     */
 366    png_fixed_point result;
 367    if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
 368        5000) != 0)
 369       return (png_uint_32)result;
 370 
 371    /* Overflow. */
 372    return 0;
 373 #endif
 374 }
 375 
 376 png_uint_32 PNGAPI
 377 png_get_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
 378 {
 379    return ppi_from_ppm(png_get_pixels_per_meter(png_ptr, info_ptr));
 380 }
 381 
 382 png_uint_32 PNGAPI
 383 png_get_x_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
 384 {
 385    return ppi_from_ppm(png_get_x_pixels_per_meter(png_ptr, info_ptr));
 386 }
 387 
 388 png_uint_32 PNGAPI
 389 png_get_y_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)


< prev index next >