mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1215361 (part 2) - Streamline nsBMPDecoder's getters. r=seth.
- GetBitsPerPixel() and GetWidth() are no longer used. - GetHeight() is now only used within nsBMPDecoder and can be renamed and inlined into the header. - GetImageData() can be inlined into the header.
This commit is contained in:
parent
a30977afce
commit
62b24e3b47
@ -217,35 +217,6 @@ nsBMPDecoder::~nsBMPDecoder()
|
||||
{
|
||||
}
|
||||
|
||||
// Obtains the bits per pixel from the internal BIH header.
|
||||
int32_t
|
||||
nsBMPDecoder::GetBitsPerPixel() const
|
||||
{
|
||||
return mH.mBpp;
|
||||
}
|
||||
|
||||
// Obtains the width from the internal BIH header.
|
||||
int32_t
|
||||
nsBMPDecoder::GetWidth() const
|
||||
{
|
||||
return mH.mWidth;
|
||||
}
|
||||
|
||||
// Obtains the absolute value of the height from the internal BIH header.
|
||||
// If it's positive the bitmap is stored bottom to top, otherwise top to bottom.
|
||||
int32_t
|
||||
nsBMPDecoder::GetHeight() const
|
||||
{
|
||||
return abs(mH.mHeight);
|
||||
}
|
||||
|
||||
// Obtains the internal output image buffer.
|
||||
uint32_t*
|
||||
nsBMPDecoder::GetImageData()
|
||||
{
|
||||
return reinterpret_cast<uint32_t*>(mImageData);
|
||||
}
|
||||
|
||||
// Obtains the size of the compressed image resource.
|
||||
int32_t
|
||||
nsBMPDecoder::GetCompressedImageSize() const
|
||||
@ -253,7 +224,7 @@ nsBMPDecoder::GetCompressedImageSize() const
|
||||
// In the RGB case mImageSize might not be set, so compute it manually.
|
||||
MOZ_ASSERT(mPixelRowSize != 0);
|
||||
return mH.mCompression == Compression::RGB
|
||||
? mPixelRowSize * GetHeight()
|
||||
? mPixelRowSize * AbsoluteHeight()
|
||||
: mH.mImageSize;
|
||||
}
|
||||
|
||||
@ -270,7 +241,7 @@ nsBMPDecoder::FinishInternal()
|
||||
if (!IsMetadataDecode() && HasSize()) {
|
||||
|
||||
// Invalidate.
|
||||
nsIntRect r(0, 0, mH.mWidth, GetHeight());
|
||||
nsIntRect r(0, 0, mH.mWidth, AbsoluteHeight());
|
||||
PostInvalidation(r);
|
||||
|
||||
if (mDoesHaveTransparency) {
|
||||
@ -597,9 +568,9 @@ nsBMPDecoder::ReadInfoHeaderRest(const char* aData, size_t aLength)
|
||||
}
|
||||
|
||||
// Post our size to the superclass.
|
||||
uint32_t realHeight = GetHeight();
|
||||
PostSize(mH.mWidth, realHeight);
|
||||
mCurrentRow = realHeight;
|
||||
uint32_t absHeight = AbsoluteHeight();
|
||||
PostSize(mH.mWidth, absHeight);
|
||||
mCurrentRow = absHeight;
|
||||
|
||||
// Round it up to the nearest byte count, then pad to 4-byte boundary.
|
||||
// Compute this even for a metadate decode because GetCompressedImageSize()
|
||||
|
@ -125,17 +125,10 @@ class nsBMPDecoder : public Decoder
|
||||
public:
|
||||
~nsBMPDecoder();
|
||||
|
||||
/// Obtains the bits per pixel from the internal BIH header.
|
||||
int32_t GetBitsPerPixel() const;
|
||||
|
||||
/// Obtains the width from the internal BIH header.
|
||||
int32_t GetWidth() const;
|
||||
|
||||
/// Obtains the abs-value of the height from the internal BIH header.
|
||||
int32_t GetHeight() const;
|
||||
|
||||
/// Obtains the internal output image buffer.
|
||||
uint32_t* GetImageData();
|
||||
uint32_t* GetImageData() { return reinterpret_cast<uint32_t*>(mImageData); }
|
||||
|
||||
/// Obtains the length of the internal output image buffer.
|
||||
size_t GetImageDataLength() const { return mImageDataLength; }
|
||||
|
||||
/// Obtains the size of the compressed image resource.
|
||||
@ -190,6 +183,8 @@ private:
|
||||
// Helper constructor called by the other two.
|
||||
nsBMPDecoder(RasterImage* aImage, State aState, size_t aLength);
|
||||
|
||||
int32_t AbsoluteHeight() const { return abs(mH.mHeight); }
|
||||
|
||||
uint32_t* RowBuffer();
|
||||
|
||||
void FinishRow();
|
||||
|
Loading…
Reference in New Issue
Block a user