Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 1897:c2a27da60b18
Solved the performance problems by introducing the concept of a single-buffered
display, which is a fast path used for the whole-surface SDL 1.2 API.
Solved the flicker problems by implementing a backbuffer in the GDI renderer.
Unfortunately, now using the GDI renderer with a backbuffer and HBITMAPs is
significantly slower than SDL's surface code. *sigh*
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 12 Jul 2006 06:39:26 +0000 |
parents | c121d94672cb |
children | 06c27a737b7a |
comparison
equal
deleted
inserted
replaced
1896:4a74fa359e7e | 1897:c2a27da60b18 |
---|---|
440 SDL_PublicSurface = SDL_VideoSurface; | 440 SDL_PublicSurface = SDL_VideoSurface; |
441 return SDL_PublicSurface; | 441 return SDL_PublicSurface; |
442 } | 442 } |
443 | 443 |
444 /* Create a renderer for the window */ | 444 /* Create a renderer for the window */ |
445 if (SDL_CreateRenderer(SDL_VideoWindow, -1, 0) < 0) { | 445 if (SDL_CreateRenderer(SDL_VideoWindow, -1, SDL_Renderer_SingleBuffer) < |
446 0) { | |
446 return NULL; | 447 return NULL; |
447 } | 448 } |
448 | 449 |
449 /* Create a texture for the screen surface */ | 450 /* Create a texture for the screen surface */ |
450 SDL_VideoTexture = | 451 SDL_VideoTexture = |
515 SDL_PublicSurface = | 516 SDL_PublicSurface = |
516 (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface); | 517 (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface); |
517 | 518 |
518 /* Clear the surface for display */ | 519 /* Clear the surface for display */ |
519 SDL_FillRect(SDL_PublicSurface, NULL, 0); | 520 SDL_FillRect(SDL_PublicSurface, NULL, 0); |
521 SDL_UpdateRect(SDL_PublicSurface, 0, 0, 0, 0); | |
520 | 522 |
521 /* We're finally done! */ | 523 /* We're finally done! */ |
522 return SDL_PublicSurface; | 524 return SDL_PublicSurface; |
523 } | 525 } |
524 | 526 |
615 SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) | 617 SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) |
616 { | 618 { |
617 if (screen) { | 619 if (screen) { |
618 SDL_Rect rect; | 620 SDL_Rect rect; |
619 | 621 |
620 /* Perform some checking */ | |
621 if (w == 0) | |
622 w = screen->w; | |
623 if (h == 0) | |
624 h = screen->h; | |
625 if ((int) (x + w) > screen->w) | |
626 return; | |
627 if ((int) (y + h) > screen->h) | |
628 return; | |
629 | |
630 /* Fill the rectangle */ | 622 /* Fill the rectangle */ |
631 rect.x = (Sint16) x; | 623 rect.x = (int) x; |
632 rect.y = (Sint16) y; | 624 rect.y = (int) y; |
633 rect.w = (Uint16) w; | 625 rect.w = (int) (w ? w : screen->w); |
634 rect.h = (Uint16) h; | 626 rect.h = (int) (h ? h : screen->h); |
635 SDL_UpdateRects(screen, 1, &rect); | 627 SDL_UpdateRects(screen, 1, &rect); |
636 } | 628 } |
637 } | 629 } |
638 void | 630 void |
639 SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects) | 631 SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects) |