summaryrefslogtreecommitdiff
path: root/src/gd_topal.c
diff options
context:
space:
mode:
authorKornel Lesiński <kornel@geekhood.net>2013-03-27 01:06:44 +0000
committerKornel Lesiński <kornel@geekhood.net>2013-03-27 01:06:44 +0000
commit6de104fdadecc4fd6aa551d7316eace8b5984d24 (patch)
tree1f040ba8f1de25587842241c2ce8a345b97c8fde /src/gd_topal.c
parent34a00a40fb1ad7ebe4a6763c0c458a68114c14ce (diff)
downloadlibgd-6de104fdadecc4fd6aa551d7316eace8b5984d24.tar.gz
Reverted unrelated whitespace changes
--HG-- branch : liq extra : rebase_source : 6c5f1e173348b97be6b31ea67c2b174c1094d262 extra : histedit_source : d33be583abd05b908a7d0bf47ad46f2c85de8c9e%2Cb4a6bc74922a2105d2a14894f4d47cb77c61de63
Diffstat (limited to 'src/gd_topal.c')
-rw-r--r--src/gd_topal.c104
1 files changed, 49 insertions, 55 deletions
diff --git a/src/gd_topal.c b/src/gd_topal.c
index 7c50470..217ea96 100644
--- a/src/gd_topal.c
+++ b/src/gd_topal.c
@@ -1569,10 +1569,9 @@ static int gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int colors
int maxColors = gdMaxColors;
gdImagePtr nim;
- if (cimP)
- {
- nim = gdImageCreate(oim->sx, oim->sy);
- *cimP = nim;
+ if (cimP) {
+ nim = gdImageCreate(oim->sx, oim->sy);
+ *cimP = nim;
if (!nim)
{
return FALSE;
@@ -1586,11 +1585,10 @@ static int gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int colors
if (!oim->trueColor)
{
/* (Almost) nothing to do! */
- if (cimP)
- {
- gdImageCopy(nim, oim, 0, 0, 0, 0, oim->sx, oim->sy);
- *cimP = nim;
- }
+ if (cimP) {
+ gdImageCopy(nim, oim, 0, 0, 0, 0, oim->sx, oim->sy);
+ *cimP = nim;
+ }
return TRUE;
}
@@ -1604,23 +1602,22 @@ static int gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int colors
{
colorsWanted = maxColors;
}
- if (!cimP)
- {
- nim->pixels = gdCalloc (sizeof (unsigned char *), oim->sy);
- if (!nim->pixels)
- {
- /* No can do */
- goto outOfMemory;
- }
- for (i = 0; (i < nim->sy); i++)
- {
- nim->pixels[i] = gdCalloc (sizeof (unsigned char *), oim->sx);
- if (!nim->pixels[i])
- {
- goto outOfMemory;
- }
- }
- }
+ if (!cimP) {
+ nim->pixels = gdCalloc (sizeof (unsigned char *), oim->sy);
+ if (!nim->pixels)
+ {
+ /* No can do */
+ goto outOfMemory;
+ }
+ for (i = 0; (i < nim->sy); i++)
+ {
+ nim->pixels[i] = gdCalloc (sizeof (unsigned char *), oim->sx);
+ if (!nim->pixels[i])
+ {
+ goto outOfMemory;
+ }
+ }
+ }
if (oim->paletteQuantizationMethod == GD_QUANT_NEUQUANT)
@@ -1724,11 +1721,11 @@ static int gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int colors
for (i = 0; i < HIST_C0_ELEMS; i++)
{
cquantize->histogram[i] =
- (hist2d) gdMalloc (HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof (histcell));
+ (hist2d) gdMalloc (HIST_C1_ELEMS * HIST_C2_ELEMS * sizeof (histcell));
if (!cquantize->histogram[i])
- {
- goto outOfMemory;
- }
+ {
+ goto outOfMemory;
+ }
}
@@ -1825,27 +1822,24 @@ outOfMemory:
conversionSucceeded = FALSE;
if (oim->trueColor)
{
- if (!cimP)
- {
- /* On failure only */
- for (i = 0; i < nim->sy; i++)
- {
- if (nim->pixels[i])
- {
- gdFree (nim->pixels[i]);
- }
- }
- if (nim->pixels)
- {
- gdFree (nim->pixels);
- }
- nim->pixels = 0;
- }
- else
- {
- gdImageDestroy(nim);
- *cimP = 0;
- }
+ if (!cimP) {
+ /* On failure only */
+ for (i = 0; i < nim->sy; i++)
+ {
+ if (nim->pixels[i])
+ {
+ gdFree (nim->pixels[i]);
+ }
+ }
+ if (nim->pixels)
+ {
+ gdFree (nim->pixels);
+ }
+ nim->pixels = 0;
+ } else {
+ gdImageDestroy(nim);
+ *cimP = 0;
+ }
}
freeQuantizeData:
@@ -1855,10 +1849,10 @@ freeQuantizeData:
{
for (i = 0; i < HIST_C0_ELEMS; i++)
{
- if (cquantize->histogram[i])
- {
- gdFree (cquantize->histogram[i]);
- }
+ if (cquantize->histogram[i])
+ {
+ gdFree (cquantize->histogram[i]);
+ }
}
gdFree (cquantize->histogram);
}