diff options
author | Paul Gilbert | 2016-07-03 13:52:09 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:27:06 -0400 |
commit | 5ab33f117a0bc3451a1d30024208c45a2a548a4b (patch) | |
tree | d46420a6762b30dd8edb703b3846ebace3393d2c /engines/titanic/support/video_surface.cpp | |
parent | d9e05e215c1ba8ab93530e7263b527c03fcc61c8 (diff) | |
download | scummvm-rg350-5ab33f117a0bc3451a1d30024208c45a2a548a4b.tar.gz scummvm-rg350-5ab33f117a0bc3451a1d30024208c45a2a548a4b.tar.bz2 scummvm-rg350-5ab33f117a0bc3451a1d30024208c45a2a548a4b.zip |
TITANIC: Adding more video surface methods
Diffstat (limited to 'engines/titanic/support/video_surface.cpp')
-rw-r--r-- | engines/titanic/support/video_surface.cpp | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 9293b03f02..e71b25184b 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -296,7 +296,14 @@ int OSVideoSurface::getPitch() { return _ddSurface->getPitch(); } -void OSVideoSurface::resize(int width, int height) { +int OSVideoSurface::getBpp() { + if (!loadIfReady()) + error("Could not load resource"); + + return getPixelDepth(); +} + +void OSVideoSurface::recreate(int width, int height) { freeSurface(); _screenManager->resizeSurface(this, width, height); @@ -304,9 +311,19 @@ void OSVideoSurface::resize(int width, int height) { _videoSurfaceCounter += _ddSurface->getSize(); } +void OSVideoSurface::resize(int width, int height) { + if (!_ddSurface || _ddSurface->getWidth() != width || + _ddSurface->getHeight() != height) + recreate(width, height); +} + +void OSVideoSurface::detachSurface() { + _ddSurface = nullptr; +} + int OSVideoSurface::getPixelDepth() { if (!loadIfReady()) - assert(0); + error("Could not load resource"); lock(); @@ -360,6 +377,13 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) { } } +void OSVideoSurface::setPixel(const Point &pt, uint pixel) { + assert(getPixelDepth() == 2); + + uint16 *pixelP = (uint16 *)_rawSurface->getBasePtr(pt.x, pt.y); + *pixelP = pixel; +} + void OSVideoSurface::changePixel(uint16 *pixelP, uint16 *color, byte srcVal, bool remapFlag) { assert(getPixelDepth() == 2); const Graphics::PixelFormat &destFormat = _ddSurface->getFormat(); @@ -391,9 +415,17 @@ void OSVideoSurface::shiftColors() { // we already convert 16-bit surfaces as soon as they're loaded } +void OSVideoSurface::clear() { + if (!loadIfReady()) + error("Could not load resource"); + +} + void OSVideoSurface::playMovie(uint flags, CVideoSurface *surface) { if (loadIfReady() && _movie) _movie->play(flags, surface); + + _ddSurface->fill(nullptr, 0); } void OSVideoSurface::playMovie(uint startFrame, uint endFrame, int v3, bool v4) { |