Allow points to be outside the window bounds, stress testing the clipping code.
authorSam Lantinga <slouken@libsdl.org>
Sat, 12 Dec 2009 00:08:45 +0000
changeset 354665848493e08e
parent 3545 6d91cff0ec79
child 3547 8b18669c2663
Allow points to be outside the window bounds, stress testing the clipping code.
test/testdraw2.c
     1.1 --- a/test/testdraw2.c	Sat Dec 12 00:08:02 2009 +0000
     1.2 +++ b/test/testdraw2.c	Sat Dec 12 00:08:45 2009 +0000
     1.3 @@ -107,10 +107,10 @@
     1.4              SDL_RenderLine(0, window_h / 2, window_w - 1, window_h / 2);
     1.5              SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h - 1);
     1.6          } else {
     1.7 -            x1 = rand() % window_w;
     1.8 -            x2 = rand() % window_w;
     1.9 -            y1 = rand() % window_h;
    1.10 -            y2 = rand() % window_h;
    1.11 +            x1 = (rand() % (window_w*2)) - window_w;
    1.12 +            x2 = (rand() % (window_w*2)) - window_w;
    1.13 +            y1 = (rand() % (window_h*2)) - window_h;
    1.14 +            y2 = (rand() % (window_h*2)) - window_h;
    1.15              SDL_RenderLine(x1, y1, x2, y2);
    1.16          }
    1.17      }
    1.18 @@ -157,8 +157,8 @@
    1.19  
    1.20          rect.w = rand() % (window_h / 2);
    1.21          rect.h = rand() % (window_h / 2);
    1.22 -        rect.x = (rand() % window_w) - (rect.w / 2);
    1.23 -        rect.y = (rand() % window_w) - (rect.h / 2);
    1.24 +        rect.x = (rand() % (window_w*2) - window_w) - (rect.w / 2);
    1.25 +        rect.y = (rand() % (window_h*2) - window_h) - (rect.h / 2);
    1.26          SDL_RenderRect(&rect);
    1.27      }
    1.28      SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);