summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-01-10 12:56:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-01-12 06:52:42 +0000
commit21734247d58a6e915b058d8fa55ece949d049613 (patch)
tree11f0eac0b0efecfae9065fb32313c82f85d75aef /emfio
parent7f0b6db955ee52f4216416566e108245f2b3a821 (diff)
drop internal support for 1-bit images
on modern hardware, these are less efficient than regular alpha channels. Also, this greatly simplies the range of stuff that vcl needs to deal with, which will make the upcoming transparency->alpha patch easier to deal with. Enhance vcl::CreateFromData to convert incoming 1-bit data to 8-bit image. Change-Id: I35829da750029fe373d0d2911a669d10bab6ad23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145321 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/source/reader/wmfreader.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx
index 8825fa5fdea1..cfb15cd31eac 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -837,8 +837,8 @@ namespace emfio
SAL_WARN("emfio", "\t\t TODO The unsupported Bitmap record. Please fill a bug.");
break;
}
- const vcl::PixelFormat ePixelFormat = vcl::bitDepthToPixelFormat( nBitCount );
- bool bOk = nWidth > 0 && nHeight > 0 && nBytesPerScan > 0 && ePixelFormat != vcl::PixelFormat::INVALID;
+ bool bOk = nWidth > 0 && nHeight > 0 && nBytesPerScan > 0
+ && (nBitCount == 1 || nBitCount == 8 || nBitCount == 24 || nBitCount == 32);
if (bOk)
{
// must be enough data to fulfil the request
@@ -854,7 +854,7 @@ namespace emfio
std::unique_ptr< sal_uInt8[] > pData;
pData.reset( new sal_uInt8[ nHeight * nBytesPerScan ] );
mpInputStream->ReadBytes( pData.get(), nHeight * nBytesPerScan );
- BitmapEx aBitmap = vcl::bitmap::CreateFromData( pData.get(), nWidth, nHeight, nBytesPerScan, ePixelFormat, true );
+ BitmapEx aBitmap = vcl::bitmap::CreateFromData( pData.get(), nWidth, nHeight, nBytesPerScan, nBitCount, true );
if ( nSye && nSxe &&
( nXSrc + nSxe <= nWidth ) &&
( nYSrc + nSye <= nHeight ) )