* Merge another SDLsurface onto our rendered surface */
| 282 | * Merge another SDLsurface onto our rendered surface |
| 283 | */ |
| 284 | void cSurface::mergeSurfaceBuffer( const cSurface* pFrom ) { |
| 285 | auto SourceSurface = pFrom->GetSurface(); |
| 286 | |
| 287 | const uint32 *bufferCurrent = ((uint32*)SourceSurface->pixels); |
| 288 | const uint32 *bufferCurrentMax = (uint32*)(((uint8*)SourceSurface->pixels) + (SourceSurface->h * SourceSurface->pitch)); |
| 289 | |
| 290 | uint32 *bufferTarget = (uint32*)mSDLSurface->pixels; |
| 291 | uint32 *bufferTargetMax = (uint32*)(((uint8*)mSDLSurface->pixels) + (mSDLSurface->h * mSDLSurface->pitch)); |
| 292 | |
| 293 | // Loop until we reach the destination end |
| 294 | while (bufferTarget < bufferTargetMax) { |
| 295 | |
| 296 | // Break out if we pass the source end |
| 297 | if (bufferCurrent >= bufferCurrentMax) |
| 298 | break; |
| 299 | |
| 300 | // Non zero value to draw |
| 301 | if (*bufferCurrent) { |
| 302 | |
| 303 | // Value in palette range? |
| 304 | *bufferTarget = *bufferCurrent; |
| 305 | } |
| 306 | |
| 307 | // Next Source/Destination |
| 308 | ++bufferCurrent; |
| 309 | ++bufferTarget; |
| 310 | } |
| 311 | |
| 312 | if (mTexture) |
| 313 | SDL_UpdateTexture(mTexture, NULL, mSDLSurface->pixels, mSDLSurface->pitch); |
| 314 | } |
| 315 | |
| 316 | void cSurface::clearBuffer(size_t pColor) { |
| 317 |
nothing calls this directly
no test coverage detected