From 26e2c0e96ee75bf827512f3487fa5b2db20b71ed Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Thu, 4 Sep 2014 16:08:33 -0400 Subject: [PATCH] Bug 1063084 - BMP with compression can be transparent. r=seth --- image/decoders/nsBMPDecoder.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/image/decoders/nsBMPDecoder.cpp b/image/decoders/nsBMPDecoder.cpp index c12cad58dd15..ce8be0ce11a6 100644 --- a/image/decoders/nsBMPDecoder.cpp +++ b/image/decoders/nsBMPDecoder.cpp @@ -742,6 +742,9 @@ nsBMPDecoder::WriteInternal(const char* aBuffer, uint32_t aCount, DecodeStrategy byte = *aBuffer++; aCount--; mCurPos += byte; + // Delta encoding makes it possible to skip pixels making + // the image transparent. + mUseAlphaData = mHaveAlphaData = true; if (mCurPos > mBIH.width) mCurPos = mBIH.width; @@ -753,6 +756,9 @@ nsBMPDecoder::WriteInternal(const char* aBuffer, uint32_t aCount, DecodeStrategy byte = *aBuffer++; aCount--; mState = eRLEStateInitial; + // Delta encoding makes it possible to skip pixels making + // the image transparent. + mUseAlphaData = mHaveAlphaData = true; mCurLine -= std::min(byte, mCurLine); break;