comparison tools/lib64gfx.c @ 2338:ae938889eafb

Make dmC64ConvertGenericBMP2Image() and dmC64ConvertGenericImage2BMP() static.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 23 Sep 2019 11:14:39 +0300
parents 8f4cfe59b2bb
children 2b22a7719a58
comparison
equal deleted inserted replaced
2337:8f4cfe59b2bb 2338:ae938889eafb
1396 } 1396 }
1397 1397
1398 1398
1399 // Convert a C64 format bitmap in DMC64Image struct to 1399 // Convert a C64 format bitmap in DMC64Image struct to
1400 // a indexed/paletted bitmap image. 1400 // a indexed/paletted bitmap image.
1401 int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageConvSpec *spec) 1401 static int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageConvSpec *spec)
1402 { 1402 {
1403 DMC64GetPixelFunc getPixel; 1403 DMC64GetPixelFunc getPixel;
1404 1404
1405 // Sanity check arguments 1405 // Sanity check arguments
1406 if (dst == NULL || src == NULL || spec == NULL) 1406 if (dst == NULL || src == NULL || spec == NULL)
1446 1446
1447 return DMERR_OK; 1447 return DMERR_OK;
1448 } 1448 }
1449 1449
1450 1450
1451 int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *spec) 1451 int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *pspec)
1452 { 1452 {
1453 DMImage *dst; 1453 DMC64ImageConvSpec spec;
1454 BOOL mixed; 1454 BOOL mixed;
1455 int res; 1455 int res;
1456 1456
1457 if (pdst == NULL || src == NULL || spec == NULL) 1457 if (pdst == NULL || src == NULL || pspec == NULL)
1458 return DMERR_NULLPTR; 1458 return DMERR_NULLPTR;
1459 1459
1460 memcpy(&spec, pspec, sizeof(spec));
1461
1460 // Allocate image structure 1462 // Allocate image structure
1461 if ((*pdst = dst = dmImageAlloc( 1463 if ((*pdst = dmImageAlloc(
1462 src->fmt->width, src->fmt->height, DM_PIXFMT_PALETTE, -1)) == NULL) 1464 src->fmt->width, src->fmt->height, DM_PIXFMT_PALETTE, -1)) == NULL)
1463 return DMERR_MALLOC; 1465 return DMERR_MALLOC;
1464 1466
1465 // Set palette information 1467 // Set palette information
1466 mixed = (src->extraInfo[D64_EI_MODE] & D64_FMT_ILACE) && 1468 mixed = (src->extraInfo[D64_EI_MODE] & D64_FMT_ILACE) &&
1467 src->extraInfo[D64_EI_ILACE_TYPE] == D64_ILACE_COLOR; 1469 src->extraInfo[D64_EI_ILACE_TYPE] == D64_ILACE_COLOR;
1468 1470
1469 if ((res = dmC64SetImagePalette(dst, spec, mixed)) != DMERR_OK) 1471 if ((res = dmC64SetImagePalette(*pdst, &spec, mixed)) != DMERR_OK)
1470 return res; 1472 return res;
1471 1473
1472 // Convert 1474 // Convert
1473 if (src->fmt->convertFrom != NULL) 1475 if (src->fmt->convertFrom != NULL)
1474 res = src->fmt->convertFrom(dst, src, spec); 1476 res = src->fmt->convertFrom(*pdst, src, &spec);
1475 else 1477 else
1476 res = dmC64ConvertGenericBMP2Image(dst, src, spec); 1478 res = dmC64ConvertGenericBMP2Image(*pdst, src, &spec);
1477 1479
1478 return res; 1480 return res;
1479 } 1481 }
1480 1482
1481 1483
1543 return DMERR_OK; 1545 return DMERR_OK;
1544 } 1546 }
1545 1547
1546 1548
1547 // Convert a generic bitmap image to DMC64Image 1549 // Convert a generic bitmap image to DMC64Image
1548 int dmC64ConvertGenericImage2BMP(DMC64Image *dst, const DMImage *src, 1550 static int dmC64ConvertGenericImage2BMP(DMC64Image *dst, const DMImage *src,
1549 const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec) 1551 const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec)
1550 { 1552 {
1551 if (dst == NULL || src == NULL || fmt == NULL || spec == NULL) 1553 if (dst == NULL || src == NULL || fmt == NULL || spec == NULL)
1552 return DMERR_NULLPTR; 1554 return DMERR_NULLPTR;
1553 1555