comparison src/video/SDL_video.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 36d52b1f0504
comparison
equal deleted inserted replaced
1896:4a74fa359e7e 1897:c2a27da60b18
1767 if (rect) { 1767 if (rect) {
1768 if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) { 1768 if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
1769 return 0; 1769 return 0;
1770 } 1770 }
1771 } 1771 }
1772 rect = &real_rect; 1772
1773 1773 return renderer->RenderFill(renderer, &real_rect, color);
1774 return renderer->RenderFill(renderer, rect, color);
1775 } 1774 }
1776 1775
1777 int 1776 int
1778 SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect, 1777 SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect,
1779 const SDL_Rect * dstrect, int blendMode, int scaleMode) 1778 const SDL_Rect * dstrect, int blendMode, int scaleMode)
1791 renderer = SDL_CurrentDisplay.current_renderer; 1790 renderer = SDL_CurrentDisplay.current_renderer;
1792 if (!renderer || !renderer->RenderCopy) { 1791 if (!renderer || !renderer->RenderCopy) {
1793 return -1; 1792 return -1;
1794 } 1793 }
1795 1794
1796 /* FIXME: implement clipping */
1797 window = SDL_GetWindowFromID(renderer->window); 1795 window = SDL_GetWindowFromID(renderer->window);
1798 real_srcrect.x = 0; 1796 if (srcrect) {
1799 real_srcrect.y = 0; 1797 real_srcrect = *srcrect;
1800 real_srcrect.w = texture->w; 1798 } else {
1801 real_srcrect.h = texture->h; 1799 real_srcrect.x = 0;
1802 real_dstrect.x = 0; 1800 real_srcrect.y = 0;
1803 real_dstrect.y = 0; 1801 real_srcrect.w = texture->w;
1804 real_dstrect.w = window->w; 1802 real_srcrect.h = texture->h;
1805 real_dstrect.h = window->h; 1803 }
1806 if (!srcrect) { 1804 if (dstrect) {
1807 srcrect = &real_srcrect; 1805 real_dstrect = *dstrect;
1808 } 1806 } else {
1809 if (!dstrect) { 1807 real_dstrect.x = 0;
1810 dstrect = &real_dstrect; 1808 real_dstrect.y = 0;
1811 } 1809 real_dstrect.w = window->w;
1812 1810 real_dstrect.h = window->h;
1813 return renderer->RenderCopy(renderer, texture, srcrect, dstrect, 1811 }
1814 blendMode, scaleMode); 1812
1813 return renderer->RenderCopy(renderer, texture, &real_srcrect,
1814 &real_dstrect, blendMode, scaleMode);
1815 } 1815 }
1816 1816
1817 int 1817 int
1818 SDL_RenderReadPixels(const SDL_Rect * rect, void *pixels, int pitch) 1818 SDL_RenderReadPixels(const SDL_Rect * rect, void *pixels, int pitch)
1819 { 1819 {
1880 renderer = SDL_CurrentDisplay.current_renderer; 1880 renderer = SDL_CurrentDisplay.current_renderer;
1881 if (!renderer || !renderer->RenderPresent) { 1881 if (!renderer || !renderer->RenderPresent) {
1882 return; 1882 return;
1883 } 1883 }
1884 1884
1885 if (renderer->SelectRenderTexture) {
1886 renderer->SelectRenderTexture(renderer, NULL);
1887 }
1885 renderer->RenderPresent(renderer); 1888 renderer->RenderPresent(renderer);
1886 } 1889 }
1887 1890
1888 void 1891 void
1889 SDL_DestroyTexture(SDL_TextureID textureID) 1892 SDL_DestroyTexture(SDL_TextureID textureID)