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;
}
Cheers !