Fixed crash in testdraw2, added more points
authorSam Lantinga <slouken@libsdl.org>
Sun, 21 Dec 2008 17:55:02 +0000
changeset 290283c3a4b0e421
parent 2901 133601e3b255
child 2903 e426c4fc9cf7
Fixed crash in testdraw2, added more points
test/testdraw2.c
     1.1 --- a/test/testdraw2.c	Sun Dec 21 17:39:41 2008 +0000
     1.2 +++ b/test/testdraw2.c	Sun Dec 21 17:55:02 2008 +0000
     1.3 @@ -29,7 +29,7 @@
     1.4      SDL_GetWindowSize(window, &window_w, &window_h);
     1.5  
     1.6      SDL_SetRenderDrawBlendMode(blendMode);
     1.7 -    for (i = 0; i < num_objects; ++i) {
     1.8 +    for (i = 0; i < num_objects * 4; ++i) {
     1.9          /* Cycle the color and alpha, if desired */
    1.10          if (cycle_color) {
    1.11              current_color += cycle_direction;
    1.12 @@ -102,10 +102,10 @@
    1.13                                 (Uint8) current_color, (Uint8) current_alpha);
    1.14  
    1.15          if (i == 0) {
    1.16 -            SDL_RenderLine(0, 0, window_w, window_h);
    1.17 -            SDL_RenderLine(0, window_h, window_w, 0);
    1.18 -            SDL_RenderLine(0, window_h / 2, window_w, window_h / 2);
    1.19 -            SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h);
    1.20 +            SDL_RenderLine(0, 0, window_w - 1, window_h - 1);
    1.21 +            SDL_RenderLine(0, window_h - 1, window_w - 1, 0);
    1.22 +            SDL_RenderLine(0, window_h / 2, window_w - 1, window_h / 2);
    1.23 +            SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h - 1);
    1.24          } else {
    1.25              x1 = rand() % window_w;
    1.26              x2 = rand() % window_w;
    1.27 @@ -128,7 +128,7 @@
    1.28      SDL_GetWindowSize(window, &window_w, &window_h);
    1.29  
    1.30      SDL_SetRenderDrawBlendMode(blendMode);
    1.31 -    for (i = 0; i < num_objects/4; ++i) {
    1.32 +    for (i = 0; i < num_objects / 4; ++i) {
    1.33          /* Cycle the color and alpha, if desired */
    1.34          if (cycle_color) {
    1.35              current_color += cycle_direction;