[fixed]Image's copyToScaling bug

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Piraaate
Posts: 18
Joined: Wed Feb 21, 2007 3:04 pm
Location: Valence, France
Contact:

[fixed]Image's copyToScaling bug

Post by Piraaate »

Hi all !
I ran into a serious bug when trying to use Image's copyToScaling method when the image and destination data shares the same format but not the same pitch.

Here's the fix I propose fot those who can't wait it to be submitted in current svn head version:

Code: Select all

Index: CImage.cpp
===================================================================
--- CImage.cpp	(revision 2407)
+++ CImage.cpp	(working copy)
@@ -1411,8 +1411,8 @@
 			const u32 bwidth = width*bpp;
 			for (u32 y=0; y<height; ++y)
 			{
-				memcpy(target, Data, height*pitch);
-				memset(tgtpos+width, 0, pitch-bwidth);
+				memcpy(tgtpos, dstpos, bwidth);
+				memset(tgtpos+bwidth, 0, pitch-bwidth);
 				tgtpos += pitch;
 				dstpos += Pitch;
 			}
Bug ID: 2799876

Cheers !
ImageImage
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, you're absolutely right. Looks like a copy-paste bug. Fixed in SVN (for 1.5, will merge later).
Post Reply