[Scummvm-cvs-logs] scummvm master -> 0e2cf28d99a79a9ae84a4d48cf0e607deacb6653
wjp
wjp at usecode.org
Sat Oct 5 00:11:05 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:
0e2cf28d99 WINTERMUTE: Speed up scale()
Commit: 0e2cf28d99a79a9ae84a4d48cf0e607deacb6653
https://github.com/scummvm/scummvm/commit/0e2cf28d99a79a9ae84a4d48cf0e607deacb6653
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2013-10-04T15:10:09-07:00
Commit Message:
WINTERMUTE: Speed up scale()
This is a tweaked version of a patch from eriktorbjorn.
Changed paths:
engines/wintermute/graphics/transparent_surface.cpp
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
index b03bc42..64102d7 100644
--- a/engines/wintermute/graphics/transparent_surface.cpp
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -715,20 +715,28 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight)
target->create((uint16)dstW, (uint16)dstH, this->format);
-
- float projX;
- float projY;
+#if ENABLE_BILINEAR
for (int y = 0; y < dstH; y++) {
+ float projY = y / (float)dstH * srcH;
for (int x = 0; x < dstW; x++) {
- projX = x / (float)dstW * srcW;
- projY = y / (float)dstH * srcH;
-#if ENABLE_BILINEAR
+ float projX = x / (float)dstW * srcW;
copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target);
-#else
- copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target);
-#endif
}
}
+#else
+ int *scaleCacheX = new int[dstW];
+ for (int x = 0; x < dstW; x++)
+ scaleCacheX[x] = (x * srcW) / dstW;
+
+ for (int y = 0; y < dstH; y++) {
+ uint32 *destP = (uint32 *)target->getBasePtr(0, y);
+ const uint32 *srcP = (const uint32 *)getBasePtr(0, (y * srcH) / dstH);
+ for (int x = 0; x < dstW; x++)
+ *destP++ = srcP[scaleCacheX[x]];
+ }
+ delete[] scaleCacheX;
+#endif
+
return target;
}
More information about the Scummvm-git-logs
mailing list