diff options
Diffstat (limited to 'engines/lab/vga.cpp')
-rw-r--r-- | engines/lab/vga.cpp | 141 |
1 files changed, 1 insertions, 140 deletions
diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp index 8ee0d3445e..95099dc0b7 100644 --- a/engines/lab/vga.cpp +++ b/engines/lab/vga.cpp @@ -45,7 +45,7 @@ void LabEngine::changeVolume(int delta) { void LabEngine::waitTOF() { - g_system->copyRectToScreen(_displayBuffer, _screenWidth, 0, 0, _screenWidth, _screenHeight); + g_system->copyRectToScreen(_graphics->_displayBuffer, _graphics->_screenWidth, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight); g_system->updateScreen(); _event->processInput(); @@ -58,143 +58,4 @@ void LabEngine::waitTOF() { _lastWaitTOFTicks = now; } -/*****************************************************************************/ -/* Writes any number of the 256 color registers. */ -/* first: the number of the first color register to write. */ -/* numreg: the number of registers to write */ -/* buf: a char pointer which contains the selected color registers. */ -/* Each value representing a color register occupies 3 bytes in */ -/* the array. The order is red, green then blue. The first byte */ -/* in the array is the red component of the first element selected.*/ -/* The length of the buffer is 3 times the number of registers */ -/* selected. */ -/*****************************************************************************/ -void LabEngine::writeColorRegs(byte *buf, uint16 first, uint16 numreg) { - byte tmp[256 * 3]; - - for (int i = 0; i < 256 * 3; i++) { - tmp[i] = buf[i] * 4; - } - - g_system->getPaletteManager()->setPalette(tmp, first, numreg); - - memcpy(&(_curvgapal[first * 3]), buf, numreg * 3); -} - -void LabEngine::setPalette(void *cmap, uint16 numcolors) { - if (memcmp(cmap, _curvgapal, numcolors * 3) != 0) - writeColorRegs((byte *)cmap, 0, numcolors); -} - -/*****************************************************************************/ -/* Returns the base address of the current VGA display. */ -/*****************************************************************************/ -byte *LabEngine::getCurrentDrawingBuffer() { - if (_currentDisplayBuffer) - return _currentDisplayBuffer; - - return _displayBuffer; -} - -/*****************************************************************************/ -/* Scrolls the display in the x direction by blitting. */ -/* The _tempScrollData variable must be initialized to some memory, or this */ -/* function will fail. */ -/*****************************************************************************/ -void LabEngine::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - Image im; - uint16 temp; - - im._imageData = _tempScrollData; - - if (x1 > x2) { - temp = x2; - x2 = x1; - x1 = temp; - } - - if (y1 > y2) { - temp = y2; - y2 = y1; - y1 = temp; - } - - im._width = x2 - x1 + 1 - dx; - im._height = y2 - y1 + 1; - - im.readScreenImage(x1, y1); - im.drawImage(x1 + dx, y1); - - _graphics->setAPen(0); - _graphics->rectFill(x1, y1, x1 + dx - 1, y2); -} - -/*****************************************************************************/ -/* Scrolls the display in the y direction by blitting. */ -/*****************************************************************************/ -void LabEngine::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - Image im; - uint16 temp; - - im._imageData = _tempScrollData; - - if (x1 > x2) { - temp = x2; - x2 = x1; - x1 = temp; - } - - if (y1 > y2) { - temp = y2; - y2 = y1; - y1 = temp; - } - - im._width = x2 - x1 + 1; - im._height = y2 - y1 + 1 - dy; - - im.readScreenImage(x1, y1); - im.drawImage(x1, y1 + dy); - - _graphics->setAPen(0); - _graphics->rectFill(x1, y1, x2, y1 + dy - 1); -} - -/*****************************************************************************/ -/* Overlays a region on the screen using the desired pen color. */ -/*****************************************************************************/ -void LabEngine::overlayRect(uint16 pencolor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - int w = x2 - x1 + 1; - int h = y2 - y1 + 1; - - if (x1 + w > _screenWidth) - w = _screenWidth - x1; - - if (y1 + h > _screenHeight) - h = _screenHeight - y1; - - if ((w > 0) && (h > 0)) { - char *d = (char *)getCurrentDrawingBuffer() + y1 * _screenWidth + x1; - - while (h-- > 0) { - char *dd = d; - int ww = w; - - if (y1 & 1) { - dd++; - ww--; - } - - while (ww > 0) { - *dd = pencolor; - dd += 2; - ww -= 2; - } - - d += _screenWidth; - y1++; - } - } -} - } // End of namespace Lab |