comparison lib64gfx.c @ 514:c9b9f912acfb

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Nov 2012 16:14:07 +0200
parents 486067f39bc1
children a896c1153e4e
comparison
equal deleted inserted replaced
513:486067f39bc1 514:c9b9f912acfb
5 * (C) Copyright 2012 Tecnic Software productions (TNSP) 5 * (C) Copyright 2012 Tecnic Software productions (TNSP)
6 * 6 *
7 * Please read file 'COPYING' for information on license and distribution. 7 * Please read file 'COPYING' for information on license and distribution.
8 */ 8 */
9 #include "lib64gfx.h" 9 #include "lib64gfx.h"
10
11 #define BUF_SIZE_INITIAL (16*1024)
12 #define BUF_SIZE_GROW (4*1024)
10 13
11 14
12 const char *dmC64ImageTypeNames[DM_C64IFMT_LAST_TYPE] = 15 const char *dmC64ImageTypeNames[DM_C64IFMT_LAST_TYPE] =
13 { 16 {
14 "hires", 17 "hires",
51 C64_SCR_EXTRADATA, 54 C64_SCR_EXTRADATA,
52 }; 55 };
53 56
54 57
55 58
59 static BOOL dmCompareAddr16(const Uint8 *buf, const size_t offs, const Uint16 addr)
60 {
61 return (buf[offs] == (addr & 0xff)) && (buf[offs + 1] == ((addr >> 8) & 0xff));
62 }
63
64
56 int dmC64ConvertCSData(DMImage *img, 65 int dmC64ConvertCSData(DMImage *img,
57 int xoffs, int yoffs, const Uint8 *buf, 66 int xoffs, int yoffs, const Uint8 *buf,
58 int width, int height, BOOL multicolor, int *colors) 67 int width, int height, BOOL multicolor, int *colors)
59 { 68 {
60 int yc, widthpx = width * 8; 69 int yc, widthpx = width * 8;
111 dp += img->pitch; 120 dp += img->pitch;
112 } 121 }
113 } 122 }
114 123
115 return 0; 124 return 0;
116 }
117
118
119 static BOOL dmCompareAddr16(const Uint8 *buf, const size_t offs, const Uint16 addr)
120 {
121 return (buf[offs] == (addr & 0xff)) && (buf[offs + 1] == ((addr >> 8) & 0xff));
122 } 125 }
123 126
124 127
125 static int fmtProbeDrazPaint20Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) 128 static int fmtProbeDrazPaint20Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
126 { 129 {
634 return -1; 637 return -1;
635 } 638 }
636 } 639 }
637 640
638 641
639 #define BUF_SIZE_INITIAL (16*1024)
640 #define BUF_SIZE_GROW (8*1024)
641 642
642 int dmReadDataFile(FILE *inFile, const char *filename, Uint8 **pbuf, size_t *pbufSize) 643 int dmReadDataFile(FILE *inFile, const char *filename, Uint8 **pbuf, size_t *pbufSize)
643 { 644 {
644 FILE *f; 645 FILE *f;
645 int res = DMERR_OK; 646 int res = DMERR_OK;