Streamlined the API a bit and optimized the software renderer.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401952
This commit is contained in:
Sam Lantinga 2006-07-15 09:46:36 +00:00
parent dfe1ea2171
commit d5d8761b60
10 changed files with 282 additions and 557 deletions

View file

@ -31,6 +31,7 @@
static SDL_WindowID SDL_VideoWindow;
static SDL_RendererInfo SDL_VideoRendererInfo;
static SDL_TextureID SDL_VideoTexture;
static SDL_Surface *SDL_VideoSurface;
static SDL_Surface *SDL_ShadowSurface;
@ -442,10 +443,12 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
}
/* Create a renderer for the window */
if (SDL_CreateRenderer(SDL_VideoWindow, -1, SDL_Renderer_SingleBuffer) <
0) {
if (SDL_CreateRenderer
(SDL_VideoWindow, -1,
SDL_Renderer_SingleBuffer | SDL_Renderer_PresentDiscard) < 0) {
return NULL;
}
SDL_GetRendererInfo(-1, &SDL_VideoRendererInfo);
/* Create a texture for the screen surface */
SDL_VideoTexture =
@ -642,8 +645,19 @@ SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects)
screen = SDL_VideoSurface;
}
if (screen == SDL_VideoSurface) {
for (i = 0; i < numrects; ++i) {
SDL_RenderCopy(SDL_VideoTexture, &rects[i], &rects[i],
if (SDL_VideoRendererInfo.flags & SDL_Renderer_PresentCopy) {
for (i = 0; i < numrects; ++i) {
SDL_RenderCopy(SDL_VideoTexture, &rects[i], &rects[i],
SDL_TextureBlendMode_None,
SDL_TextureScaleMode_None);
}
} else {
SDL_Rect rect;
rect.x = 0;
rect.y = 0;
rect.w = screen->w;
rect.h = screen->h;
SDL_RenderCopy(SDL_VideoTexture, &rect, &rect,
SDL_TextureBlendMode_None,
SDL_TextureScaleMode_None);
}