aboutsummaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorwhiterandrek2018-05-14 14:32:41 +0300
committerAdrian Frühwirth2018-05-17 19:45:16 +0200
commitff1b7ff89d03dce2e10bda136c954bb20c384c36 (patch)
tree72ce623588460edd0f3a47cd2d7b58064eb20328 /video
parent0aed2452c659225ff1910610bbcd5ec73cd65eb9 (diff)
downloadscummvm-rg350-ff1b7ff89d03dce2e10bda136c954bb20c384c36.tar.gz
scummvm-rg350-ff1b7ff89d03dce2e10bda136c954bb20c384c36.tar.bz2
scummvm-rg350-ff1b7ff89d03dce2e10bda136c954bb20c384c36.zip
VIDEO: FLIC: Fix decoding of BYTE_RUN/FLI_BRUN chunks
Our decoder currently only supports the standard FLC format which does not rely on the stored packet count (which is part of the FLI format and limited to 255 packets per line). Instead, the image width should be used as criterion when decoding a frame which allows for more than 255 packets per line. See also https://www.compuphase.com/flic.htm
Diffstat (limited to 'video')
-rw-r--r--video/flic_decoder.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/video/flic_decoder.cpp b/video/flic_decoder.cpp
index a1976e2729..57d8fb5585 100644
--- a/video/flic_decoder.cpp
+++ b/video/flic_decoder.cpp
@@ -265,9 +265,9 @@ void FlicDecoder::FlicVideoTrack::copyFrame(uint8 *data) {
void FlicDecoder::FlicVideoTrack::decodeByteRun(uint8 *data) {
byte *ptr = (byte *)_surface->getPixels();
- while ((int32)(ptr - (byte *)_surface->getPixels()) < (getWidth() * getHeight())) {
- int chunks = *data++;
- while (chunks--) {
+ for (int i = 0; i < getHeight(); ++i) {
+ data++;
+ for (int j = 0; j < getWidth();) {
int count = (int8)*data++;
if (count > 0) {
memset(ptr, *data++, count);
@@ -277,6 +277,7 @@ void FlicDecoder::FlicVideoTrack::decodeByteRun(uint8 *data) {
data += count;
}
ptr += count;
+ j += count;
}
}