Mercurial > sdl-ios-xcode
view test/automated/common/common.c @ 3341:710139a1692d
Fixed bug #826
Ken Bull 2009-10-04 09:51:30 PDT
2009/10/4 E. Wing <ewmailing@gmail.com>:
> Hi Kenneth,
> I noticed that SDL_SetColorKey and SDL_GetColorKey start with
> /*
> instead of
> /**
> in SDL_Surface.h in SDL 1.3.
>
> I haven't scrutinized the headers and I don't know if you had an
> automated process to add these, but I thought I would let you know in
> case there might be others that have the same problem.
>
> Thanks,
> Eric
>
The attached patch corrects this and other documentation errors in
SDL_surface.h
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 04 Oct 2009 19:14:30 +0000 |
parents | 22ac66da0765 |
children | 0acec8c9f5c9 |
line wrap: on
line source
/** * Automated SDL_Surface test. * * Written by Edgar Simo "bobbens" * * Released under Public Domain. */ #include "SDL.h" #include "SDL_at.h" #include "common/common.h" /** * @brief Compares a surface and a surface image for equality. */ int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img ) { int ret; int i,j; int bpp; Uint8 *p, *pd; /* Make sure size is the same. */ if ((sur->w != img->width) || (sur->h != img->height)) return -1; SDL_LockSurface( sur ); ret = 0; bpp = sur->format->BytesPerPixel; /* Compare image - should be same format. */ for (j=0; j<sur->h; j++) { for (i=0; i<sur->w; i++) { p = (Uint8 *)sur->pixels + j * sur->pitch + i * bpp; pd = (Uint8 *)img->pixel_data + (j*img->width + i) * img->bytes_per_pixel; switch (bpp) { case 1: case 2: case 3: ret += 1; printf("%d BPP not supported yet.\n",bpp); break; case 4: ret += !( (p[0] == pd[0]) && (p[1] == pd[1]) && (p[2] == pd[2]) ); break; } } } SDL_UnlockSurface( sur ); return ret; }