Source

gd-libgd / src / gd_transform.c

Ondřej Surý f52b1dd 



pajoye 1d88ed5 

pajoye 41d830e 
pajoye 1d88ed5 
pajoye e926e1f 
pajoye 1d88ed5 


pajoye 41d830e 

pajoye 1d88ed5 
pajoye 41d830e 



pajoye 1d88ed5 











pajoye 845219c 
pajoye 1d88ed5 

pajoye 41d830e 
pajoye 1d88ed5 




pierrejoye e20413b 
pajoye 1d88ed5 

pajoye 41d830e 







pajoye 1d88ed5 


pajoye 41d830e 
pajoye 1d88ed5 

pajoye 41d830e 







pajoye 1d88ed5 




pajoye 41d830e 
pajoye 1d88ed5 
pajoye 411387f 

pajoye 1d88ed5 

pajoye 41d830e 
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */

#include "gd.h"

BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im)
{
	register int x, y;

	if (im->trueColor) {
		for (y = 0; y < im->sy / 2; y++) {
			int *row_dst = im->tpixels[y];
			int *row_src = im->tpixels[im->sy - 1 - y];
			for (x = 0; x < im->sx; x++) {
				register int p;
				p = row_dst[x];
				row_dst[x] = im->tpixels[im->sy - 1 - y][x];
				row_src[x] = p;
			}
		}
	} else {
		unsigned char p;
		for (y = 0; y < im->sy / 2; y++) {
			for (x = 0; x < im->sx; x++) {
				p = im->tpixels[y][x];
				im->tpixels[y][x] =	im->tpixels[im->sy - 1 - y][x];
				im->tpixels[im->sy - 1 - y][x] = p;
			}
		}
	}
	return;
}

BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im)
{

	int x, y;

	if (im->trueColor) {
		int *px1, *px2, tmp;

		for (y = 0; y < im->sy; y++) {
			px1 = im->tpixels[y];
			px2 = im->tpixels[y] + im->sx - 1;
			for (x = 0; x < (im->sx >> 1); x++) {
				tmp = *px1;
				*px1 = *px2;
				*px2 = tmp;
				px1++;
				px2--;
			}
		}
	} else {
		unsigned char *px1, *px2, tmp;

		for (y = 0; y < im->sy; y++) {
			px1 = im->pixels[y];
			px2 = im->pixels[y] + im->sx - 1;
			for (x = 0; x < (im->sx >> 1); x++) {
				tmp = *px1;
				*px1 = *px2;
				*px2 = tmp;
				px1++;
				px2--;
			}
		}
	}
}

BGD_DECLARE(void) gdImageFlipBoth(gdImagePtr im)
{
	gdImageFlipVertical(im);
	gdImageFlipHorizontal(im);
}