fix bitdepth option

This commit is contained in:
red031000 2024-11-12 09:55:18 +02:00
parent 002719ec2a
commit f81c8e4913
No known key found for this signature in database
GPG Key ID: D27E50C050AE0CE1
2 changed files with 6 additions and 3 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
nitrogfx
.vscode/

8
main.c
View File

@ -141,7 +141,7 @@ void ConvertPngToNtr(char *inputPath, char *outputPath, struct PngToNtrOptions *
fclose(fp);
struct Image image;
image.bitDepth = options->bitDepth;
image.bitDepth = options->bitDepth == 0 ? 4 : options->bitDepth;
ReadPng(inputPath, &image);
@ -160,7 +160,9 @@ void ConvertPngToNtr(char *inputPath, char *outputPath, struct PngToNtrOptions *
free(string);
}
WriteNtrImage(outputPath, options->numTiles, image.bitDepth, options->colsPerChunk, options->rowsPerChunk,
options->bitDepth = options->bitDepth == 0 ? image.bitDepth : options->bitDepth;
WriteNtrImage(outputPath, options->numTiles, options->bitDepth, options->colsPerChunk, options->rowsPerChunk,
&image, !image.hasPalette, options->clobberSize, options->byteOrder, options->version101,
options->sopc, options->vramTransfer, options->scanMode, options->mappingType, key, options->wrongSize);
@ -420,7 +422,7 @@ void HandlePngToNtrCommand(char *inputPath, char *outputPath, int argc, char **a
{
struct PngToNtrOptions options;
options.numTiles = 0;
options.bitDepth = 4;
options.bitDepth = 0;
options.colsPerChunk = 1;
options.rowsPerChunk = 1;
options.wrongSize = false;