diff options
author | Filippos Karapetis | 2008-09-11 12:04:45 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-09-11 12:04:45 +0000 |
commit | 224f95537b578bb2e3ccbf031b236bdcf7febf9f (patch) | |
tree | a489ef2ce0f825bdb5f951d0e0b24d9f1c184ec2 /engines/drascula | |
parent | c6af2e81e86d952e64515c3bb2afa0296d2c4203 (diff) | |
download | scummvm-rg350-224f95537b578bb2e3ccbf031b236bdcf7febf9f.tar.gz scummvm-rg350-224f95537b578bb2e3ccbf031b236bdcf7febf9f.tar.bz2 scummvm-rg350-224f95537b578bb2e3ccbf031b236bdcf7febf9f.zip |
Code optimizations from Fingolfin
svn-id: r34491
Diffstat (limited to 'engines/drascula')
-rw-r--r-- | engines/drascula/graphics.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index 29f984c2b4..37759c7119 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -167,8 +167,18 @@ void DrasculaEngine::copyBackground(int xorg, int yorg, int xdes, int ydes, int int height, byte *src, byte *dest) { dest += xdes + ydes * 320; src += xorg + yorg * 320; + /* Unoptimized code for (int x = 0; x < height; x++) { memcpy(dest + 320 * x, src + 320 * x, width); + } */ + + // A bit more optimized code, thanks to Fingolfin + // Uses 2 less registers and performs 2 less multiplications + int x = height; + while (x--) { + memcpy(dest, src, width); + dest += 320; + src += 320; } } @@ -223,8 +233,19 @@ void DrasculaEngine::updateScreen(int xorg, int yorg, int xdes, int ydes, int wi ptr += xdes + ydes * 320; buffer += xorg + yorg * 320; + + /* Unoptimized code for (int x = 0; x < height; x++) { memcpy(ptr + 320 * x, buffer + 320 * x, width); + } */ + + // A bit more optimized code, thanks to Fingolfin + // Uses 2 less registers and performs 2 less multiplications + int x = height; + while (x--) { + memcpy(ptr, buffer, width); + ptr += 320; + buffer += 320; } _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); |