Permalink
Browse files

SDL2: remove lazy assert and actually copy pixels by src/dest pitch

  • Loading branch information...
1 parent bb90878 commit d23d20135227f91c295e792a6876fb443e5b1c46 @bradallred bradallred committed Apr 29, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 gemrb/plugins/SDLVideo/SDL20Video.cpp
@@ -325,8 +325,14 @@ int SDL20VideoDriver::SwapBuffers(void)
return GEM_ERROR;
}
- assert(pitch == backBuf->pitch);
- memcpy(pixels, backBuf->pixels, pitch * height);
+ ieByte* src = (ieByte*)backBuf->pixels;
+ ieByte* dest = (ieByte*)pixels;
+ for( int row = 0; row < height; row++ ) {
+ memcpy(dest, src, width * backBuf->format->BytesPerPixel);
+ dest += pitch;
+ src += backBuf->pitch;
+ }
+
/*
if (fadeColor.a) {
SDL_Rect dst = {

0 comments on commit d23d201

Please sign in to comment.