test/testrendertarget.c
changeset 7781 3023b0270c94
parent 7639 9406b7dd2f2d
child 7787 e6f3e8fc96ea
     1.1 --- a/test/testrendertarget.c	Thu Oct 03 20:48:52 2013 -0700
     1.2 +++ b/test/testrendertarget.c	Thu Oct 03 21:41:09 2013 -0700
     1.3 @@ -87,7 +87,7 @@
     1.4      return texture;
     1.5  }
     1.6  
     1.7 -void
     1.8 +SDL_bool
     1.9  DrawComposite(DrawState *s)
    1.10  {
    1.11      SDL_Rect viewport, R;
    1.12 @@ -167,9 +167,10 @@
    1.13  
    1.14      /* Update the screen! */
    1.15      SDL_RenderPresent(s->renderer);
    1.16 +    return SDL_TRUE;
    1.17  }
    1.18  
    1.19 -void
    1.20 +SDL_bool
    1.21  Draw(DrawState *s)
    1.22  {
    1.23      SDL_Rect viewport;
    1.24 @@ -178,6 +179,10 @@
    1.25      SDL_RenderGetViewport(s->renderer, &viewport);
    1.26  
    1.27      target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h);
    1.28 +    if (!target) {
    1.29 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create render target texture: %s\n", SDL_GetError());
    1.30 +        return SDL_FALSE;
    1.31 +    }
    1.32      SDL_SetRenderTarget(s->renderer, target);
    1.33  
    1.34      /* Draw the background */
    1.35 @@ -206,6 +211,7 @@
    1.36  
    1.37      /* Update the screen! */
    1.38      SDL_RenderPresent(s->renderer);
    1.39 +    return SDL_TRUE;
    1.40  }
    1.41  
    1.42  int
    1.43 @@ -280,9 +286,9 @@
    1.44          }
    1.45          for (i = 0; i < state->num_windows; ++i) {
    1.46              if (test_composite) {
    1.47 -                DrawComposite(&drawstates[i]);
    1.48 +                if (!DrawComposite(&drawstates[i])) done = 1;
    1.49              } else {
    1.50 -                Draw(&drawstates[i]);
    1.51 +                if (!Draw(&drawstates[i])) done = 1;
    1.52              }
    1.53          }
    1.54      }