aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMarisa-Chan2013-12-24 14:43:42 +0700
committerMarisa-Chan2013-12-24 14:43:42 +0700
commit621818836e6a1100bbed2dbc1520a1005f1ad9ed (patch)
tree87319880e2d9230ddd1373374cc062a6fb71fde4 /engines
parent570630ee3df60e1dd22fbab1595a4d9dfaa38774 (diff)
downloadscummvm-rg350-621818836e6a1100bbed2dbc1520a1005f1ad9ed.tar.gz
scummvm-rg350-621818836e6a1100bbed2dbc1520a1005f1ad9ed.tar.bz2
scummvm-rg350-621818836e6a1100bbed2dbc1520a1005f1ad9ed.zip
ZVISION: New easy-to-use render functions for next rendermanager generation.
Diffstat (limited to 'engines')
-rw-r--r--engines/zvision/render_manager.cpp56
-rw-r--r--engines/zvision/render_manager.h10
2 files changed, 66 insertions, 0 deletions
diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp
index fc15e18fd0..6578c850f6 100644
--- a/engines/zvision/render_manager.cpp
+++ b/engines/zvision/render_manager.cpp
@@ -721,4 +721,60 @@ void RenderManager::scaleBuffer(const void *src, void *dst, uint32 srcWidth, uin
}
}
+void RenderManager::blitSurfaceToSurface(Graphics::Surface &src, Graphics::Surface &dst, int x, int y) {
+ Common::Rect pos(x, y, x + src.w, y + src.h);
+ pos.clip(dst.w, dst.h);
+ copyRectToSurface(src, dst, Common::Rect(), pos);
+}
+
+void RenderManager::blitSurfaceToSurface(Graphics::Surface &src, Graphics::Surface &dst, int x, int y, uint32 colorkey) {
+ Common::Rect pos(x, y, x + src.w, y + src.h);
+ pos.clip(dst.w, dst.h);
+ copyRectToSurface(src, dst, Common::Rect(), pos, colorkey);
+}
+
+void RenderManager::blitSurfaceToBkg(Graphics::Surface &src, int x, int y) {
+ blitSurfaceToSurface(src, _currentBackground, x, y);
+ moveBackground(0); // Temporary workaround
+}
+
+void RenderManager::blitSurfaceToBkg(Graphics::Surface &src, int x, int y, uint32 colorkey) {
+ blitSurfaceToSurface(src, _currentBackground, x, y, colorkey);
+ moveBackground(0); // Temporary workaround
+}
+
+void RenderManager::blitSurfaceUpBkg(Graphics::Surface &src, int x, int y) {
+ blitSurfaceToSurface(src, _workingWindowBuffer, x, y);
+}
+
+void RenderManager::blitSurfaceUpBkg(Graphics::Surface &src, int x, int y, uint32 colorkey) {
+ blitSurfaceToSurface(src, _workingWindowBuffer, x, y, colorkey);
+}
+
+Graphics::Surface *RenderManager::getBkgRect(Common::Rect &rect) {
+ Common::Rect dst = rect;
+ dst.clip(_currentBackground.w, _currentBackground.h);
+
+ if (dst.isEmpty() || !dst.isValidRect())
+ return NULL;
+
+ Graphics::Surface *srf = new Graphics::Surface;
+ srf->create(dst.width(), dst.height(), _currentBackground.format);
+
+ srf->copyRectToSurface(_currentBackground, 0, 0, Common::Rect(dst));
+
+ return srf;
+}
+
+Graphics::Surface *RenderManager::loadImage(Common::String &file) {
+ Graphics::Surface *tmp = new Graphics::Surface;
+ readImageToSurface(file, *tmp);
+ return tmp;
+}
+
+Graphics::Surface *RenderManager::loadImage(const char *file) {
+ Common::String str = Common::String(file);
+ return loadImage(str);
+}
+
} // End of namespace ZVision
diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h
index 14ca704ce1..e16d3562dc 100644
--- a/engines/zvision/render_manager.h
+++ b/engines/zvision/render_manager.h
@@ -369,6 +369,16 @@ public:
void scaleBuffer(const void *src, void *dst, uint32 srcWidth, uint32 srcHeight, byte bytesPerPixel, uint32 dstWidth, uint32 dstHeight);
+ void blitSurfaceToSurface(Graphics::Surface &src, Graphics::Surface &dst, int x, int y);
+ void blitSurfaceToSurface(Graphics::Surface &src, Graphics::Surface &dst, int x, int y, uint32 colorkey);
+ void blitSurfaceToBkg(Graphics::Surface &src, int x, int y);
+ void blitSurfaceToBkg(Graphics::Surface &src, int x, int y, uint32 colorkey);
+ void blitSurfaceUpBkg(Graphics::Surface &src, int x, int y);
+ void blitSurfaceUpBkg(Graphics::Surface &src, int x, int y, uint32 colorkey);
+ Graphics::Surface *getBkgRect(Common::Rect &rect);
+ Graphics::Surface *loadImage(const char *file);
+ Graphics::Surface *loadImage(Common::String &file);
+
private:
/**
* Renders a subRectangle of an image to the backbuffer. The destinationRect and SubRect