Bug 1187386 (Part 1) - Make most decoder state private. r=tn

This commit is contained in:
Seth Fowler 2015-07-31 07:29:00 -07:00
parent da4feef158
commit d5de49efd5
4 changed files with 37 additions and 38 deletions

View File

@ -24,27 +24,29 @@ namespace mozilla {
namespace image {
Decoder::Decoder(RasterImage* aImage)
: mImage(aImage)
, mProgress(NoProgress)
, mImageData(nullptr)
: mImageData(nullptr)
, mImageDataLength(0)
, mColormap(nullptr)
, mColormapSize(0)
, mImage(aImage)
, mProgress(NoProgress)
, mFrameCount(0)
, mFailCode(NS_OK)
, mChunkCount(0)
, mFlags(0)
, mBytesDecoded(0)
, mInitialized(false)
, mMetadataDecode(false)
, mSendPartialInvalidations(false)
, mImageIsTransient(false)
, mImageIsLocked(false)
, mInFrame(false)
, mIsAnimated(false)
, mDataDone(false)
, mDecodeDone(false)
, mDataError(false)
, mDecodeAborted(false)
, mShouldReportError(false)
, mImageIsTransient(false)
, mImageIsLocked(false)
, mFrameCount(0)
, mFailCode(NS_OK)
, mInitialized(false)
, mMetadataDecode(false)
, mInFrame(false)
, mIsAnimated(false)
{ }
Decoder::~Decoder()

View File

@ -389,10 +389,13 @@ protected:
uint8_t aPaletteDepth,
imgFrame* aPreviousFrame);
/*
* Member variables.
*
*/
protected:
uint8_t* mImageData; // Pointer to image data in either Cairo or 8bit format
uint32_t mImageDataLength;
uint32_t* mColormap; // Current colormap to be used in Cairo format
uint32_t mColormapSize;
private:
nsRefPtr<RasterImage> mImage;
Maybe<SourceBufferIterator> mIterator;
RawAccessFrameRef mCurrentFrame;
@ -400,10 +403,9 @@ protected:
nsIntRect mInvalidRect; // Tracks an invalidation region in the current frame.
Progress mProgress;
uint8_t* mImageData; // Pointer to image data in either Cairo or 8bit format
uint32_t mImageDataLength;
uint32_t* mColormap; // Current colormap to be used in Cairo format
uint32_t mColormapSize;
uint32_t mFrameCount; // Number of frames, including anything in-progress
nsresult mFailCode;
// Telemetry data for this decoder.
TimeDuration mDecodeTime;
@ -411,24 +413,19 @@ protected:
uint32_t mFlags;
size_t mBytesDecoded;
bool mSendPartialInvalidations;
bool mDataDone;
bool mDecodeDone;
bool mDataError;
bool mDecodeAborted;
bool mShouldReportError;
bool mImageIsTransient;
bool mImageIsLocked;
private:
uint32_t mFrameCount; // Number of frames, including anything in-progress
nsresult mFailCode;
bool mInitialized;
bool mMetadataDecode;
bool mInFrame;
bool mIsAnimated;
bool mInitialized : 1;
bool mMetadataDecode : 1;
bool mSendPartialInvalidations : 1;
bool mImageIsTransient : 1;
bool mImageIsLocked : 1;
bool mInFrame : 1;
bool mIsAnimated : 1;
bool mDataDone : 1;
bool mDecodeDone : 1;
bool mDataError : 1;
bool mDecodeAborted : 1;
bool mShouldReportError : 1;
};
} // namespace image

View File

@ -248,7 +248,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount)
return; // I/O suspension
}
int sampleSize = mImage->GetRequestedSampleSize();
int sampleSize = GetImage()->GetRequestedSampleSize();
if (sampleSize > 0) {
mInfo.scale_num = 1;
mInfo.scale_denom = sampleSize;

View File

@ -178,7 +178,7 @@ nsPNGDecoder::CreateFrame(png_uint_32 aXOffset, png_uint_32 aYOffset,
("PNGDecoderAccounting: nsPNGDecoder::CreateFrame -- created "
"image frame with %dx%d pixels in container %p",
aWidth, aHeight,
&mImage));
GetImage()));
#ifdef PNG_APNG_SUPPORTED
if (png_get_valid(mPNG, mInfo, PNG_INFO_acTL)) {