aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorRichieSams2013-09-08 15:13:39 -0500
committerRichieSams2013-09-09 11:16:40 -0500
commitf9b9bf5b9b5b6a438a12a77aab90bdb77deeca65 (patch)
tree648b334eae39c3af25e6193188dc70a9a5ea1938 /engines
parenta415964c6da8f36fcf649f7e0f9fb94791cd02ff (diff)
downloadscummvm-rg350-f9b9bf5b9b5b6a438a12a77aab90bdb77deeca65.tar.gz
scummvm-rg350-f9b9bf5b9b5b6a438a12a77aab90bdb77deeca65.tar.bz2
scummvm-rg350-f9b9bf5b9b5b6a438a12a77aab90bdb77deeca65.zip
ZVISION: Create method for transposing a surface
Diffstat (limited to 'engines')
-rw-r--r--engines/zvision/render_manager.cpp18
-rw-r--r--engines/zvision/render_manager.h11
2 files changed, 29 insertions, 0 deletions
diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp
index 8ac07632d6..441580c1bc 100644
--- a/engines/zvision/render_manager.cpp
+++ b/engines/zvision/render_manager.cpp
@@ -432,4 +432,22 @@ uint32 RenderManager::getCurrentBackgroundOffset() {
}
}
+Graphics::Surface *RenderManager::tranposeSurface(const Graphics::Surface *surface) {
+ Graphics::Surface *tranposedSurface = new Graphics::Surface();
+ tranposedSurface->create(surface->h, surface->w, surface->format);
+
+ uint16 *source = (uint16 *)surface->getPixels();
+ uint16 *dest = (uint16 *)tranposedSurface->getPixels();
+
+ for (uint32 y = 0; y < tranposedSurface->h; y++) {
+ uint32 columnIndex = y * tranposedSurface->w;
+
+ for (uint32 x = 0; x < tranposedSurface->w; x++) {
+ dest[columnIndex + x] = source[x * surface->w + y];
+ }
+ }
+
+ return tranposedSurface;
+}
+
} // End of namespace ZVision
diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h
index cbf69b9df2..51636ef682 100644
--- a/engines/zvision/render_manager.h
+++ b/engines/zvision/render_manager.h
@@ -195,6 +195,17 @@ public:
uint32 getCurrentBackgroundOffset();
const Graphics::Surface *getBackBuffer() { return &_backBuffer; }
+ /**
+ * Creates a copy of surface and transposes the data.
+ *
+ * Note: The user is responsible for calling free() on the returned surface
+ * and then deleting it
+ *
+ * @param surface The data to be transposed
+ * @return A copy of the surface with the data transposed
+ */
+ static Graphics::Surface *tranposeSurface(const Graphics::Surface *surface);
+
private:
/**
* Renders a subRectangle of an image to the backbuffer. The destinationRect and SubRect