Mercurial > sdl-ios-xcode
comparison test/testgesture.c @ 4921:40a43c6d9220
Fixed crash if the gesture coordinates go negative - FIXME: Should this protection be at a lower level?
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 30 Nov 2010 18:08:01 -0800 |
parents | f5f70fed2c4c |
children | e8916fe9cfc8 |
comparison
equal
deleted
inserted
replaced
4920:a4032241deb5 | 4921:40a43c6d9220 |
---|---|
79 Uint8 r,g,b; | 79 Uint8 r,g,b; |
80 int x = (int)_x; | 80 int x = (int)_x; |
81 int y = (int)_y; | 81 int y = (int)_y; |
82 float a; | 82 float a; |
83 | 83 |
84 if(x > screen->w) return; | 84 if(x < 0 || x > screen->w) return; |
85 if(y > screen->h) return; | 85 if(y < 0 || y > screen->h) return; |
86 | 86 |
87 pixmem32 = (Uint32*) screen->pixels + y*screen->pitch/BPP + x; | 87 pixmem32 = (Uint32*) screen->pixels + y*screen->pitch/BPP + x; |
88 | 88 |
89 SDL_memcpy(&colour,pixmem32,screen->format->BytesPerPixel); | 89 SDL_memcpy(&colour,pixmem32,screen->format->BytesPerPixel); |
90 | 90 |