2001-02-20 22:45:10 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 11:12:37 +00:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-02-20 22:45:10 +00:00
|
|
|
|
|
|
|
#ifndef _nsGIFDecoder2_h
|
|
|
|
#define _nsGIFDecoder2_h
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2010-08-23 02:30:46 +00:00
|
|
|
#include "Decoder.h"
|
2001-02-20 23:45:51 +00:00
|
|
|
#include "imgIDecoderObserver.h"
|
2001-02-20 22:45:10 +00:00
|
|
|
|
|
|
|
#include "GIF2.h"
|
|
|
|
|
2010-08-14 04:09:49 +00:00
|
|
|
namespace mozilla {
|
2012-01-06 16:02:27 +00:00
|
|
|
namespace image {
|
2010-08-14 04:09:49 +00:00
|
|
|
class RasterImage;
|
|
|
|
|
2001-02-20 22:45:10 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// nsGIFDecoder2 Definition
|
|
|
|
|
2010-08-23 02:30:46 +00:00
|
|
|
class nsGIFDecoder2 : public Decoder
|
2001-02-20 22:45:10 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2011-09-29 13:17:13 +00:00
|
|
|
nsGIFDecoder2(RasterImage &aImage, imgIDecoderObserver* aObserver);
|
2005-03-10 13:31:26 +00:00
|
|
|
~nsGIFDecoder2();
|
2001-05-31 14:25:33 +00:00
|
|
|
|
2010-09-12 15:22:30 +00:00
|
|
|
virtual void WriteInternal(const char* aBuffer, PRUint32 aCount);
|
|
|
|
virtual void FinishInternal();
|
2011-09-22 20:25:56 +00:00
|
|
|
virtual Telemetry::ID SpeedHistogram();
|
2010-08-23 02:30:46 +00:00
|
|
|
|
2007-06-25 16:41:21 +00:00
|
|
|
private:
|
|
|
|
/* These functions will be called when the decoder has a decoded row,
|
|
|
|
* frame size information, etc. */
|
2001-05-31 14:25:33 +00:00
|
|
|
|
2007-06-25 16:41:21 +00:00
|
|
|
void BeginGIF();
|
2011-08-18 02:41:26 +00:00
|
|
|
nsresult BeginImageFrame(PRUint16 aDepth);
|
2007-06-25 16:41:21 +00:00
|
|
|
void EndImageFrame();
|
2010-09-12 15:22:30 +00:00
|
|
|
void FlushImageData();
|
|
|
|
void FlushImageData(PRUint32 fromRow, PRUint32 rows);
|
2003-02-22 16:38:47 +00:00
|
|
|
|
2007-06-25 16:41:21 +00:00
|
|
|
nsresult GifWrite(const PRUint8 * buf, PRUint32 numbytes);
|
|
|
|
PRUint32 OutputRow();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool DoLzw(const PRUint8 *q);
|
2003-02-22 16:38:47 +00:00
|
|
|
|
2007-06-25 16:41:21 +00:00
|
|
|
inline int ClearCode() const { return 1 << mGIFStruct.datasize; }
|
|
|
|
|
2001-04-25 19:52:49 +00:00
|
|
|
PRInt32 mCurrentRow;
|
|
|
|
PRInt32 mLastFlushedRow;
|
|
|
|
|
2007-11-07 21:33:57 +00:00
|
|
|
PRUint8 *mImageData; // Pointer to image data in either Cairo or 8bit format
|
2007-08-26 05:08:53 +00:00
|
|
|
PRUint32 *mColormap; // Current colormap to be used in Cairo format
|
Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc
--HG--
rename : gfx/src/shared/gfxImageFrame.cpp => modules/libpr0n/src/imgFrame.cpp
rename : gfx/src/shared/gfxImageFrame.h => modules/libpr0n/src/imgFrame.h
2009-07-21 01:50:15 +00:00
|
|
|
PRUint32 mColormapSize;
|
2007-08-26 05:08:53 +00:00
|
|
|
PRUint32 mOldColor; // The old value of the transparent pixel
|
2009-07-22 04:20:01 +00:00
|
|
|
|
|
|
|
// The frame number of the currently-decoding frame when we're in the middle
|
|
|
|
// of decoding it, and -1 otherwise.
|
|
|
|
PRInt32 mCurrentFrame;
|
|
|
|
|
2001-05-31 14:25:33 +00:00
|
|
|
PRUint8 mCurrentPass;
|
|
|
|
PRUint8 mLastFlushedPass;
|
2009-09-12 05:27:13 +00:00
|
|
|
PRUint8 mColorMask; // Apply this to the pixel to keep within colormap
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mGIFOpen;
|
|
|
|
bool mSawTransparency;
|
2001-02-20 22:45:10 +00:00
|
|
|
|
2007-06-25 16:41:21 +00:00
|
|
|
gif_struct mGIFStruct;
|
|
|
|
};
|
2002-09-17 23:05:27 +00:00
|
|
|
|
2012-01-06 16:02:27 +00:00
|
|
|
} // namespace image
|
2010-08-23 02:30:46 +00:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2001-02-20 22:45:10 +00:00
|
|
|
#endif
|