aboutsummaryrefslogtreecommitdiff
path: root/graphics/video
diff options
context:
space:
mode:
authorSven Hesse2010-08-08 00:38:26 +0000
committerSven Hesse2010-08-08 00:38:26 +0000
commit12c9e895b559d1ca2780b5b8f156b0451eb11f11 (patch)
treeff02282ada6558e80be9d1eab7768571c680040f /graphics/video
parent9255d2e2179ee6a2cd63b6d8f521e3b9d8543be6 (diff)
downloadscummvm-rg350-12c9e895b559d1ca2780b5b8f156b0451eb11f11.tar.gz
scummvm-rg350-12c9e895b559d1ca2780b5b8f156b0451eb11f11.tar.bz2
scummvm-rg350-12c9e895b559d1ca2780b5b8f156b0451eb11f11.zip
VIDEO/GOB: Add CoktelDecoder::setXY()
This allows for positioning the video within the video memory. svn-id: r51858
Diffstat (limited to 'graphics/video')
-rw-r--r--graphics/video/coktel_decoder.cpp18
-rw-r--r--graphics/video/coktel_decoder.h6
2 files changed, 20 insertions, 4 deletions
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp
index d13e678d44..6f846c9a07 100644
--- a/graphics/video/coktel_decoder.cpp
+++ b/graphics/video/coktel_decoder.cpp
@@ -34,7 +34,7 @@ CoktelDecoder::State::State() : left(0), top(0), right(0), bottom(0), flags(0),
CoktelDecoder::CoktelDecoder(Audio::Mixer &mixer, Audio::Mixer::SoundType soundType) :
- _mixer(&mixer), _soundType(soundType), _width(0), _height(0), _frameCount(0),
+ _mixer(&mixer), _soundType(soundType), _width(0), _height(0), _x(0), _y(0), _frameCount(0),
_paletteDirty(false), _ownSurface(true) {
memset(_palette, 0, 768);
@@ -92,8 +92,18 @@ void CoktelDecoder::freeSurface() {
_ownSurface = true;
}
+void CoktelDecoder::setXY(uint16 x, uint16 y) {
+ _x = x;
+ _y = y;
+}
+
void CoktelDecoder::close() {
freeSurface();
+
+ _x = 0;
+ _y = 0;
+
+ _frameCount = 0;
}
uint16 CoktelDecoder::getWidth() const {
@@ -289,11 +299,11 @@ void PreIMDDecoder::processFrame() {
}
void PreIMDDecoder::renderFrame() {
- uint16 w = MIN<uint16>(_surface.w, _width);
- uint16 h = MIN<uint16>(_surface.h, _height);
+ uint16 w = CLIP<int32>(_surface.w - _x, 0, _width);
+ uint16 h = CLIP<int32>(_surface.h - _y, 0, _height);
const byte *src = _videoBuffer;
- byte *dst = (byte *) _surface.pixels; // + x/y
+ byte *dst = (byte *) _surface.pixels + (_y * _surface.pitch) + _x;
uint32 frameDataSize = _videoBufferSize;
diff --git a/graphics/video/coktel_decoder.h b/graphics/video/coktel_decoder.h
index ec9acbe879..a4d12c5294 100644
--- a/graphics/video/coktel_decoder.h
+++ b/graphics/video/coktel_decoder.h
@@ -69,6 +69,9 @@ public:
/** Reset the video memory. */
void setSurfaceMemory();
+ /** Draw the video starting at this position within the video memory. */
+ void setXY(uint16 x, uint16 y);
+
// VideoDecoder interface
void close();
@@ -88,6 +91,9 @@ protected:
uint16 _width;
uint16 _height;
+ uint16 _x;
+ uint16 _y;
+
uint32 _frameCount;
byte _palette[768];