aboutsummaryrefslogtreecommitdiff
path: root/graphics/pict.h
diff options
context:
space:
mode:
authorMatthew Hoops2011-09-25 19:44:20 -0400
committerMatthew Hoops2011-10-07 11:31:41 -0400
commit583bef28ff48ae9589348c72c952bef515ce039b (patch)
tree15cca4eeb7a34bd2cb6e3533ddebcde7952349e8 /graphics/pict.h
parentd5a763b763a39dbd0873f7eb6e17105a9b1cc958 (diff)
downloadscummvm-rg350-583bef28ff48ae9589348c72c952bef515ce039b.tar.gz
scummvm-rg350-583bef28ff48ae9589348c72c952bef515ce039b.tar.bz2
scummvm-rg350-583bef28ff48ae9589348c72c952bef515ce039b.zip
GRAPHICS: Rewrite PictDecoder's opcode handling
In preparation for adding support for multiple CompressedQuickTime opcodes
Diffstat (limited to 'graphics/pict.h')
-rw-r--r--graphics/pict.h50
1 files changed, 48 insertions, 2 deletions
diff --git a/graphics/pict.h b/graphics/pict.h
index 485c88b733..b426c6ee35 100644
--- a/graphics/pict.h
+++ b/graphics/pict.h
@@ -23,6 +23,7 @@
#ifndef GRAPHICS_PICT_H
#define GRAPHICS_PICT_H
+#include "common/array.h"
#include "common/rect.h"
#include "common/scummsys.h"
@@ -37,6 +38,8 @@ namespace Graphics {
class JPEG;
struct Surface;
+#define DECLARE_OPCODE(x) void x(Common::SeekableReadStream *stream)
+
class PictDecoder {
public:
PictDecoder(Graphics::PixelFormat pixelFormat);
@@ -70,13 +73,56 @@ private:
byte _palette[256 * 3];
bool _isPaletted;
Graphics::Surface *_outputSurface;
+ bool _continueParsing;
- void decodeDirectBitsRect(Common::SeekableReadStream *stream, bool hasPalette);
- void decodeDirectBitsLine(byte *out, uint32 length, Common::SeekableReadStream *data, byte bitsPerPixel, byte bytesPerPixel);
+ // Utility Functions
+ void unpackBitsRect(Common::SeekableReadStream *stream, bool hasPalette);
+ void unpackBitsLine(byte *out, uint32 length, Common::SeekableReadStream *data, byte bitsPerPixel, byte bytesPerPixel);
+ void skipBitsRect(Common::SeekableReadStream *stream, bool hasPalette);
void decodeCompressedQuickTime(Common::SeekableReadStream *stream);
void outputPixelBuffer(byte *&out, byte value, byte bitsPerPixel);
+
+ // Opcodes
+ typedef void (PictDecoder::*OpcodeProcPICT)(Common::SeekableReadStream *stream);
+ struct PICTOpcode {
+ PICTOpcode() { op = 0; proc = 0; desc = 0; }
+ PICTOpcode(uint16 o, OpcodeProcPICT p, const char *d) { op = o; proc = p; desc = d; }
+ uint16 op;
+ OpcodeProcPICT proc;
+ const char *desc;
+ };
+ Common::Array<PICTOpcode> _opcodes;
+
+ // Common Opcodes
+ void setupOpcodesCommon();
+ DECLARE_OPCODE(o_nop);
+ DECLARE_OPCODE(o_clip);
+ DECLARE_OPCODE(o_txFont);
+ DECLARE_OPCODE(o_txFace);
+ DECLARE_OPCODE(o_pnSize);
+ DECLARE_OPCODE(o_txSize);
+ DECLARE_OPCODE(o_txRatio);
+ DECLARE_OPCODE(o_versionOp);
+ DECLARE_OPCODE(o_longText);
+ DECLARE_OPCODE(o_longComment);
+ DECLARE_OPCODE(o_opEndPic);
+ DECLARE_OPCODE(o_headerOp);
+
+ // Regular-mode Opcodes
+ void setupOpcodesNormal();
+ DECLARE_OPCODE(on_packBitsRect);
+ DECLARE_OPCODE(on_directBitsRect);
+ DECLARE_OPCODE(on_compressedQuickTime);
+
+ // QuickTime-mode Opcodes
+ void setupOpcodesQuickTime();
+ DECLARE_OPCODE(oq_packBitsRect);
+ DECLARE_OPCODE(oq_directBitsRect);
+ DECLARE_OPCODE(oq_compressedQuickTime);
};
+#undef DECLARE_OPCODE
+
} // End of namespace Graphics
#endif