Allow points to be outside the window bounds, stress testing the clipping code.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404294
This commit is contained in:
Sam Lantinga 2009-12-12 00:08:45 +00:00
parent 0e0b96d72f
commit 9888012562

View file

@ -107,10 +107,10 @@ DrawLines(SDL_WindowID window)
SDL_RenderLine(0, window_h / 2, window_w - 1, window_h / 2); SDL_RenderLine(0, window_h / 2, window_w - 1, window_h / 2);
SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h - 1); SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h - 1);
} else { } else {
x1 = rand() % window_w; x1 = (rand() % (window_w*2)) - window_w;
x2 = rand() % window_w; x2 = (rand() % (window_w*2)) - window_w;
y1 = rand() % window_h; y1 = (rand() % (window_h*2)) - window_h;
y2 = rand() % window_h; y2 = (rand() % (window_h*2)) - window_h;
SDL_RenderLine(x1, y1, x2, y2); SDL_RenderLine(x1, y1, x2, y2);
} }
} }
@ -157,8 +157,8 @@ DrawRects(SDL_WindowID window)
rect.w = rand() % (window_h / 2); rect.w = rand() % (window_h / 2);
rect.h = rand() % (window_h / 2); rect.h = rand() % (window_h / 2);
rect.x = (rand() % window_w) - (rect.w / 2); rect.x = (rand() % (window_w*2) - window_w) - (rect.w / 2);
rect.y = (rand() % window_w) - (rect.h / 2); rect.y = (rand() % (window_h*2) - window_h) - (rect.h / 2);
SDL_RenderRect(&rect); SDL_RenderRect(&rect);
} }
SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE); SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);