[Scummvm-cvs-logs] scummvm master -> 866f0a62572c47b223efbf344602eea77797fd1b
wjp
wjp at usecode.org
Thu Aug 25 03:00:31 CEST 2016
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
866f0a6257 DIRECTOR: Clean up padding in image decoding
Commit: 866f0a62572c47b223efbf344602eea77797fd1b
https://github.com/scummvm/scummvm/commit/866f0a62572c47b223efbf344602eea77797fd1b
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2016-08-25T02:59:52+02:00
Commit Message:
DIRECTOR: Clean up padding in image decoding
Changed paths:
engines/director/frame.cpp
engines/director/images.cpp
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 078f4eb..451a406 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -571,18 +571,13 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
if (!c)
debugC(4, kDebugImages, "%d, %d, %d", imgId, w, h);
- if (true || bc->flags & 0x20) {
- int w1 = w + 16 - w % 16;
-
- if (pic->size() * 8 == w1 * h) {
- debugC(3, kDebugImages, "Disabling compression for %d: %d x %d", imgId, w1, h);
- img = new BITDDecoder(w1, h, false);
- } else if (w % 16 <= 8) {
- // FIXME: This shouldn't actually increase the width of the surface, probably, but only affect the decoder
- img = new BITDDecoder(w + 8, h, true);
- } else {
- img = new BITDDecoder(w, h, true);
- }
+ int w1 = w;
+ if (w % 16)
+ w1 += 16 - w % 16;
+
+ if (pic->size() * 8 == w1 * h) {
+ debugC(3, kDebugImages, "Disabling compression for %d: %d x %d", imgId, w1, h);
+ img = new BITDDecoder(w, h, false);
} else {
img = new BITDDecoder(w, h, true);
}
diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index cd4487d..af35224 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -106,7 +106,14 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
BITDDecoder::BITDDecoder(int w, int h, bool comp) {
_surface = new Graphics::Surface();
- _surface->create(w, h, Graphics::PixelFormat::createFormatCLUT8());
+
+ int pitch = w;
+ if (w % 16)
+ pitch += 16 - (w % 16);
+
+ // HACK: Create a padded surface by adjusting w after create()
+ _surface->create(pitch, h, Graphics::PixelFormat::createFormatCLUT8());
+ _surface->w = w;
_palette = new byte[256 * 3];
@@ -140,7 +147,7 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
if (!_comp) {
debugC(3, kDebugImages, "Skipping compression");
for (y = 0; y < _surface->h; y++) {
- for (x = 0; x < _surface->w;) {
+ for (x = 0; x < _surface->pitch; ) {
byte color = stream.readByte();
for (int c = 0; c < 8; c++)
*((byte *)_surface->getBasePtr(x++, y)) = (color & (1 << (7 - c))) ? 0 : 0xff;
@@ -180,7 +187,7 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
for (int c = 0; c < 8; c++) {
*((byte *)_surface->getBasePtr(x, y)) = (color & (1 << (7 - c))) ? 0 : 0xff;
x++;
- if (x == _surface->w) {
+ if (x == _surface->pitch) {
y++;
x = 0;
break;
More information about the Scummvm-git-logs
mailing list