aboutsummaryrefslogtreecommitdiff
path: root/video/codecs/msrle.cpp
diff options
context:
space:
mode:
authorMarisa-Chan2014-06-13 21:43:04 +0700
committerMarisa-Chan2014-06-13 21:43:04 +0700
commit45589950c0fb1a449351e6a00ef10d42290d8bae (patch)
tree44e4eedcb7e69d5fc386155b000ed038af07251d /video/codecs/msrle.cpp
parent48360645dcd5f8fddb135b6e31ae5cae4be8d77f (diff)
parent5c005ad3a3f1df0bc968c85c1cf0fc48e36ab0b2 (diff)
downloadscummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.tar.gz
scummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.tar.bz2
scummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.zip
Merge remote-tracking branch 'upstream/master' into zvision
Conflicts: engines/zvision/animation/rlf_animation.cpp engines/zvision/animation_control.h engines/zvision/core/console.cpp engines/zvision/core/events.cpp engines/zvision/cursors/cursor.cpp engines/zvision/cursors/cursor_manager.cpp engines/zvision/cursors/cursor_manager.h engines/zvision/fonts/truetype_font.cpp engines/zvision/graphics/render_manager.cpp engines/zvision/graphics/render_manager.h engines/zvision/inventory/inventory_manager.h engines/zvision/inventory_manager.h engines/zvision/meta_animation.h engines/zvision/module.mk engines/zvision/scripting/actions.cpp engines/zvision/scripting/control.h engines/zvision/scripting/controls/animation_control.cpp engines/zvision/scripting/controls/animation_control.h engines/zvision/scripting/controls/input_control.cpp engines/zvision/scripting/controls/lever_control.cpp engines/zvision/scripting/controls/timer_node.cpp engines/zvision/scripting/controls/timer_node.h engines/zvision/scripting/puzzle.h engines/zvision/scripting/scr_file_handling.cpp engines/zvision/scripting/script_manager.cpp engines/zvision/scripting/script_manager.h engines/zvision/sidefx.cpp engines/zvision/sound/zork_raw.cpp engines/zvision/sound/zork_raw.h engines/zvision/video/video.cpp engines/zvision/video/zork_avi_decoder.h engines/zvision/zvision.cpp engines/zvision/zvision.h
Diffstat (limited to 'video/codecs/msrle.cpp')
-rw-r--r--video/codecs/msrle.cpp132
1 files changed, 0 insertions, 132 deletions
diff --git a/video/codecs/msrle.cpp b/video/codecs/msrle.cpp
deleted file mode 100644
index 2f2ac0334f..0000000000
--- a/video/codecs/msrle.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-// Based off ffmpeg's msrledec.c
-
-#include "video/codecs/msrle.h"
-#include "common/stream.h"
-#include "common/textconsole.h"
-
-namespace Video {
-
-MSRLEDecoder::MSRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) {
- _surface = new Graphics::Surface();
- _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- _bitsPerPixel = bitsPerPixel;
-}
-
-MSRLEDecoder::~MSRLEDecoder() {
- _surface->free();
- delete _surface;
-}
-
-const Graphics::Surface *MSRLEDecoder::decodeImage(Common::SeekableReadStream *stream) {
- if (_bitsPerPixel == 8) {
- decode8(stream);
- } else
- error("Unhandled %d bit Microsoft RLE encoding", _bitsPerPixel);
-
- return _surface;
-}
-
-void MSRLEDecoder::decode8(Common::SeekableReadStream *stream) {
-
- int x = 0;
- int y = _surface->h - 1;
-
- byte *data = (byte *) _surface->getPixels();
- uint16 width = _surface->w;
- uint16 height = _surface->h;
-
- byte *output = data + ((height - 1) * width);
- byte *output_end = data + ((height) * width);
-
- while (!stream->eos()) {
- byte count = stream->readByte();
- byte value = stream->readByte();
-
- if (count == 0) {
- if (value == 0) {
- // End of line
-
- x = 0;
- y--;
- output = data + (y * width);
-
- if (y < 0) {
- warning("MS RLE Codec: Next line is beyond picture bounds");
- return;
- }
-
- } else if (value == 1) {
- // End of image
-
- return;
- } else if (value == 2) {
- // Skip
-
- count = stream->readByte();
- value = stream->readByte();
-
- y -= value;
- x += count;
-
- if (y < 0) {
- warning("MS RLE Codec: Skip beyond picture bounds");
- return;
- }
-
- output = data + ((y * width) + x);
-
- } else {
- // Copy data
-
- if (output + value > output_end) {
- stream->skip(value);
- continue;
- }
-
- for (int i = 0; i < value; i++)
- *output++ = stream->readByte();
-
- if (value & 1)
- stream->skip(1);
-
- x += value;
- }
-
- } else {
- // Run data
-
- if (output + count > output_end)
- continue;
-
- for (int i = 0; i < count; i++, x++)
- *output++ = value;
- }
-
- }
-
- warning("MS RLE Codec: No end-of-picture code");
-}
-
-} // End of namespace Video