cropng: skip rewriting images if there's nothing to crop.
This commit is contained in:
parent
740ab8e81b
commit
6c04fcaa54
1 changed files with 9 additions and 1 deletions
10
cropng.c
10
cropng.c
|
|
@ -286,9 +286,17 @@ void processpic( const char *fname )
|
|||
if ( trns ) free(trns);
|
||||
return;
|
||||
}
|
||||
uint8_t *odata = calloc(cropw*croph,pxsize);
|
||||
uint32_t ow = cropw, oh = croph;
|
||||
int32_t ox = x-cropx, oy = y-cropy;
|
||||
if ( (ow == w) && (oh == h) && (ox == x) && (oy == y) )
|
||||
{
|
||||
printf(" Nothing to crop, skipping.\n");
|
||||
free(idata);
|
||||
if ( plte ) free(plte);
|
||||
if ( trns ) free(trns);
|
||||
return;
|
||||
}
|
||||
uint8_t *odata = calloc(cropw*croph,pxsize);
|
||||
for ( uint32_t cy=0; cy<croph; cy++ )
|
||||
{
|
||||
uint32_t ccy = cy+cropy;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue