[Scummvm-cvs-logs] scummvm master -> 9db17152c1ca47a851aed685c0515f3aebb6c390
lordhoto
lordhoto at gmail.com
Thu Aug 1 23:59:12 CEST 2013
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9db17152c1 GRAPHICS: Make Surface::copyFrom work for any src pitch.
Commit: 9db17152c1ca47a851aed685c0515f3aebb6c390
https://github.com/scummvm/scummvm/commit/9db17152c1ca47a851aed685c0515f3aebb6c390
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2013-08-01T14:57:10-07:00
Commit Message:
GRAPHICS: Make Surface::copyFrom work for any src pitch.
Formerly we assumed that the newly created surface has the same pitch as the
source surface. This is a assumption that might be invalid (for example in
case of the Surface returned by OSystem::lockScreen.)
Changed paths:
graphics/surface.cpp
diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index 41ae8dc..010389c 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -84,7 +84,17 @@ void Surface::free() {
void Surface::copyFrom(const Surface &surf) {
create(surf.w, surf.h, surf.format);
- memcpy(pixels, surf.pixels, h * pitch);
+ if (surf.pitch == pitch) {
+ memcpy(pixels, surf.pixels, h * pitch);
+ } else {
+ const byte *src = (const byte *)surf.pixels;
+ byte *dst = (byte *)pixels;
+ for (int y = h; y > 0; --y) {
+ memcpy(dst, src, w * format.bytesPerPixel);
+ src += surf.pitch;
+ dst += pitch;
+ }
+ }
}
void Surface::hLine(int x, int y, int x2, uint32 color) {
More information about the Scummvm-git-logs
mailing list