X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=pdf2swf%2Fxpdf%2FStream.h;h=e1e7bae4282e591acd1594002e07667639a650c0;hp=0b70afa45c3d4e42a7c58ad3330b3534ae2302b8;hb=85c46a8011c7fd5e4bda282266006c972ea7606b;hpb=b0d012f83219d898e9cd92281d9996bc9ff13b5f diff --git a/pdf2swf/xpdf/Stream.h b/pdf2swf/xpdf/Stream.h index 0b70afa..e1e7bae 100644 --- a/pdf2swf/xpdf/Stream.h +++ b/pdf2swf/xpdf/Stream.h @@ -19,9 +19,7 @@ #include "gtypes.h" #include "Object.h" -#ifndef NO_DECRYPTION class Decrypt; -#endif class BaseStream; //------------------------------------------------------------------------ @@ -40,6 +38,13 @@ enum StreamKind { strWeird // internal-use stream types }; +enum StreamColorSpaceMode { + streamCSNone, + streamCSDeviceGray, + streamCSDeviceRGB, + streamCSDeviceCMYK +}; + //------------------------------------------------------------------------ // Stream (base class) //------------------------------------------------------------------------ @@ -102,15 +107,14 @@ public: // Is this an encoding filter? virtual GBool isEncoder() { return gFalse; } + // Get image parameters which are defined by the stream contents. + virtual void getImageParams(int *bitsPerComponent, + StreamColorSpaceMode *csMode) {} + // Add filters to this stream according to the parameters in . // Returns the new stream. Stream *addFilters(Object *dict); - // Tell this stream to ignore any length limitation -- this only - // applies to BaseStream subclasses, and is used as a hack to work - // around broken PDF files with incorrect stream lengths. - virtual void ignoreLength() {} - private: Stream *makeFilter(char *name, Stream *str, Object *params); @@ -140,17 +144,13 @@ public: virtual Guint getStart() = 0; virtual void moveStart(int delta) = 0; -#ifndef NO_DECRYPTION // Set decryption for this stream. virtual void doDecryption(Guchar *fileKey, int keyLength, int objNum, int objGen); -#endif -#ifndef NO_DECRYPTION protected: Decrypt *decrypt; -#endif private: @@ -173,7 +173,6 @@ public: virtual void setPos(Guint pos, int dir = 0); virtual BaseStream *getBaseStream() { return str->getBaseStream(); } virtual Dict *getDict() { return str->getDict(); } - virtual void ignoreLength() { str->ignoreLength(); } protected: @@ -233,6 +232,8 @@ public: ~StreamPredictor(); + GBool isOk() { return ok; } + int lookChar(); int getChar(); @@ -250,6 +251,7 @@ private: int rowBytes; // bytes per line Guchar *predLine; // line buffer int predIdx; // current index in predLine + GBool ok; }; //------------------------------------------------------------------------ @@ -275,7 +277,6 @@ public: { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } virtual int getPos() { return bufPos + (bufPtr - buf); } virtual void setPos(Guint pos, int dir = 0); - virtual void ignoreLength() { limited = gFalse; } virtual Guint getStart() { return start; } virtual void moveStart(int delta); @@ -317,10 +318,8 @@ public: virtual void setPos(Guint pos, int dir = 0); virtual Guint getStart() { return start; } virtual void moveStart(int delta); -#ifndef NO_DECRYPTION virtual void doDecryption(Guchar *fileKey, int keyLength, int objNum, int objGen); -#endif private: @@ -591,7 +590,7 @@ private: GBool gotJFIFMarker; // set if APP0 JFIF marker was present GBool gotAdobeMarker; // set if APP14 Adobe marker was present int restartInterval; // restart interval, in MCUs - Guchar quantTables[4][64]; // quantization tables + Gushort quantTables[4][64]; // quantization tables int numQuantTables; // number of quantization tables DCTHuffTable dcHuffTables[4]; // DC Huffman tables DCTHuffTable acHuffTables[4]; // AC Huffman tables @@ -616,7 +615,7 @@ private: DCTHuffTable *acHuffTable, int *prevDC, int data[64]); void decodeImage(); - void transformDataUnit(Guchar *quantTable, + void transformDataUnit(Gushort *quantTable, int dataIn[64], Guchar dataOut[64]); int readHuffSym(DCTHuffTable *table); int readAmp(int size); @@ -700,6 +699,10 @@ private: lengthDecode[flateMaxLitCodes-257]; static FlateDecode // distance decoding info distDecode[flateMaxDistCodes]; + static FlateHuffmanTab // fixed literal code table + fixedLitCodeTab; + static FlateHuffmanTab // fixed distance code table + fixedDistCodeTab; void readSome(); GBool startBlock();