Revert "avoid needless 32bpp->24+8bpp conversion in png writer" (tdf#130128)

The separate alpha channel that VCL normally uses really messes up
trying to switch to 32bpp bitmaps all over the code. In the case of
tdf#130128 the bitmap has data as ScanlineFormat::N32BitTcMask,
and this uses class ColorMask, which handles only separate alpha
and drops it from the bitmap data itself. So I'm just giving up on the 32bpp
idea in Skia for somewhen later maybe.

This reverts commit 86d44930eecb5e8933f6870684adbb5f9200d6f7.

Change-Id: Iff419e8162c4e0f0680bf62d2b078f9ea809959e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87467
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
diff --git a/vcl/source/filter/png/pngwrite.cxx b/vcl/source/filter/png/pngwrite.cxx
index be1dac8..8190c1e 100644
--- a/vcl/source/filter/png/pngwrite.cxx
+++ b/vcl/source/filter/png/pngwrite.cxx
@@ -114,7 +114,19 @@
{
    if (!rBitmapEx.IsEmpty())
    {
        Bitmap aBmp(rBitmapEx.GetBitmap());
        BitmapEx aBitmapEx;

        if (rBitmapEx.GetBitmap().GetBitCount() == 32)
        {
            if (!vcl::bitmap::convertBitmap32To24Plus8(rBitmapEx, aBitmapEx))
                return;
        }
        else
        {
            aBitmapEx = rBitmapEx;
        }

        Bitmap aBmp(aBitmapEx.GetBitmap());

        mnMaxChunkSize = std::numeric_limits<sal_uInt32>::max();

@@ -136,26 +148,9 @@
        }
        mnBitsPerPixel = static_cast<sal_uInt8>(aBmp.GetBitCount());

        if (mnBitsPerPixel == 32)
        if (aBitmapEx.IsTransparent())
        {
            mpAccess = Bitmap::ScopedReadAccess(aBmp); // RGBA
            if (mpAccess)
            {
                if (ImplWriteHeader())
                {
                    ImplWritepHYs(rBitmapEx);
                    ImplWriteIDAT();
                }
                mpAccess.reset();
            }
            else
            {
                mbStatus = false;
            }
        }
        else if (rBitmapEx.IsTransparent())
        {
            if (mnBitsPerPixel <= 8 && rBitmapEx.IsAlpha())
            if (mnBitsPerPixel <= 8 && aBitmapEx.IsAlpha())
            {
                aBmp.Convert( BmpConversion::N24Bit );
                mnBitsPerPixel = 24;
@@ -164,14 +159,14 @@
            if (mnBitsPerPixel <= 8) // transparent palette
            {
                aBmp.Convert(BmpConversion::N8BitTrans);
                aBmp.Replace(rBitmapEx.GetMask(), BMP_COL_TRANS);
                aBmp.Replace(aBitmapEx.GetMask(), BMP_COL_TRANS);
                mnBitsPerPixel = 8;
                mpAccess = Bitmap::ScopedReadAccess(aBmp);
                if (mpAccess)
                {
                    if (ImplWriteHeader())
                    {
                        ImplWritepHYs(rBitmapEx);
                        ImplWritepHYs(aBitmapEx);
                        ImplWritePalette();
                        ImplWriteTransparent();
                        ImplWriteIDAT();
@@ -188,16 +183,16 @@
                mpAccess = Bitmap::ScopedReadAccess(aBmp); // true RGB with alphachannel
                if (mpAccess)
                {
                    mbTrueAlpha = rBitmapEx.IsAlpha();
                    mbTrueAlpha = aBitmapEx.IsAlpha();
                    if (mbTrueAlpha)
                    {
                        AlphaMask aMask(rBitmapEx.GetAlpha());
                        AlphaMask aMask(aBitmapEx.GetAlpha());
                        mpMaskAccess = aMask.AcquireReadAccess();
                        if (mpMaskAccess)
                        {
                            if (ImplWriteHeader())
                            {
                                ImplWritepHYs(rBitmapEx);
                                ImplWritepHYs(aBitmapEx);
                                ImplWriteIDAT();
                            }
                            aMask.ReleaseAccess(mpMaskAccess);
@@ -210,13 +205,13 @@
                    }
                    else
                    {
                        Bitmap aMask(rBitmapEx.GetMask());
                        Bitmap aMask(aBitmapEx.GetMask());
                        mpMaskAccess = aMask.AcquireReadAccess();
                        if (mpMaskAccess)
                        {
                            if (ImplWriteHeader())
                            {
                                ImplWritepHYs(rBitmapEx);
                                ImplWritepHYs(aBitmapEx);
                                ImplWriteIDAT();
                            }
                            Bitmap::ReleaseAccess(mpMaskAccess);
@@ -242,7 +237,7 @@
            {
                if (ImplWriteHeader())
                {
                    ImplWritepHYs(rBitmapEx);
                    ImplWritepHYs(aBitmapEx);
                    if (mpAccess->HasPalette())
                        ImplWritePalette();

@@ -318,11 +313,6 @@

        if (mpMaskAccess)
            nColorType |= 4;
        if (mnBitsPerPixel == 32)
        {
            nBitDepth = mnBitsPerPixel / 4;
            nColorType |= 4;
        }

        ImplWriteChunk(nBitDepth);
        ImplWriteChunk(nColorType); // colortype
@@ -595,18 +585,6 @@
                    }
                }
            }
            else if(mnBitsPerPixel == 32) // RGBA
            {
                Scanline pScanline = mpAccess->GetScanline( nY );
                for (sal_uLong nX = nXStart; nX < mnWidth; nX += nXAdd)
                {
                    const BitmapColor& rColor = mpAccess->GetPixelFromData(pScanline, nX);
                    *pDest++ = rColor.GetRed();
                    *pDest++ = rColor.GetGreen();
                    *pDest++ = rColor.GetBlue();
                    *pDest++ = 255 - rColor.GetTransparency();
                }
            }
            else
            {
                Scanline pScanline = mpAccess->GetScanline( nY );