fixed code indents and quote marks in text files

This commit is contained in:
2021-08-18 21:46:19 -06:00
parent 79a777b22d
commit a0993bceca
18 changed files with 494 additions and 495 deletions

View File

@@ -1,12 +1,12 @@
/*
* UPIWIN - Micro Pi Windowing Framework Kernel
* Copyright (C) 2019 Amy Bowersox/Erbosoft Metaverse Design Solutions
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -96,12 +96,12 @@ int readpng_get_bgcolor(const char *fname, uch *red, uch *green, uch *blue)
fprintf(stderr, "%s: unspecified error in background reading\n", fname);
return -1;
}
if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_bKGD))
return 0;
png_get_bKGD(png_ptr, info_ptr, &pBackground);
if (bit_depth == 16)
{
*red = pBackground->red >> 8;
@@ -139,7 +139,7 @@ uch *readpng_get_image(const char *fname, double display_exponent, int *pChannel
fprintf(stderr, "%s: unspecified error in image data reading\n", fname);
return NULL;
}
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
@@ -158,14 +158,14 @@ uch *readpng_get_image(const char *fname, double display_exponent, int *pChannel
*pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr);
*pChannels = (int)png_get_channels(png_ptr, info_ptr);
if ((image_data = (uch *)malloc(rowbytes*height)) == NULL)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fprintf(stderr, "%s: could not allocate image buffer\n", fname);
return NULL;
}
if ((row_pointers = (png_bytepp)malloc(height*sizeof(png_bytep))) == NULL)
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
@@ -249,7 +249,7 @@ int do_convert(const char *infilename, const char *outfilename)
fprintf(stderr, "%s: could not open file\n", outfilename);
return -1;
}
for (row = 0; row < image_height; ++row)
{
src = image_data + (row * image_rowbytes);
@@ -257,34 +257,34 @@ int do_convert(const char *infilename, const char *outfilename)
{
if (image_channels == 3)
{
bred = *src++;
bgreen = *src++;
bblue = *src++;
bred = *src++;
bgreen = *src++;
bblue = *src++;
}
else if (image_channels == 4)
{
br = *src++;
bg = *src++;
bb = *src++;
ba = *src++;
if (ba == 255)
{
bred = br;
bgreen = bg;
bblue = bb;
}
else if (ba == 0)
{
bred = bg_red;
bgreen = bg_green;
bblue = bg_blue;
}
else
{
png_composite(bred, br, ba, bg_red);
png_composite(bgreen, bg, ba, bg_green);
png_composite(bblue, bb, ba, bg_blue);
}
br = *src++;
bg = *src++;
bb = *src++;
ba = *src++;
if (ba == 255)
{
bred = br;
bgreen = bg;
bblue = bb;
}
else if (ba == 0)
{
bred = bg_red;
bgreen = bg_green;
bblue = bg_blue;
}
else
{
png_composite(bred, br, ba, bg_red);
png_composite(bgreen, bg, ba, bg_green);
png_composite(bblue, bb, ba, bg_blue);
}
}
bred = (bred >> 3) & 0x1F;
bgreen = (bgreen >> 2) & 0x3F;
@@ -292,10 +292,10 @@ int do_convert(const char *infilename, const char *outfilename)
buf = (bred << 11) | (bgreen << 5) | bblue;
if (write(fdout, &buf, sizeof(uint16_t)) < 0)
{
close(fdout);
free(image_data);
fprintf(stderr, "%s: error writing image data\n", outfilename);
return -1;
close(fdout);
free(image_data);
fprintf(stderr, "%s: error writing image data\n", outfilename);
return -1;
}
}
}