1 /* Copyright (C) 2010-2018 The RetroArch team 2 * 3 * --------------------------------------------------------------------------------------- 4 * The following license statement only applies to this file (rpng_internal.h). 5 * --------------------------------------------------------------------------------------- 6 * 7 * Permission is hereby granted, free of charge, 8 * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 * to deal in the Software without restriction, including without limitation the rights to 10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 23 #ifndef _RPNG_COMMON_H 24 #define _RPNG_COMMON_H 25 26 #include <stdint.h> 27 #include <filters.h> 28 #include <formats/rpng.h> 29 30 #undef GOTO_END_ERROR 31 #define GOTO_END_ERROR() do { \ 32 fprintf(stderr, "[RPNG]: Error in line %d.\n", __LINE__); \ 33 ret = false; \ 34 goto end; \ 35 } while(0) 36 37 #ifndef ARRAY_SIZE 38 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) 39 #endif 40 41 static const uint8_t png_magic[8] = { 42 0x89, 'P', 'N', 'G', 0x0d, 0x0a, 0x1a, 0x0a, 43 }; 44 45 struct png_ihdr 46 { 47 uint32_t width; 48 uint32_t height; 49 uint8_t depth; 50 uint8_t color_type; 51 uint8_t compression; 52 uint8_t filter; 53 uint8_t interlace; 54 }; 55 56 #endif 57