summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/source/gdi/bmpfast.cxx34
1 files changed, 22 insertions, 12 deletions
diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx
index 76a5239d4ceb..5528d9fcf455 100644
--- a/vcl/source/gdi/bmpfast.cxx
+++ b/vcl/source/gdi/bmpfast.cxx
@@ -173,20 +173,21 @@ public:
}
};
+// This assumes the content uses the grayscale palette (needs to be checked
+// by code allowing the use of the format).
+// Only reading color is implemented, since e.g. 24bpp input couldn't be
+// easily guaranteed to be grayscale.
template <>
-class TrueColorPixelPtr<ScanlineFormat::N8BitTcMask> : public BasePixelPtr
+class TrueColorPixelPtr<ScanlineFormat::N8BitPal> : public BasePixelPtr
{
public:
void operator++() { mpPixel += 1; }
- PIXBYTE GetAlpha() const { return mpPixel[0]; }
-};
-// TODO: for some reason many Alpha maps are ScanlineFormat::N8BitPal
-// they should be ScanlineFormat::N8BitTcMask
-template <>
-class TrueColorPixelPtr<ScanlineFormat::N8BitPal>
-: public TrueColorPixelPtr<ScanlineFormat::N8BitTcMask>
-{};
+ PIXBYTE GetRed() const { return mpPixel[0]; }
+ PIXBYTE GetGreen() const { return mpPixel[0]; }
+ PIXBYTE GetBlue() const { return mpPixel[0]; }
+ static PIXBYTE GetAlpha() { return 255; }
+};
}
@@ -251,7 +252,8 @@ static void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst,
TrueColorPixelPtr<SRCFMT> aSrc( rSrc );
while( --nPixelCount >= 0 )
{
- ImplBlendPixels(aDst, aSrc, aMsk.GetAlpha());
+ // VCL masks store alpha as color, hence the GetRed() and not GetAlpha().
+ ImplBlendPixels(aDst, aSrc, aMsk.GetRed());
++aDst;
++aSrc;
++aMsk;
@@ -424,7 +426,6 @@ bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc,
case ScanlineFormat::N1BitLsbPal:
case ScanlineFormat::N4BitMsnPal:
case ScanlineFormat::N4BitLsnPal:
- case ScanlineFormat::N8BitPal:
break;
case ScanlineFormat::N8BitTcMask:
@@ -433,6 +434,11 @@ bool ImplFastBitmapConversion( BitmapBuffer& rDst, const BitmapBuffer& rSrc,
// return ImplConvertFromBitmap<ScanlineFormat::N32BitTcMask>( rDst, rSrc );
break;
+ case ScanlineFormat::N8BitPal:
+ if(rSrc.maPalette.IsGreyPalette8Bit())
+ return ImplConvertFromBitmap<ScanlineFormat::N8BitPal>( rDst, rSrc );
+ break;
+
case ScanlineFormat::N24BitTcBgr:
return ImplConvertFromBitmap<ScanlineFormat::N24BitTcBgr>( rDst, rSrc );
case ScanlineFormat::N24BitTcRgb:
@@ -737,7 +743,6 @@ bool ImplFastBitmapBlending( BitmapWriteAccess const & rDstWA,
case ScanlineFormat::N1BitLsbPal:
case ScanlineFormat::N4BitMsnPal:
case ScanlineFormat::N4BitLsnPal:
- case ScanlineFormat::N8BitPal:
break;
case ScanlineFormat::N8BitTcMask:
@@ -746,6 +751,11 @@ bool ImplFastBitmapBlending( BitmapWriteAccess const & rDstWA,
// return ImplBlendFromBitmap<ScanlineFormat::N32BitTcMask>( rDst, rSrc );
break;
+ case ScanlineFormat::N8BitPal:
+ if(rSrc.maPalette.IsGreyPalette8Bit())
+ return ImplBlendFromBitmap<ScanlineFormat::N8BitPal>( rDst, rSrc, rMsk );
+ break;
+
case ScanlineFormat::N24BitTcBgr:
return ImplBlendFromBitmap<ScanlineFormat::N24BitTcBgr>( rDst, rSrc, rMsk );
case ScanlineFormat::N24BitTcRgb: