aboutsummaryrefslogtreecommitdiff
path: root/graphics/surface.cpp
diff options
context:
space:
mode:
authorRichieSams2013-09-12 09:30:28 -0500
committerRichieSams2013-09-12 14:07:42 -0500
commit6f4e80e36e7729bd2137a1a2bde712521861b0b3 (patch)
tree2e4c575983cd1d1538b179ca3bec6ffbc11c70bb /graphics/surface.cpp
parent0874212fa72264404803c3ebc0b75fc63f2be754 (diff)
downloadscummvm-rg350-6f4e80e36e7729bd2137a1a2bde712521861b0b3.tar.gz
scummvm-rg350-6f4e80e36e7729bd2137a1a2bde712521861b0b3.tar.bz2
scummvm-rg350-6f4e80e36e7729bd2137a1a2bde712521861b0b3.zip
ZVISION: Add wrapper function for copyRectToSurface
Also rename some arguments to make them more clear
Diffstat (limited to 'graphics/surface.cpp')
-rw-r--r--graphics/surface.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index d808121c87..a8173f0e9c 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -133,17 +133,17 @@ const Surface Surface::getSubArea(const Common::Rect &area) const {
return subSurface;
}
-void Surface::copyRectToSurface(const void *buffer, int pitch, int x, int y, int width, int height) {
+void Surface::copyRectToSurface(const void *buffer, int pitch, int destX, int destY, int width, int height) {
assert(buffer);
- assert(x >= 0 && x < w);
- assert(y >= 0 && y < h);
- assert(height > 0 && y + height <= h);
- assert(width > 0 && x + width <= w);
+ assert(destX >= 0 && destX < w);
+ assert(destY >= 0 && destY < h);
+ assert(height > 0 && destY + height <= h);
+ assert(width > 0 && destX + width <= w);
// Copy buffer data to internal buffer
const byte *src = (const byte *)buffer;
- byte *dst = (byte *)getBasePtr(x, y);
+ byte *dst = (byte *)getBasePtr(destX, destY);
for (int i = 0; i < height; i++) {
memcpy(dst, src, width * format.bytesPerPixel);
src += pitch;
@@ -151,6 +151,12 @@ void Surface::copyRectToSurface(const void *buffer, int pitch, int x, int y, int
}
}
+void Surface::copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect subRect) {
+ assert(srcSurface.format == format);
+
+ copyRectToSurface(srcSurface.getBasePtr(subRect.left, subRect.top), srcSurface.pitch, destX, destY, subRect.width(), subRect.height());
+}
+
void Surface::hLine(int x, int y, int x2, uint32 color) {
// Clipping
if (y < 0 || y >= h)