aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx
diff options
context:
space:
mode:
authorEugene Sandulenko2013-05-17 00:18:09 +0300
committerEugene Sandulenko2013-05-17 00:18:09 +0300
commitf59512c47ea21c851535eeabf822aabdfde9167f (patch)
tree19c58c54c897dde0188e28951f0827a20ef3c4a0 /engines/sword25/gfx
parent4a62d6c25a4994a72c59ca3b8f2913ead565a173 (diff)
downloadscummvm-rg350-f59512c47ea21c851535eeabf822aabdfde9167f.tar.gz
scummvm-rg350-f59512c47ea21c851535eeabf822aabdfde9167f.tar.bz2
scummvm-rg350-f59512c47ea21c851535eeabf822aabdfde9167f.zip
RECORDER: Implement Events Recorder
Diffstat (limited to 'engines/sword25/gfx')
-rw-r--r--engines/sword25/gfx/image/renderedimage.cpp57
-rw-r--r--engines/sword25/gfx/image/renderedimage.h3
2 files changed, 1 insertions, 59 deletions
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index c8a6666046..81a29c727f 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -41,6 +41,7 @@
#include "sword25/gfx/renderobjectmanager.h"
#include "common/system.h"
+#include "graphics/thumbnail.h"
namespace Sword25 {
@@ -509,60 +510,4 @@ void RenderedImage::checkForTransparency() {
}
}
-/**
- * Scales a passed surface, creating a new surface with the result
- * @param srcImage Source image to scale
- * @param scaleFactor Scale amount. Must be between 0 and 1.0 (but not zero)
- * @remarks Caller is responsible for freeing the returned surface
- */
-Graphics::Surface *RenderedImage::scale(const Graphics::Surface &srcImage, int xSize, int ySize) {
- Graphics::Surface *s = new Graphics::Surface();
- s->create(xSize, ySize, srcImage.format);
-
- int *horizUsage = scaleLine(xSize, srcImage.w);
- int *vertUsage = scaleLine(ySize, srcImage.h);
-
- // Loop to create scaled version
- for (int yp = 0; yp < ySize; ++yp) {
- const byte *srcP = (const byte *)srcImage.getBasePtr(0, vertUsage[yp]);
- byte *destP = (byte *)s->getBasePtr(0, yp);
-
- for (int xp = 0; xp < xSize; ++xp) {
- const byte *tempSrcP = srcP + (horizUsage[xp] * srcImage.format.bytesPerPixel);
- for (int byteCtr = 0; byteCtr < srcImage.format.bytesPerPixel; ++byteCtr) {
- *destP++ = *tempSrcP++;
- }
- }
- }
-
- // Delete arrays and return surface
- delete[] horizUsage;
- delete[] vertUsage;
- return s;
-}
-
-/**
- * Returns an array indicating which pixels of a source image horizontally or vertically get
- * included in a scaled image
- */
-int *RenderedImage::scaleLine(int size, int srcSize) {
- int scale = 100 * size / srcSize;
- assert(scale > 0);
- int *v = new int[size];
- Common::fill(v, &v[size], 0);
-
- int distCtr = 0;
- int *destP = v;
- for (int distIndex = 0; distIndex < srcSize; ++distIndex) {
- distCtr += scale;
- while (distCtr >= 100) {
- assert(destP < &v[size]);
- *destP++ = distIndex;
- distCtr -= 100;
- }
- }
-
- return v;
-}
-
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/image/renderedimage.h b/engines/sword25/gfx/image/renderedimage.h
index a25b258592..116f97de26 100644
--- a/engines/sword25/gfx/image/renderedimage.h
+++ b/engines/sword25/gfx/image/renderedimage.h
@@ -104,8 +104,6 @@ public:
return true;
}
- static Graphics::Surface *scale(const Graphics::Surface &srcImage, int xSize, int ySize);
-
void setIsTransparent(bool isTransparent) { _isTransparent = isTransparent; }
virtual bool isSolid() const { return !_isTransparent; }
@@ -119,7 +117,6 @@ private:
Graphics::Surface *_backSurface;
void checkForTransparency();
- static int *scaleLine(int size, int srcSize);
};
} // End of namespace Sword25