aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/xsurface.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2014-12-26 18:31:05 +1100
committerPaul Gilbert2014-12-26 18:31:05 +1100
commitd213db3dc1b24e281e03dc593f21925db8fcd10e (patch)
treee78f2e0dd40efe00b791c951c5b67eea30b51aeb /engines/xeen/xsurface.cpp
parent4f423c74b701b4dceff680259d174acb6a450b76 (diff)
downloadscummvm-rg350-d213db3dc1b24e281e03dc593f21925db8fcd10e.tar.gz
scummvm-rg350-d213db3dc1b24e281e03dc593f21925db8fcd10e.tar.bz2
scummvm-rg350-d213db3dc1b24e281e03dc593f21925db8fcd10e.zip
XEEN: Converted SpriteResource to decoding sprite frames on the fly
Diffstat (limited to 'engines/xeen/xsurface.cpp')
-rw-r--r--engines/xeen/xsurface.cpp43
1 files changed, 23 insertions, 20 deletions
diff --git a/engines/xeen/xsurface.cpp b/engines/xeen/xsurface.cpp
index b5f08f4603..f63ad14350 100644
--- a/engines/xeen/xsurface.cpp
+++ b/engines/xeen/xsurface.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "common/algorithm.h"
#include "xeen/xsurface.h"
namespace Xeen {
@@ -39,41 +40,43 @@ void XSurface::create(uint16 w, uint16 h) {
Graphics::Surface::create(w, h, Graphics::PixelFormat::createFormatCLUT8());
}
-void XSurface::transBlitFrom(const XSurface &src) {
- transBlitFrom(src, Common::Point());
+void XSurface::transBlitTo(XSurface &dest) const {
+ transBlitTo(dest, Common::Point());
}
-void XSurface::blitFrom(const XSurface &src) {
- blitFrom(src, Common::Point());
+void XSurface::blitTo(XSurface &dest) const {
+ blitTo(dest, Common::Point());
}
-void XSurface::transBlitFrom(const XSurface &src, const Common::Point &destPos) {
- if (getPixels() == nullptr)
- create(w, h);
+void XSurface::transBlitTo(XSurface &dest, const Common::Point &destPos) const {
+ if (dest.getPixels() == nullptr)
+ dest.create(w, h);
- for (int yp = 0; yp < src.h; ++yp) {
- const byte *srcP = (const byte *)src.getBasePtr(0, yp);
- byte *destP = (byte *)getBasePtr(destPos.x, destPos.y + yp);
+ for (int yp = 0; yp < h; ++yp) {
+ const byte *srcP = (const byte *)getBasePtr(0, yp);
+ byte *destP = (byte *)dest.getBasePtr(destPos.x, destPos.y + yp);
- for (int xp = 0; xp < this->w; ++xp, ++srcP, ++destP) {
+ for (int xp = 0; xp < w; ++xp, ++srcP, ++destP) {
if (*srcP != 0)
*destP = *srcP;
}
}
+
+ dest.addDirtyRect(Common::Rect(destPos.x, destPos.y, destPos.x + w, destPos.y));
}
-void XSurface::blitFrom(const XSurface &src, const Common::Point &destPos) {
- if (getPixels() == nullptr)
- create(w, h);
+void XSurface::blitTo(XSurface &dest, const Common::Point &destPos) const {
+ if (dest.getPixels() == nullptr)
+ dest.create(w, h);
- for (int yp = 0; yp < src.h; ++yp) {
- const byte *srcP = (const byte *)src.getBasePtr(0, yp);
- byte *destP = (byte *)getBasePtr(destPos.x, destPos.y + yp);
+ for (int yp = 0; yp < h; ++yp) {
+ const byte *srcP = (const byte *)getBasePtr(0, yp);
+ byte *destP = (byte *)dest.getBasePtr(destPos.x, destPos.y + yp);
- for (int xp = 0; xp < this->w; ++xp, ++srcP, ++destP) {
- *destP = *srcP;
- }
+ Common::copy(srcP, srcP + w, destP);
}
+
+ dest.addDirtyRect(Common::Rect(destPos.x, destPos.y, destPos.x + w, destPos.y));
}
} // End of namespace Xeen