transform.c (libcaca-0.99.beta19) | : | transform.c (libcaca-0.99.beta20.tar.bz2) | ||
---|---|---|---|---|
/* | /* | |||
* libcaca Colour ASCII-Art library | * libcaca Colour ASCII-Art library | |||
* Copyright (c) 2002-2012 Sam Hocevar <sam@hocevar.net> | * Copyright © 2002—2021 Sam Hocevar <sam@hocevar.net> | |||
* All Rights Reserved | * All Rights Reserved | |||
* | * | |||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | |||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | |||
* and/or modify it under the terms of the Do What the Fuck You Want | * and/or modify it under the terms of the Do What the Fuck You Want | |||
* to Public License, Version 2, as published by Sam Hocevar. See | * to Public License, Version 2, as published by Sam Hocevar. See | |||
* http://www.wtfpl.net/ for more details. | * http://www.wtfpl.net/ for more details. | |||
*/ | */ | |||
/* | /* | |||
* This file contains horizontal and vertical flipping routines. | * This file contains horizontal and vertical flipping routines. | |||
skipping to change at line 272 | skipping to change at line 272 | |||
seterrno(EBUSY); | seterrno(EBUSY); | |||
return -1; | return -1; | |||
} | } | |||
/* Save the current frame shortcuts */ | /* Save the current frame shortcuts */ | |||
_caca_save_frame_info(cv); | _caca_save_frame_info(cv); | |||
w2 = (cv->width + 1) / 2; | w2 = (cv->width + 1) / 2; | |||
h2 = cv->height; | h2 = cv->height; | |||
newchars = malloc(w2 * h2 * 2 * sizeof(uint32_t)); | newchars = _caca_alloc2d(w2, h2, 2 * sizeof(uint32_t)); | |||
if(!newchars) | if(!newchars) | |||
{ | { | |||
seterrno(ENOMEM); | seterrno(ENOMEM); | |||
return -1; | return -1; | |||
} | } | |||
newattrs = malloc(w2 * h2 * 2 * sizeof(uint32_t)); | newattrs = _caca_alloc2d(w2, h2, 2 * sizeof(uint32_t)); | |||
if(!newattrs) | if(!newattrs) | |||
{ | { | |||
free(newchars); | free(newchars); | |||
seterrno(ENOMEM); | seterrno(ENOMEM); | |||
return -1; | return -1; | |||
} | } | |||
for(y = 0; y < h2; y++) | for(y = 0; y < h2; y++) | |||
{ | { | |||
for(x = 0; x < w2; x++) | for(x = 0; x < w2; x++) | |||
skipping to change at line 392 | skipping to change at line 392 | |||
seterrno(EBUSY); | seterrno(EBUSY); | |||
return -1; | return -1; | |||
} | } | |||
/* Save the current frame shortcuts */ | /* Save the current frame shortcuts */ | |||
_caca_save_frame_info(cv); | _caca_save_frame_info(cv); | |||
w2 = (cv->width + 1) / 2; | w2 = (cv->width + 1) / 2; | |||
h2 = cv->height; | h2 = cv->height; | |||
newchars = malloc(w2 * h2 * 2 * sizeof(uint32_t)); | newchars = _caca_alloc2d(w2 * 2, h2, sizeof(uint32_t)); | |||
if(!newchars) | if(!newchars) | |||
{ | { | |||
seterrno(ENOMEM); | seterrno(ENOMEM); | |||
return -1; | return -1; | |||
} | } | |||
newattrs = malloc(w2 * h2 * 2 * sizeof(uint32_t)); | newattrs = _caca_alloc2d(w2 * 2, h2, sizeof(uint32_t)); | |||
if(!newattrs) | if(!newattrs) | |||
{ | { | |||
free(newchars); | free(newchars); | |||
seterrno(ENOMEM); | seterrno(ENOMEM); | |||
return -1; | return -1; | |||
} | } | |||
for(y = 0; y < h2; y++) | for(y = 0; y < h2; y++) | |||
{ | { | |||
for(x = 0; x < w2; x++) | for(x = 0; x < w2; x++) | |||
skipping to change at line 507 | skipping to change at line 507 | |||
if(cv->refcount) | if(cv->refcount) | |||
{ | { | |||
seterrno(EBUSY); | seterrno(EBUSY); | |||
return -1; | return -1; | |||
} | } | |||
/* Save the current frame shortcuts */ | /* Save the current frame shortcuts */ | |||
_caca_save_frame_info(cv); | _caca_save_frame_info(cv); | |||
newchars = malloc(cv->width * cv->height * sizeof(uint32_t)); | newchars = _caca_alloc2d(cv->width, cv->height, sizeof(uint32_t)); | |||
if(!newchars) | if(!newchars) | |||
{ | { | |||
seterrno(ENOMEM); | seterrno(ENOMEM); | |||
return -1; | return -1; | |||
} | } | |||
newattrs = malloc(cv->width * cv->height * sizeof(uint32_t)); | newattrs = _caca_alloc2d(cv->width, cv->height, sizeof(uint32_t)); | |||
if(!newattrs) | if(!newattrs) | |||
{ | { | |||
free(newchars); | free(newchars); | |||
seterrno(ENOMEM); | seterrno(ENOMEM); | |||
return -1; | return -1; | |||
} | } | |||
for(y = 0; y < cv->height; y++) | for(y = 0; y < cv->height; y++) | |||
{ | { | |||
for(x = 0; x < cv->width; x++) | for(x = 0; x < cv->width; x++) | |||
skipping to change at line 600 | skipping to change at line 600 | |||
if(cv->refcount) | if(cv->refcount) | |||
{ | { | |||
seterrno(EBUSY); | seterrno(EBUSY); | |||
return -1; | return -1; | |||
} | } | |||
/* Save the current frame shortcuts */ | /* Save the current frame shortcuts */ | |||
_caca_save_frame_info(cv); | _caca_save_frame_info(cv); | |||
newchars = malloc(cv->width * cv->height * sizeof(uint32_t)); | newchars = _caca_alloc2d(cv->width, cv->height, sizeof(uint32_t)); | |||
if(!newchars) | if(!newchars) | |||
{ | { | |||
seterrno(ENOMEM); | seterrno(ENOMEM); | |||
return -1; | return -1; | |||
} | } | |||
newattrs = malloc(cv->width * cv->height * sizeof(uint32_t)); | newattrs = _caca_alloc2d(cv->width, cv->height, sizeof(uint32_t)); | |||
if(!newattrs) | if(!newattrs) | |||
{ | { | |||
free(newchars); | free(newchars); | |||
seterrno(ENOMEM); | seterrno(ENOMEM); | |||
return -1; | return -1; | |||
} | } | |||
for(y = 0; y < cv->height; y++) | for(y = 0; y < cv->height; y++) | |||
{ | { | |||
for(x = 0; x < cv->width; x++) | for(x = 0; x < cv->width; x++) | |||
skipping to change at line 1230 | skipping to change at line 1230 | |||
} | } | |||
for(i = 0; leftright2x4[i]; i += 2) | for(i = 0; leftright2x4[i]; i += 2) | |||
if(pair[0] == leftright2x4[i] && pair[1] == leftright2x4[i + 1]) | if(pair[0] == leftright2x4[i] && pair[1] == leftright2x4[i + 1]) | |||
{ | { | |||
pair[0] = leftright2x4[(i & ~7) | ((i - 2) & 7)]; | pair[0] = leftright2x4[(i & ~7) | ((i - 2) & 7)]; | |||
pair[1] = leftright2x4[((i & ~7) | ((i - 2) & 7)) + 1]; | pair[1] = leftright2x4[((i & ~7) | ((i - 2) & 7)) + 1]; | |||
return; | return; | |||
} | } | |||
} | } | |||
/* | ||||
* XXX: The following functions are aliases. | ||||
*/ | ||||
int cucul_invert(cucul_canvas_t *) CACA_ALIAS(caca_invert); | ||||
int cucul_flip(cucul_canvas_t *) CACA_ALIAS(caca_flip); | ||||
int cucul_flop(cucul_canvas_t *) CACA_ALIAS(caca_flop); | ||||
int cucul_rotate_180(cucul_canvas_t *) CACA_ALIAS(caca_rotate_180); | ||||
int cucul_rotate_left(cucul_canvas_t *) CACA_ALIAS(caca_rotate_left); | ||||
int cucul_rotate_right(cucul_canvas_t *) CACA_ALIAS(caca_rotate_right); | ||||
int cucul_stretch_left(cucul_canvas_t *) CACA_ALIAS(caca_stretch_left); | ||||
int cucul_stretch_right(cucul_canvas_t *) CACA_ALIAS(caca_stretch_right); | ||||
End of changes. 10 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added |