summaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-06-09 15:24:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-10 09:11:02 +0200
commit289a9f906bdef65f12ee0acb7069d6f39ac825f4 (patch)
tree9066d360606ef311a76208c239864af78b6f7ec2 /filter
parenttdf#142478 fix crash when searching and a viewshell change occurs (diff)
downloadcore-289a9f906bdef65f12ee0acb7069d6f39ac825f4.tar.gz
core-289a9f906bdef65f12ee0acb7069d6f39ac825f4.zip
tdf#142629 import psd image with transparent background
regression from commit 2168d709805a847ac012ff87b06e081ca139d064 Date: Mon Feb 12 15:29:10 2018 +0200 use RawBitmap in PSDReader Change-Id: I8d547d3cca7fb8fc90a8d9382e054b4d4b2f3519 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116916 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116941
Diffstat (limited to 'filter')
-rw-r--r--filter/source/graphicfilter/ipsd/ipsd.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
index 3c219870f1d2..90b7746029b8 100644
--- a/filter/source/graphicfilter/ipsd/ipsd.cxx
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -119,7 +119,7 @@ bool PSDReader::ReadPSD(Graphic & rGraphic )
}
Size aBitmapSize( mpFileHeader->nColumns, mpFileHeader->nRows );
- mpBitmap.reset( new vcl::bitmap::RawBitmap( aBitmapSize, 24 ) );
+ mpBitmap.reset( new vcl::bitmap::RawBitmap( aBitmapSize, mbTransparent ? 32 : 24 ) );
if ( mpPalette && mbStatus )
{
mvPalette.resize( 256 );
@@ -129,8 +129,9 @@ bool PSDReader::ReadPSD(Graphic & rGraphic )
}
}
- if ((mnDestBitDepth == 1 || mnDestBitDepth == 8 || mbTransparent) && mvPalette.empty())
+ if ((mnDestBitDepth == 1 || mnDestBitDepth == 8) && mvPalette.empty())
{
+ SAL_WARN("vcl", "no palette, but bit depth is " << mnDestBitDepth);
mbStatus = false;
return mbStatus;
}
@@ -721,7 +722,7 @@ bool PSDReader::ImplReadBody()
m_rPSD.ReadUChar( nDummy );
for ( sal_uInt16 i = 0; i < ( -nRunCount + 1 ); i++ )
{
- mpBitmap->SetPixel(nY, nX, SanitizePaletteIndex(mvPalette, nDat));
+ mpBitmap->SetAlpha(nY, nX, nDat ? 0 : 255);
if ( ++nX == mpFileHeader->nColumns )
{
nX = 0;
@@ -742,7 +743,7 @@ bool PSDReader::ImplReadBody()
nDat = 1;
if ( mpFileHeader->nDepth == 16 ) // 16 bit depth is to be skipped
m_rPSD.ReadUChar( nDummy );
- mpBitmap->SetPixel(nY, nX, SanitizePaletteIndex(mvPalette, nDat));
+ mpBitmap->SetAlpha(nY, nX, nDat ? 0 : 255);
if ( ++nX == mpFileHeader->nColumns )
{
nX = 0;