comparison test/testdraw2.c @ 3546:65848493e08e

Allow points to be outside the window bounds, stress testing the clipping code.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 12 Dec 2009 00:08:45 +0000
parents 0267b8b1595c
children f638ded38b8a
comparison
equal deleted inserted replaced
3545:6d91cff0ec79 3546:65848493e08e
105 SDL_RenderLine(0, 0, window_w - 1, window_h - 1); 105 SDL_RenderLine(0, 0, window_w - 1, window_h - 1);
106 SDL_RenderLine(0, window_h - 1, window_w - 1, 0); 106 SDL_RenderLine(0, window_h - 1, window_w - 1, 0);
107 SDL_RenderLine(0, window_h / 2, window_w - 1, window_h / 2); 107 SDL_RenderLine(0, window_h / 2, window_w - 1, window_h / 2);
108 SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h - 1); 108 SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h - 1);
109 } else { 109 } else {
110 x1 = rand() % window_w; 110 x1 = (rand() % (window_w*2)) - window_w;
111 x2 = rand() % window_w; 111 x2 = (rand() % (window_w*2)) - window_w;
112 y1 = rand() % window_h; 112 y1 = (rand() % (window_h*2)) - window_h;
113 y2 = rand() % window_h; 113 y2 = (rand() % (window_h*2)) - window_h;
114 SDL_RenderLine(x1, y1, x2, y2); 114 SDL_RenderLine(x1, y1, x2, y2);
115 } 115 }
116 } 116 }
117 SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE); 117 SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
118 } 118 }
155 SDL_SetRenderDrawColor(255, (Uint8) current_color, 155 SDL_SetRenderDrawColor(255, (Uint8) current_color,
156 (Uint8) current_color, (Uint8) current_alpha); 156 (Uint8) current_color, (Uint8) current_alpha);
157 157
158 rect.w = rand() % (window_h / 2); 158 rect.w = rand() % (window_h / 2);
159 rect.h = rand() % (window_h / 2); 159 rect.h = rand() % (window_h / 2);
160 rect.x = (rand() % window_w) - (rect.w / 2); 160 rect.x = (rand() % (window_w*2) - window_w) - (rect.w / 2);
161 rect.y = (rand() % window_w) - (rect.h / 2); 161 rect.y = (rand() % (window_h*2) - window_h) - (rect.h / 2);
162 SDL_RenderRect(&rect); 162 SDL_RenderRect(&rect);
163 } 163 }
164 SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE); 164 SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
165 } 165 }
166 166