aboutsummaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/codecs/indeo3.cpp6
-rw-r--r--video/coktel_decoder.cpp54
-rw-r--r--video/dxa_decoder.cpp1
-rw-r--r--video/qt_decoder.cpp2
4 files changed, 34 insertions, 29 deletions
diff --git a/video/codecs/indeo3.cpp b/video/codecs/indeo3.cpp
index 53ab56dd2d..742b30243f 100644
--- a/video/codecs/indeo3.cpp
+++ b/video/codecs/indeo3.cpp
@@ -322,10 +322,10 @@ const Graphics::Surface *Indeo3Decoder::decodeImage(Common::SeekableReadStream *
const uint32 color = _pixelFormat.RGBToColor(r, g, b);
- for (uint32 sW = 0; sW < scaleWidth; sW++, rowDest += _surface->bytesPerPixel) {
- if (_surface->bytesPerPixel == 1)
+ for (uint32 sW = 0; sW < scaleWidth; sW++, rowDest += _surface->format.bytesPerPixel) {
+ if (_surface->format.bytesPerPixel == 1)
*((uint8 *)rowDest) = (uint8)color;
- else if (_surface->bytesPerPixel == 2)
+ else if (_surface->format.bytesPerPixel == 2)
*((uint16 *)rowDest) = (uint16)color;
}
}
diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp
index 1727fbc7be..bd907baf84 100644
--- a/video/coktel_decoder.cpp
+++ b/video/coktel_decoder.cpp
@@ -92,11 +92,13 @@ void CoktelDecoder::setSurfaceMemory(void *mem, uint16 width, uint16 height, uin
assert(bpp == getPixelFormat().bytesPerPixel);
// Create a surface over this memory
- _surface.w = width;
- _surface.h = height;
- _surface.pitch = width * bpp;
- _surface.pixels = mem;
+ _surface.w = width;
+ _surface.h = height;
+ _surface.pitch = width * bpp;
+ _surface.pixels = mem;
_surface.bytesPerPixel = bpp;
+ // TODO: Check whether it is fine to assume we want the setup PixelFormat.
+ _surface.format = getPixelFormat();
_ownSurface = false;
}
@@ -134,11 +136,12 @@ void CoktelDecoder::createSurface() {
void CoktelDecoder::freeSurface() {
if (!_ownSurface) {
- _surface.w = 0;
- _surface.h = 0;
- _surface.pitch = 0;
- _surface.pixels = 0;
+ _surface.w = 0;
+ _surface.h = 0;
+ _surface.pitch = 0;
+ _surface.pixels = 0;
_surface.bytesPerPixel = 0;
+ _surface.format = Graphics::PixelFormat();
} else
_surface.free();
@@ -449,11 +452,11 @@ void CoktelDecoder::renderBlockWhole(Graphics::Surface &dstSurf, const byte *src
rect.clip(dstSurf.w, dstSurf.h);
- byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left * dstSurf.bytesPerPixel;
+ byte *dst = (byte *)dstSurf.pixels + (rect.top * dstSurf.pitch) + rect.left * dstSurf.format.bytesPerPixel;
for (int i = 0; i < rect.height(); i++) {
- memcpy(dst, src, rect.width() * dstSurf.bytesPerPixel);
+ memcpy(dst, src, rect.width() * dstSurf.format.bytesPerPixel);
- src += srcRect.width() * dstSurf.bytesPerPixel;
+ src += srcRect.width() * dstSurf.format.bytesPerPixel;
dst += dstSurf.pitch;
}
}
@@ -1375,12 +1378,12 @@ bool IMDDecoder::renderFrame(Common::Rect &rect) {
if ((type == 2) && (rect.width() == _surface.w) && (_x == 0)) {
// Directly uncompress onto the video surface
- const int offsetX = rect.left * _surface.bytesPerPixel;
+ const int offsetX = rect.left * _surface.format.bytesPerPixel;
const int offsetY = (_y + rect.top) * _surface.pitch;
const int offset = offsetX + offsetY;
if (deLZ77((byte *)_surface.pixels + offset, dataPtr, dataSize,
- _surface.w * _surface.h * _surface.bytesPerPixel - offset))
+ _surface.w * _surface.h * _surface.format.bytesPerPixel - offset))
return true;
}
@@ -1806,11 +1809,12 @@ bool VMDDecoder::assessVideoProperties() {
_videoBuffer[i] = new byte[_videoBufferSize];
memset(_videoBuffer[i], 0, _videoBufferSize);
- _8bppSurface[i].w = _width * _bytesPerPixel;
- _8bppSurface[i].h = _height;
- _8bppSurface[i].pitch = _width * _bytesPerPixel;
- _8bppSurface[i].pixels = _videoBuffer[i];
+ _8bppSurface[i].w = _width * _bytesPerPixel;
+ _8bppSurface[i].h = _height;
+ _8bppSurface[i].pitch = _width * _bytesPerPixel;
+ _8bppSurface[i].pixels = _videoBuffer[i];
_8bppSurface[i].bytesPerPixel = 1;
+ _8bppSurface[i].format = Graphics::PixelFormat::createFormatCLUT8();
}
}
@@ -2223,12 +2227,12 @@ bool VMDDecoder::renderFrame(Common::Rect &rect) {
if ((type == 2) && (rect.width() == _surface.w) && (_x == 0) && (_blitMode == 0)) {
// Directly uncompress onto the video surface
- const int offsetX = rect.left * _surface.bytesPerPixel;
+ const int offsetX = rect.left * _surface.format.bytesPerPixel;
const int offsetY = (_y + rect.top) * _surface.pitch;
const int offset = offsetX - offsetY;
if (deLZ77((byte *)_surface.pixels + offset, dataPtr, dataSize,
- _surface.w * _surface.h * _surface.bytesPerPixel - offset))
+ _surface.w * _surface.h * _surface.format.bytesPerPixel - offset))
return true;
}
@@ -2338,13 +2342,13 @@ void VMDDecoder::blit16(const Graphics::Surface &srcSurf, Common::Rect &rect) {
const byte *src = (byte *)srcSurf.pixels +
(srcRect.top * srcSurf.pitch) + srcRect.left * _bytesPerPixel;
byte *dst = (byte *)_surface.pixels +
- ((_y + rect.top) * _surface.pitch) + (_x + rect.left) * _surface.bytesPerPixel;
+ ((_y + rect.top) * _surface.pitch) + (_x + rect.left) * _surface.format.bytesPerPixel;
for (int i = 0; i < rect.height(); i++) {
const byte *srcRow = src;
byte *dstRow = dst;
- for (int j = 0; j < rect.width(); j++, srcRow += 2, dstRow += _surface.bytesPerPixel) {
+ for (int j = 0; j < rect.width(); j++, srcRow += 2, dstRow += _surface.format.bytesPerPixel) {
uint16 data = READ_LE_UINT16(srcRow);
byte r = ((data & 0x7C00) >> 10) << 3;
@@ -2355,7 +2359,7 @@ void VMDDecoder::blit16(const Graphics::Surface &srcSurf, Common::Rect &rect) {
if ((r == 0) && (g == 0) && (b == 0))
c = 0;
- if (_surface.bytesPerPixel == 2)
+ if (_surface.format.bytesPerPixel == 2)
*((uint16 *)dstRow) = (uint16) c;
}
@@ -2376,13 +2380,13 @@ void VMDDecoder::blit24(const Graphics::Surface &srcSurf, Common::Rect &rect) {
const byte *src = (byte *)srcSurf.pixels +
(srcRect.top * srcSurf.pitch) + srcRect.left * _bytesPerPixel;
byte *dst = (byte *)_surface.pixels +
- ((_y + rect.top) * _surface.pitch) + (_x + rect.left) * _surface.bytesPerPixel;
+ ((_y + rect.top) * _surface.pitch) + (_x + rect.left) * _surface.format.bytesPerPixel;
for (int i = 0; i < rect.height(); i++) {
const byte *srcRow = src;
byte *dstRow = dst;
- for (int j = 0; j < rect.width(); j++, srcRow += 3, dstRow += _surface.bytesPerPixel) {
+ for (int j = 0; j < rect.width(); j++, srcRow += 3, dstRow += _surface.format.bytesPerPixel) {
byte r = srcRow[2];
byte g = srcRow[1];
byte b = srcRow[0];
@@ -2391,7 +2395,7 @@ void VMDDecoder::blit24(const Graphics::Surface &srcSurf, Common::Rect &rect) {
if ((r == 0) && (g == 0) && (b == 0))
c = 0;
- if (_surface.bytesPerPixel == 2)
+ if (_surface.format.bytesPerPixel == 2)
*((uint16 *)dstRow) = (uint16) c;
}
diff --git a/video/dxa_decoder.cpp b/video/dxa_decoder.cpp
index a64b8f6fee..44b12c036e 100644
--- a/video/dxa_decoder.cpp
+++ b/video/dxa_decoder.cpp
@@ -102,6 +102,7 @@ bool DXADecoder::loadStream(Common::SeekableReadStream *stream) {
_surface = new Graphics::Surface();
_surface->bytesPerPixel = 1;
+ _surface->format = Graphics::PixelFormat::createFormatCLUT8();
debug(2, "flags 0x0%x framesCount %d width %d height %d rate %d", flags, getFrameCount(), getWidth(), getHeight(), getFrameRate().toInt());
diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 6c0c34a40c..24225ece89 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -381,7 +381,7 @@ const Graphics::Surface *QuickTimeDecoder::scaleSurface(const Graphics::Surface
for (int32 j = 0; j < _scaledSurface->h; j++)
for (int32 k = 0; k < _scaledSurface->w; k++)
- memcpy(_scaledSurface->getBasePtr(k, j), frame->getBasePtr((k * getScaleFactorX()).toInt() , (j * getScaleFactorY()).toInt()), frame->bytesPerPixel);
+ memcpy(_scaledSurface->getBasePtr(k, j), frame->getBasePtr((k * getScaleFactorX()).toInt() , (j * getScaleFactorY()).toInt()), frame->format.bytesPerPixel);
return _scaledSurface;
}