aboutsummaryrefslogtreecommitdiff
path: root/engines/neverhood/graphics.cpp
diff options
context:
space:
mode:
authorjohndoe1232013-01-17 08:27:38 +0000
committerWillem Jan Palenstijn2013-05-08 20:47:39 +0200
commita98d9aa58afb4dd944616e7f194c09ff28456e1b (patch)
treef25eacc5c406f272a2acefa5e579b13a4dc68fc8 /engines/neverhood/graphics.cpp
parent6ddedc955a5d04efda9b462154ccac2df4f8966a (diff)
downloadscummvm-rg350-a98d9aa58afb4dd944616e7f194c09ff28456e1b.tar.gz
scummvm-rg350-a98d9aa58afb4dd944616e7f194c09ff28456e1b.tar.bz2
scummvm-rg350-a98d9aa58afb4dd944616e7f194c09ff28456e1b.zip
NEVERHOOD: Clean up DiskplayerScene
- Enable return to launcher - Remove obsolete comments - Remove braces in single-line statements - Remove unused non-transparent drawing code in BaseSurface::copyFrom - Clean up mouse cursor insertion code in Scene class
Diffstat (limited to 'engines/neverhood/graphics.cpp')
-rw-r--r--engines/neverhood/graphics.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp
index 1c3769dc65..5426821133 100644
--- a/engines/neverhood/graphics.cpp
+++ b/engines/neverhood/graphics.cpp
@@ -112,25 +112,17 @@ void BaseSurface::drawMouseCursorResource(MouseCursorResource &mouseCursorResour
}
}
-void BaseSurface::copyFrom(Graphics::Surface *sourceSurface, int16 x, int16 y, NDrawRect &sourceRect, bool transparent) {
- // TODO: Clipping
+void BaseSurface::copyFrom(Graphics::Surface *sourceSurface, int16 x, int16 y, NDrawRect &sourceRect) {
+ // Copy a rectangle from sourceSurface, no clipping is performed, 0 is the transparent color
byte *source = (byte*)sourceSurface->getBasePtr(sourceRect.x, sourceRect.y);
byte *dest = (byte*)_surface->getBasePtr(x, y);
int height = sourceRect.height;
- if (!transparent) {
- while (height--) {
- memcpy(dest, source, sourceRect.width);
- source += sourceSurface->pitch;
- dest += _surface->pitch;
- }
- } else {
- while (height--) {
- for (int xc = 0; xc < sourceRect.width; xc++)
- if (source[xc] != 0)
- dest[xc] = source[xc];
- source += sourceSurface->pitch;
- dest += _surface->pitch;
- }
+ while (height--) {
+ for (int xc = 0; xc < sourceRect.width; xc++)
+ if (source[xc] != 0)
+ dest[xc] = source[xc];
+ source += sourceSurface->pitch;
+ dest += _surface->pitch;
}
++_version;
}
@@ -179,7 +171,7 @@ void FontSurface::drawChar(BaseSurface *destSurface, int16 x, int16 y, byte chr)
sourceRect.y = (chr / _charsPerRow) * _charHeight;
sourceRect.width = _charWidth;
sourceRect.height = _charHeight;
- destSurface->copyFrom(_surface, x, y, sourceRect, true);
+ destSurface->copyFrom(_surface, x, y, sourceRect);
}
void FontSurface::drawString(BaseSurface *destSurface, int16 x, int16 y, const byte *string, int stringLen) {