Skip to content
Snippets Groups Projects
Commit db1a63e9 authored by Thickbrick Sleaford's avatar Thickbrick Sleaford
Browse files

FIX VWR-24420 Keep alpha channel in PNG images with background color.

Remove code that composites RGBA PNG images that specify a background
color down to RGB.
parent c132d20a
No related branches found
No related tags found
No related merge requests found
...@@ -732,6 +732,7 @@ Thickbrick Sleaford ...@@ -732,6 +732,7 @@ Thickbrick Sleaford
VWR-9287 VWR-9287
VWR-13483 VWR-13483
VWR-13947 VWR-13947
VWR-24420
Thraxis Epsilon Thraxis Epsilon
SVC-371 SVC-371
VWR-383 VWR-383
......
...@@ -50,8 +50,6 @@ LLPngWrapper::LLPngWrapper() ...@@ -50,8 +50,6 @@ LLPngWrapper::LLPngWrapper()
mCompressionType( 0 ), mCompressionType( 0 ),
mFilterMethod( 0 ), mFilterMethod( 0 ),
mFinalSize( 0 ), mFinalSize( 0 ),
mHasBKGD(false),
mBackgroundColor(),
mGamma(0.f) mGamma(0.f)
{ {
} }
...@@ -111,9 +109,9 @@ void LLPngWrapper::writeFlush(png_structp png_ptr) ...@@ -111,9 +109,9 @@ void LLPngWrapper::writeFlush(png_structp png_ptr)
} }
// Read the PNG file using the libpng. The low-level interface is used here // Read the PNG file using the libpng. The low-level interface is used here
// because we want to do various transformations (including setting the // because we want to do various transformations (including applying gama)
// matte background if any, and applying gama) which can't be done with // which can't be done with the high-level interface.
// the high-level interface. The scanline also begins at the bottom of // The scanline also begins at the bottom of
// the image (per SecondLife conventions) instead of at the top, so we // the image (per SecondLife conventions) instead of at the top, so we
// must assign row-pointers in "reverse" order. // must assign row-pointers in "reverse" order.
BOOL LLPngWrapper::readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop) BOOL LLPngWrapper::readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop)
...@@ -201,8 +199,7 @@ void LLPngWrapper::normalizeImage() ...@@ -201,8 +199,7 @@ void LLPngWrapper::normalizeImage()
// 2. Convert grayscales to RGB // 2. Convert grayscales to RGB
// 3. Create alpha layer from transparency // 3. Create alpha layer from transparency
// 4. Ensure 8-bpp for all images // 4. Ensure 8-bpp for all images
// 5. Apply background matte if any // 5. Set (or guess) gamma
// 6. Set (or guess) gamma
if (mColorType == PNG_COLOR_TYPE_PALETTE) if (mColorType == PNG_COLOR_TYPE_PALETTE)
{ {
...@@ -229,12 +226,6 @@ void LLPngWrapper::normalizeImage() ...@@ -229,12 +226,6 @@ void LLPngWrapper::normalizeImage()
{ {
png_set_strip_16(mReadPngPtr); png_set_strip_16(mReadPngPtr);
} }
mHasBKGD = png_get_bKGD(mReadPngPtr, mReadInfoPtr, &mBackgroundColor);
if (mHasBKGD)
{
png_set_background(mReadPngPtr, mBackgroundColor,
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
}
#if LL_DARWIN #if LL_DARWIN
const F64 SCREEN_GAMMA = 1.8; const F64 SCREEN_GAMMA = 1.8;
...@@ -261,7 +252,6 @@ void LLPngWrapper::updateMetaData() ...@@ -261,7 +252,6 @@ void LLPngWrapper::updateMetaData()
mBitDepth = png_get_bit_depth(mReadPngPtr, mReadInfoPtr); mBitDepth = png_get_bit_depth(mReadPngPtr, mReadInfoPtr);
mColorType = png_get_color_type(mReadPngPtr, mReadInfoPtr); mColorType = png_get_color_type(mReadPngPtr, mReadInfoPtr);
mChannels = png_get_channels(mReadPngPtr, mReadInfoPtr); mChannels = png_get_channels(mReadPngPtr, mReadInfoPtr);
mHasBKGD = png_get_bKGD(mReadPngPtr, mReadInfoPtr, &mBackgroundColor);
} }
// Method to write raw image into PNG at dest. The raw scanline begins // Method to write raw image into PNG at dest. The raw scanline begins
......
...@@ -88,9 +88,6 @@ class LLPngWrapper ...@@ -88,9 +88,6 @@ class LLPngWrapper
U32 mFinalSize; U32 mFinalSize;
bool mHasBKGD;
png_color_16p mBackgroundColor;
F64 mGamma; F64 mGamma;
std::string mErrorMessage; std::string mErrorMessage;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment