| Index: src/codec/SkCodec_libgif.h
|
| diff --git a/src/codec/SkCodec_libgif.h b/src/codec/SkCodec_libgif.h
|
| index df0108895150d393a47e6831bf584965a3c36f6b..fb10bce0c6a93ac8d92fb51937e6f26e3a06d9db 100644
|
| --- a/src/codec/SkCodec_libgif.h
|
| +++ b/src/codec/SkCodec_libgif.h
|
| @@ -6,7 +6,10 @@
|
| */
|
|
|
| #include "SkCodec.h"
|
| +#include "SkColorTable.h"
|
| #include "SkImageInfo.h"
|
| +#include "SkScanlineDecoder.h"
|
| +#include "SkSwizzler.h"
|
|
|
| #include "gif_lib.h"
|
|
|
| @@ -29,7 +32,8 @@ public:
|
| * Reads enough of the stream to determine the image format
|
| */
|
| static SkCodec* NewFromStream(SkStream*);
|
| -
|
| +
|
| + static SkScanlineDecoder* NewSDFromStream(SkStream* stream);
|
|
|
| protected:
|
|
|
| @@ -52,10 +56,11 @@ protected:
|
| * Ownership is unchanged when we returned a gifOut.
|
| *
|
| */
|
| - static bool ReadHeader(SkStream* stream, SkCodec** codecOut, GifFileType** gifOut);
|
| + static bool ReadHeader(SkStream* stream, SkCodec** codecOut,
|
| + GifFileType** gifOut);
|
|
|
| /*
|
| - * Initiates the gif decode
|
| + * Performs the full gif decode
|
| */
|
| Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&,
|
| SkPMColor*, int32_t*) override;
|
| @@ -69,6 +74,62 @@ protected:
|
| private:
|
|
|
| /*
|
| + * A gif can contain multiple image frames. We will only decode the first
|
| + * frame. This function reads up to the first image frame, processing
|
| + * transparency and/or animation information that comes before the image
|
| + * data.
|
| + *
|
| + * @param transIndex This call will set the transparent index based on the
|
| + * extension data.
|
| + */
|
| + SkCodec::Result readUpToFirstImage(uint32_t* transIndex);
|
| +
|
| + /*
|
| + * A gif may contain many image frames, all of different sizes.
|
| + * This function checks if the frame dimensions are valid and corrects
|
| + * them if necessary. It then sets fFrameDims to the corrected
|
| + * dimensions.
|
| + *
|
| + * @param desc The image frame descriptor
|
| + */
|
| + bool setFrameDimensions(const GifImageDesc& desc);
|
| +
|
| + /*
|
| + * Initializes the color table that we will use for decoding.
|
| + *
|
| + * @param dstInfo Contains the requested dst color type.
|
| + * @param inputColorPtr Copies the encoded color table to the client's
|
| + * input color table if the client requests kIndex8.
|
| + * @param inputColorCount If the client requests kIndex8, sets
|
| + * inputColorCount to 256. Since gifs always
|
| + * contain 8-bit indices, we need a 256 entry color
|
| + * table to ensure that indexing is always in
|
| + * bounds.
|
| + * @param transIndex The transparent index. This is set in
|
| + * readUpToFirstImage(). An invalid value indicates
|
| + * that there is no transparent index.
|
| + */
|
| + void initializeColorTable(const SkImageInfo& dstInfo, SkPMColor* colorPtr,
|
| + int* inputColorCount, uint32_t transIndex);
|
| +
|
| + /*
|
| + * Initializes the swizzler.
|
| + *
|
| + * @param dstInfo Output image information. Dimensions may have been
|
| + * adjusted if the image frame size does not match the size
|
| + * indicated in the header.
|
| + * @param zeroInit Indicates if destination memory is zero initialized.
|
| + */
|
| + SkCodec::Result initializeSwizzler(const SkImageInfo& dstInfo,
|
| + ZeroInitialized zeroInit);
|
| +
|
| + /*
|
| + * @return kSuccess if the read is successful and kIncompleteInput if the
|
| + * read fails.
|
| + */
|
| + SkCodec::Result readRow();
|
| +
|
| + /*
|
| * This function cleans up the gif object after the decode completes
|
| * It is used in a SkAutoTCallIProc template
|
| */
|
| @@ -92,6 +153,14 @@ private:
|
| SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType* gif);
|
|
|
| SkAutoTCallVProc<GifFileType, CloseGif> fGif; // owned
|
| + SkAutoTDeleteArray<uint8_t> fSrcBuffer;
|
| + SkIRect fFrameDims;
|
| + uint32_t fFillIndex;
|
| + bool fFrameIsSubset;
|
| + SkAutoTDelete<SkSwizzler> fSwizzler;
|
| + SkAutoTUnref<SkColorTable> fColorTable;
|
| +
|
| + friend class SkGifScanlineDecoder;
|
|
|
| typedef SkCodec INHERITED;
|
| };
|
|
|