diff options
author | Filippos Karapetis | 2015-12-03 14:12:31 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-23 21:33:48 +0100 |
commit | 23b70db958604649f5a324a09da56c5dc86a57c0 (patch) | |
tree | 6ac3c49b2779cebcff0cc5780f6f3083c4779aae /engines/lab/vga.cpp | |
parent | f76f0d957a3945a6a503ab0c26da0f08ed4842a3 (diff) | |
download | scummvm-rg350-23b70db958604649f5a324a09da56c5dc86a57c0.tar.gz scummvm-rg350-23b70db958604649f5a324a09da56c5dc86a57c0.tar.bz2 scummvm-rg350-23b70db958604649f5a324a09da56c5dc86a57c0.zip |
LAB: Cleanup of palette code
Diffstat (limited to 'engines/lab/vga.cpp')
-rw-r--r-- | engines/lab/vga.cpp | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index d64953c6b9..73f80b29f8 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -49,7 +49,7 @@ bool LabEngine::createScreen(bool hiRes) { } _screenBytesPerPage = _screenWidth * _screenHeight; - _displayBuffer = (byte *)malloc(_screenBytesPerPage); + _displayBuffer = new byte[_screenBytesPerPage]; // FIXME: Memory leak! return true; } @@ -76,19 +76,6 @@ void LabEngine::waitTOF() { _lastWaitTOFTicks = now; } -void LabEngine::applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow) { - byte tmp[256 * 3]; - - for (int i = 0; i < 256 * 3; i++) { - tmp[i] = buf[i] * 4; - } - - g_system->getPaletteManager()->setPalette(tmp, first, numreg); - - if (slow) - waitTOF(); -} - /*****************************************************************************/ /* Writes any number of the 256 color registers. */ /* first: the number of the first color register to write. */ @@ -101,22 +88,15 @@ void LabEngine::applyPalette(byte *buf, uint16 first, uint16 numreg, uint16 slow /* selected. */ /*****************************************************************************/ void LabEngine::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { - applyPalette(buf, first, numreg, 0); - memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); -} + byte tmp[256 * 3]; -void LabEngine::writeColorRegsSmooth(byte *buf, uint16 first, uint16 numreg) { - applyPalette(buf, first, numreg, 1); - memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); -} + for (int i = 0; i < 256 * 3; i++) { + tmp[i] = buf[i] * 4; + } -/*****************************************************************************/ -/* Sets one of the 256 (0..255) color registers. buf is a char pointer, */ -/* the first character in the string is the red value, then green, then */ -/* blue. Each color value is a 6 bit value. */ -/*****************************************************************************/ -void LabEngine::writeColorReg(byte *buf, uint16 regnum) { - writeColorRegs(buf, regnum, 1); + g_system->getPaletteManager()->setPalette(tmp, first, numreg); + + memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); } void LabEngine::setPalette(void *cmap, uint16 numcolors) { |