Mercurial > sdl-ios-xcode
changeset 3469:8c5fb2a3b11d
RenderReadPixels and RenderWritePixels functions work with back buffer now and all asynchronous operations are flushed before reading or writing to backbuffer. Thanks Sam for clarification of this.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Sat, 21 Nov 2009 06:17:50 +0000 |
parents | 789b97008d8a |
children | 419f459f2f38 |
files | src/video/photon/SDL_photon_render.c |
diffstat | 1 files changed, 42 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/photon/SDL_photon_render.c Sat Nov 21 05:29:31 2009 +0000 +++ b/src/video/photon/SDL_photon_render.c Sat Nov 21 06:17:50 2009 +0000 @@ -1594,17 +1594,32 @@ uint8_t* spixels=NULL; unsigned int spitch=0; + /* Flush all undrawn graphics data to surface */ switch (rdata->surfaces_type) { case SDL_PHOTON_SURFTYPE_OFFSCREEN: - sformat=photon_image_to_sdl_pixelformat(rdata->osurfaces[rdata->surface_visible_idx]->format); - spixels=(uint8_t*)PdGetOffscreenContextPtr(rdata->osurfaces[rdata->surface_visible_idx]); - spitch=rdata->osurfaces[rdata->surface_visible_idx]->pitch; + PgFlushCx(rdata->osurfaces[rdata->surface_render_idx]); + PgWaitHWIdle(); break; case SDL_PHOTON_SURFTYPE_PHIMAGE: - sformat=photon_image_to_sdl_pixelformat(rdata->psurfaces[rdata->surface_visible_idx]->type); - spixels=(uint8_t*)rdata->psurfaces[rdata->surface_visible_idx]->image; - spitch=rdata->psurfaces[rdata->surface_visible_idx]->bpl; + PmMemFlush(rdata->pcontexts[rdata->surface_render_idx], rdata->psurfaces[rdata->surface_render_idx]); + break; + case SDL_PHOTON_SURFTYPE_UNKNOWN: + default: + return; + } + + switch (rdata->surfaces_type) + { + case SDL_PHOTON_SURFTYPE_OFFSCREEN: + sformat=photon_image_to_sdl_pixelformat(rdata->osurfaces[rdata->surface_render_idx]->format); + spixels=(uint8_t*)PdGetOffscreenContextPtr(rdata->osurfaces[rdata->surface_render_idx]); + spitch=rdata->osurfaces[rdata->surface_render_idx]->pitch; + break; + case SDL_PHOTON_SURFTYPE_PHIMAGE: + sformat=photon_image_to_sdl_pixelformat(rdata->psurfaces[rdata->surface_render_idx]->type); + spixels=(uint8_t*)rdata->psurfaces[rdata->surface_render_idx]->image; + spitch=rdata->psurfaces[rdata->surface_render_idx]->bpl; break; case SDL_PHOTON_SURFTYPE_UNKNOWN: default: @@ -1631,17 +1646,32 @@ uint8_t* spixels=NULL; unsigned int spitch=0; + /* Flush all undrawn graphics data to surface */ switch (rdata->surfaces_type) { case SDL_PHOTON_SURFTYPE_OFFSCREEN: - sformat=photon_image_to_sdl_pixelformat(rdata->osurfaces[rdata->surface_visible_idx]->format); - spixels=(uint8_t*)PdGetOffscreenContextPtr(rdata->osurfaces[rdata->surface_visible_idx]); - spitch=rdata->osurfaces[rdata->surface_visible_idx]->pitch; + PgFlushCx(rdata->osurfaces[rdata->surface_render_idx]); + PgWaitHWIdle(); break; case SDL_PHOTON_SURFTYPE_PHIMAGE: - sformat=photon_image_to_sdl_pixelformat(rdata->psurfaces[rdata->surface_visible_idx]->type); - spixels=(uint8_t*)rdata->psurfaces[rdata->surface_visible_idx]->image; - spitch=rdata->psurfaces[rdata->surface_visible_idx]->bpl; + PmMemFlush(rdata->pcontexts[rdata->surface_render_idx], rdata->psurfaces[rdata->surface_render_idx]); + break; + case SDL_PHOTON_SURFTYPE_UNKNOWN: + default: + return; + } + + switch (rdata->surfaces_type) + { + case SDL_PHOTON_SURFTYPE_OFFSCREEN: + sformat=photon_image_to_sdl_pixelformat(rdata->osurfaces[rdata->surface_render_idx]->format); + spixels=(uint8_t*)PdGetOffscreenContextPtr(rdata->osurfaces[rdata->surface_render_idx]); + spitch=rdata->osurfaces[rdata->surface_render_idx]->pitch; + break; + case SDL_PHOTON_SURFTYPE_PHIMAGE: + sformat=photon_image_to_sdl_pixelformat(rdata->psurfaces[rdata->surface_render_idx]->type); + spixels=(uint8_t*)rdata->psurfaces[rdata->surface_render_idx]->image; + spitch=rdata->psurfaces[rdata->surface_render_idx]->bpl; break; case SDL_PHOTON_SURFTYPE_UNKNOWN: default: