Mercurial > sdl-ios-xcode
comparison src/video/photon/SDL_photon_render.c @ 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 | 6265b67848e0 |
children | 4b594623401b |
comparison
equal
deleted
inserted
replaced
3468:789b97008d8a | 3469:8c5fb2a3b11d |
---|---|
1592 SDL_RenderData *rdata = (SDL_RenderData *)renderer->driverdata; | 1592 SDL_RenderData *rdata = (SDL_RenderData *)renderer->driverdata; |
1593 Uint32 sformat=0; | 1593 Uint32 sformat=0; |
1594 uint8_t* spixels=NULL; | 1594 uint8_t* spixels=NULL; |
1595 unsigned int spitch=0; | 1595 unsigned int spitch=0; |
1596 | 1596 |
1597 /* Flush all undrawn graphics data to surface */ | |
1597 switch (rdata->surfaces_type) | 1598 switch (rdata->surfaces_type) |
1598 { | 1599 { |
1599 case SDL_PHOTON_SURFTYPE_OFFSCREEN: | 1600 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
1600 sformat=photon_image_to_sdl_pixelformat(rdata->osurfaces[rdata->surface_visible_idx]->format); | 1601 PgFlushCx(rdata->osurfaces[rdata->surface_render_idx]); |
1601 spixels=(uint8_t*)PdGetOffscreenContextPtr(rdata->osurfaces[rdata->surface_visible_idx]); | 1602 PgWaitHWIdle(); |
1602 spitch=rdata->osurfaces[rdata->surface_visible_idx]->pitch; | |
1603 break; | 1603 break; |
1604 case SDL_PHOTON_SURFTYPE_PHIMAGE: | 1604 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
1605 sformat=photon_image_to_sdl_pixelformat(rdata->psurfaces[rdata->surface_visible_idx]->type); | 1605 PmMemFlush(rdata->pcontexts[rdata->surface_render_idx], rdata->psurfaces[rdata->surface_render_idx]); |
1606 spixels=(uint8_t*)rdata->psurfaces[rdata->surface_visible_idx]->image; | 1606 break; |
1607 spitch=rdata->psurfaces[rdata->surface_visible_idx]->bpl; | 1607 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
1608 default: | |
1609 return; | |
1610 } | |
1611 | |
1612 switch (rdata->surfaces_type) | |
1613 { | |
1614 case SDL_PHOTON_SURFTYPE_OFFSCREEN: | |
1615 sformat=photon_image_to_sdl_pixelformat(rdata->osurfaces[rdata->surface_render_idx]->format); | |
1616 spixels=(uint8_t*)PdGetOffscreenContextPtr(rdata->osurfaces[rdata->surface_render_idx]); | |
1617 spitch=rdata->osurfaces[rdata->surface_render_idx]->pitch; | |
1618 break; | |
1619 case SDL_PHOTON_SURFTYPE_PHIMAGE: | |
1620 sformat=photon_image_to_sdl_pixelformat(rdata->psurfaces[rdata->surface_render_idx]->type); | |
1621 spixels=(uint8_t*)rdata->psurfaces[rdata->surface_render_idx]->image; | |
1622 spitch=rdata->psurfaces[rdata->surface_render_idx]->bpl; | |
1608 break; | 1623 break; |
1609 case SDL_PHOTON_SURFTYPE_UNKNOWN: | 1624 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
1610 default: | 1625 default: |
1611 SDL_SetError("Photon: surfaces are not initialized"); | 1626 SDL_SetError("Photon: surfaces are not initialized"); |
1612 return -1; | 1627 return -1; |
1629 SDL_RenderData *rdata = (SDL_RenderData *)renderer->driverdata; | 1644 SDL_RenderData *rdata = (SDL_RenderData *)renderer->driverdata; |
1630 Uint32 sformat=0; | 1645 Uint32 sformat=0; |
1631 uint8_t* spixels=NULL; | 1646 uint8_t* spixels=NULL; |
1632 unsigned int spitch=0; | 1647 unsigned int spitch=0; |
1633 | 1648 |
1649 /* Flush all undrawn graphics data to surface */ | |
1634 switch (rdata->surfaces_type) | 1650 switch (rdata->surfaces_type) |
1635 { | 1651 { |
1636 case SDL_PHOTON_SURFTYPE_OFFSCREEN: | 1652 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
1637 sformat=photon_image_to_sdl_pixelformat(rdata->osurfaces[rdata->surface_visible_idx]->format); | 1653 PgFlushCx(rdata->osurfaces[rdata->surface_render_idx]); |
1638 spixels=(uint8_t*)PdGetOffscreenContextPtr(rdata->osurfaces[rdata->surface_visible_idx]); | 1654 PgWaitHWIdle(); |
1639 spitch=rdata->osurfaces[rdata->surface_visible_idx]->pitch; | |
1640 break; | 1655 break; |
1641 case SDL_PHOTON_SURFTYPE_PHIMAGE: | 1656 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
1642 sformat=photon_image_to_sdl_pixelformat(rdata->psurfaces[rdata->surface_visible_idx]->type); | 1657 PmMemFlush(rdata->pcontexts[rdata->surface_render_idx], rdata->psurfaces[rdata->surface_render_idx]); |
1643 spixels=(uint8_t*)rdata->psurfaces[rdata->surface_visible_idx]->image; | 1658 break; |
1644 spitch=rdata->psurfaces[rdata->surface_visible_idx]->bpl; | 1659 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
1660 default: | |
1661 return; | |
1662 } | |
1663 | |
1664 switch (rdata->surfaces_type) | |
1665 { | |
1666 case SDL_PHOTON_SURFTYPE_OFFSCREEN: | |
1667 sformat=photon_image_to_sdl_pixelformat(rdata->osurfaces[rdata->surface_render_idx]->format); | |
1668 spixels=(uint8_t*)PdGetOffscreenContextPtr(rdata->osurfaces[rdata->surface_render_idx]); | |
1669 spitch=rdata->osurfaces[rdata->surface_render_idx]->pitch; | |
1670 break; | |
1671 case SDL_PHOTON_SURFTYPE_PHIMAGE: | |
1672 sformat=photon_image_to_sdl_pixelformat(rdata->psurfaces[rdata->surface_render_idx]->type); | |
1673 spixels=(uint8_t*)rdata->psurfaces[rdata->surface_render_idx]->image; | |
1674 spitch=rdata->psurfaces[rdata->surface_render_idx]->bpl; | |
1645 break; | 1675 break; |
1646 case SDL_PHOTON_SURFTYPE_UNKNOWN: | 1676 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
1647 default: | 1677 default: |
1648 SDL_SetError("Photon: surfaces are not initialized"); | 1678 SDL_SetError("Photon: surfaces are not initialized"); |
1649 return -1; | 1679 return -1; |