diff --git a/VBA.vcproj b/VBA.vcproj index 0024b45e..d137da97 100644 --- a/VBA.vcproj +++ b/VBA.vcproj @@ -1339,10 +1339,6 @@ RelativePath=".\src\win32\DirectSound.cpp" > - - diff --git a/src/win32/Display.h b/src/win32/Display.h index bc787915..f0b353f4 100644 --- a/src/win32/Display.h +++ b/src/win32/Display.h @@ -43,4 +43,46 @@ class IDisplay { virtual int selectFullScreenMode(GUID **) = 0; }; -void copyImage( void *source, void *destination, unsigned int width, unsigned int height, unsigned int destinationPitch, unsigned int colorDepth ); +inline void copyImage( void *source, void *destination, unsigned int width, unsigned int height, unsigned int destinationPitch, unsigned int colorDepth ) +{ + // fast, iterative C version + register unsigned int lineSize; + register unsigned char *src, *dst; + switch(colorDepth) + { + case 16: + lineSize = width<<1; + src = ((unsigned char*)source) + lineSize + 4; + dst = (unsigned char*)destination; + do { + MoveMemory( dst, src, lineSize ); + src+=lineSize; + dst+=lineSize; + src += 2; + dst += (destinationPitch - lineSize); + } while ( --height); + break; + case 32: + lineSize = width<<2; + src = ((unsigned char*)source) + lineSize + 4; + dst = (unsigned char*)destination; + do { + MoveMemory( dst, src, lineSize ); + src+=lineSize; + dst+=lineSize; + src += 4; + dst += (destinationPitch - lineSize); + } while ( --height); + break; + } + + // compact but slow C version + //unsigned int nBytesPerPixel = colorDepth>>3; + //unsigned int i, x, y, srcPitch = (width+1) * nBytesPerPixel; + //unsigned char * src = ((unsigned char*)source)+srcPitch; + //unsigned char * dst = (unsigned char*)destination; + //for (y=0;y>3; - //unsigned int i, x, y, srcPitch = (width+1) * nBytesPerPixel; - //unsigned char * src = ((unsigned char*)source)+srcPitch; - //unsigned char * dst = (unsigned char*)destination; - //for (y=0;y