Mercurial > hg > dmlib
comparison tools/lib64fmts.c @ 2114:27cf33c3a646
Return actual error code from enc and dec functions instead of just BOOL.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 26 May 2019 02:43:08 +0300 |
parents | 3fcf1c3a3287 |
children | 88d37ec1b4d6 |
comparison
equal
deleted
inserted
replaced
2113:3fcf1c3a3287 | 2114:27cf33c3a646 |
---|---|
45 | 45 |
46 return DM_PROBE_SCORE_FALSE; | 46 return DM_PROBE_SCORE_FALSE; |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 static BOOL fmtEncodeMicroIllustrator(const DMC64EncDecOp *op, DMGrowBuf *buf, | 50 static int fmtEncodeMicroIllustrator(const DMC64EncDecOp *op, DMGrowBuf *buf, |
51 const DMC64Image *img, const DMC64ImageCommonFormat *fmt) | 51 const DMC64Image *img, const DMC64ImageCommonFormat *fmt) |
52 { | 52 { |
53 (void) op; | 53 (void) op; |
54 (void) img; | 54 (void) img; |
55 (void) fmt; | 55 (void) fmt; |
56 | 56 |
57 memcpy(buf->data + 2, fmtMicroIllustratorMagicID_1, sizeof(fmtMicroIllustratorMagicID_1)); | 57 memcpy(buf->data + 2, fmtMicroIllustratorMagicID_1, sizeof(fmtMicroIllustratorMagicID_1)); |
58 memcpy(buf->data + 9, fmtMicroIllustratorMagicID_2, sizeof(fmtMicroIllustratorMagicID_2)); | 58 memcpy(buf->data + 9, fmtMicroIllustratorMagicID_2, sizeof(fmtMicroIllustratorMagicID_2)); |
59 | 59 |
60 return TRUE; | 60 return DMERR_OK; |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 static int fmtProbeKoalaPainter(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) | 64 static int fmtProbeKoalaPainter(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) |
65 { | 65 { |
240 | 240 |
241 return DM_PROBE_SCORE_FALSE; | 241 return DM_PROBE_SCORE_FALSE; |
242 } | 242 } |
243 | 243 |
244 | 244 |
245 static BOOL fmtDrazLaceGetLaceType(const DMC64EncDecOp *op, DMC64Image *img, | 245 static int fmtDrazLaceGetLaceType(const DMC64EncDecOp *op, DMC64Image *img, |
246 const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt) | 246 const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt) |
247 { | 247 { |
248 (void) fmt; | 248 (void) fmt; |
249 | 249 |
250 if (buf != NULL) | 250 if (buf != NULL) |
251 img->laceType = buf->data[op->offs] ? D64_ILACE_RES : D64_ILACE_COLOR; | 251 img->laceType = buf->data[op->offs] ? D64_ILACE_RES : D64_ILACE_COLOR; |
252 else | 252 else |
253 img->laceType = D64_ILACE_RES; | 253 img->laceType = D64_ILACE_RES; |
254 | 254 |
255 return TRUE; | 255 return DMERR_OK; |
256 } | 256 } |
257 | 257 |
258 | 258 |
259 static BOOL fmtDrazLaceSetLaceType(const DMC64EncDecOp *op, DMGrowBuf *buf, | 259 static int fmtDrazLaceSetLaceType(const DMC64EncDecOp *op, DMGrowBuf *buf, |
260 const DMC64Image *img, const DMC64ImageCommonFormat *fmt) | 260 const DMC64Image *img, const DMC64ImageCommonFormat *fmt) |
261 { | 261 { |
262 (void) fmt; | 262 (void) fmt; |
263 buf->data[op->offs] = (img->laceType == D64_ILACE_RES) ? 1 : 0; | 263 buf->data[op->offs] = (img->laceType == D64_ILACE_RES) ? 1 : 0; |
264 return TRUE; | 264 return DMERR_OK; |
265 } | 265 } |
266 | 266 |
267 | 267 |
268 static const char *fmtBDP5MagicID = "BDP 5.00"; | 268 static const char *fmtBDP5MagicID = "BDP 5.00"; |
269 | 269 |
362 | 362 |
363 return DM_PROBE_SCORE_FALSE; | 363 return DM_PROBE_SCORE_FALSE; |
364 } | 364 } |
365 | 365 |
366 | 366 |
367 static BOOL fmtEncodeGunPaint(const DMC64EncDecOp *op, DMGrowBuf *buf, | 367 static int fmtEncodeGunPaint(const DMC64EncDecOp *op, DMGrowBuf *buf, |
368 const DMC64Image *img, const DMC64ImageCommonFormat *fmt) | 368 const DMC64Image *img, const DMC64ImageCommonFormat *fmt) |
369 { | 369 { |
370 (void) op; | 370 (void) op; |
371 (void) img; | 371 (void) img; |
372 (void) fmt; | 372 (void) fmt; |
373 | |
373 // Here we assume that the op triggering this function is | 374 // Here we assume that the op triggering this function is |
374 // at the end of the oplist, so the memory is allocated, | 375 // at the end of the oplist, so the memory is allocated, |
375 memcpy(buf->data + fmtGunPaintMagicOffs + 2, fmtGunPaintMagicID, fmtGunPaintMagicLen); | 376 memcpy(buf->data + fmtGunPaintMagicOffs + 2, fmtGunPaintMagicID, fmtGunPaintMagicLen); |
376 return TRUE; | 377 |
378 return DMERR_OK; | |
377 } | 379 } |
378 | 380 |
379 | 381 |
380 static int fmtProbeAmicaPaintPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) | 382 static int fmtProbeAmicaPaintPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) |
381 { | 383 { |
575 vbank, bitmap, 0, | 577 vbank, bitmap, 0, |
576 img->extraData[0].data[rasterY] & 15); | 578 img->extraData[0].data[rasterY] & 15); |
577 } | 579 } |
578 | 580 |
579 | 581 |
580 static BOOL fmtTruePaintGetLaceType(const DMC64EncDecOp *op, DMC64Image *img, | 582 static int fmtTruePaintGetLaceType(const DMC64EncDecOp *op, DMC64Image *img, |
581 const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt) | 583 const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt) |
582 { | 584 { |
583 (void) op; | 585 (void) op; |
584 (void) buf; | 586 (void) buf; |
585 (void) fmt; | 587 (void) fmt; |
586 img->laceType = D64_ILACE_RES; | 588 img->laceType = D64_ILACE_RES; |
587 return TRUE; | 589 return DMERR_OK; |
588 } | 590 } |
589 | 591 |
590 | 592 |
591 static Uint8 fmtGetPixelTruePaint( | 593 static Uint8 fmtGetPixelTruePaint( |
592 const DMC64Image *img, const int bmoffs, const int scroffs, | 594 const DMC64Image *img, const int bmoffs, const int scroffs, |
959 (void) rasterX; | 961 (void) rasterX; |
960 return dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, rasterY & 7, bitmap, 0); | 962 return dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, rasterY & 7, bitmap, 0); |
961 } | 963 } |
962 | 964 |
963 | 965 |
964 static BOOL fmtECIGetLaceType(const DMC64EncDecOp *op, DMC64Image *img, | 966 static int fmtECIGetLaceType(const DMC64EncDecOp *op, DMC64Image *img, |
965 const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt) | 967 const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt) |
966 { | 968 { |
967 (void) op; | 969 (void) op; |
968 (void) buf; | 970 (void) buf; |
969 (void) fmt; | 971 (void) fmt; |
970 img->laceType = D64_ILACE_COLOR; | 972 img->laceType = D64_ILACE_COLOR; |
971 return TRUE; | 973 return DMERR_OK; |
972 } | 974 } |
973 | 975 |
974 | 976 |
975 static Uint8 fmtGetPixelECI( | 977 static Uint8 fmtGetPixelECI( |
976 const DMC64Image *img, const int bmoffs, const int scroffs, | 978 const DMC64Image *img, const int bmoffs, const int scroffs, |