[Libreoffice-commits] core.git: basebmp/inc basebmp/source basebmp/test desktop/qa desktop/source include/basebmp vcl/headless vcl/inc vcl/qa vcl/unx

Caolán McNamara caolanm at redhat.com
Mon Dec 7 12:49:04 PST 2015


 basebmp/inc/rgbmaskpixelformats.hxx         |   14 ----------
 basebmp/source/bitmapdevice.cxx             |    7 -----
 basebmp/source/debug.cxx                    |    2 -
 basebmp/test/bmpmasktest.cxx                |    4 +--
 desktop/qa/desktop_lib/test_desktop_lib.cxx |    2 -
 desktop/source/lib/init.cxx                 |   37 ++--------------------------
 include/basebmp/scanlineformats.hxx         |    4 ---
 vcl/headless/svpbmp.cxx                     |   20 ---------------
 vcl/headless/svpgdi.cxx                     |    4 +--
 vcl/inc/headless/svpgdi.hxx                 |    2 -
 vcl/qa/cppunit/BitmapTest.cxx               |    2 -
 vcl/unx/gtk3/gtk3gtkframe.cxx               |    2 -
 12 files changed, 11 insertions(+), 89 deletions(-)

New commits:
commit bc45215ec6e5d508415465ad3f619c3dbe23f7c8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 7 13:34:01 2015 +0000

    Resolves: tdf#96224 don't fiddle around with a separate alpha buffer
    
    use a format that supports alpha directly
    
    now we can unify the android and linux cases as well and drop the
    BGRX support
    
    Change-Id: I3c845913691d8194822423005d308cfa7ef13ec3
    Reviewed-on: https://gerrit.libreoffice.org/20440
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basebmp/inc/rgbmaskpixelformats.hxx b/basebmp/inc/rgbmaskpixelformats.hxx
index 6306882..9fde0d0 100644
--- a/basebmp/inc/rgbmaskpixelformats.hxx
+++ b/basebmp/inc/rgbmaskpixelformats.hxx
@@ -334,20 +334,6 @@ typedef PixelFormatTraitsTemplate_RGBMask<
 BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGBA32_8888::getter_type,
                                   PixelFormatTraits_RGBA32_8888::setter_type);
 
-// Added for Cairo needs, perhaps Android should get an XRGB and replace
-// some uses of ARGB with that instead ?
-
-typedef PixelFormatTraitsTemplate_RGBMask<
-    sal_uInt32,
-    0x00000000,
-    0x00FF0000,
-    0x0000FF00,
-    0x000000FF,
-    BASEBMP_TRUECOLORMASK_LSB_SWAP >            PixelFormatTraits_BGRX32_8888;
-BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_BGRX32_8888::getter_type,
-                                  PixelFormatTraits_BGRX32_8888::setter_type);
-
-
 } // namespace basebmp
 
 #endif /* INCLUDED_BASEBMP_INC_RGBMASKPIXELFORMATS_HXX */
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx
index a50f0df..37ebf91 100644
--- a/basebmp/source/bitmapdevice.cxx
+++ b/basebmp/source/bitmapdevice.cxx
@@ -109,7 +109,6 @@ static const o3tl::enumarray<Format,sal_uInt8> bitsPerPixel =
     16, // SIXTEEN_BIT_LSB_TC_MASK
     16, // SIXTEEN_BIT_MSB_TC_MASK
     24, // TWENTYFOUR_BIT_TC_MASK
-    32, // TWENTYFOUR_BIT_TC_MASK_BGRX
     32, // THIRTYTWO_BIT_TC_MASK_BGRA
     32, // THIRTYTWO_BIT_TC_MASK_ARGB
     32, // THIRTYTWO_BIT_TC_MASK_ABGR
@@ -2053,12 +2052,6 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector&
 
         // thirtytwo bit formats
 
-        // 8 red bits, 8 green bits, 8 blue bits, and 8 ignored bits like CAIRO_FORMAT_RGB24
-        case Format::ThirtyTwoBitTcMaskBGRX:
-            return createRenderer<PixelFormatTraits_BGRX32_8888,StdMasks>(
-                aBounds, rSize, nScanlineFormat, nScanlineStride,
-                pFirstScanline, pMem, pPal, rDamage );
-
         case Format::ThirtyTwoBitTcMaskBGRA:
             return createRenderer<PixelFormatTraits_BGRA32_8888,StdMasks>(
                 aBounds, rSize, nScanlineFormat, nScanlineStride,
diff --git a/basebmp/source/debug.cxx b/basebmp/source/debug.cxx
index 3b9de68..f01fd39 100644
--- a/basebmp/source/debug.cxx
+++ b/basebmp/source/debug.cxx
@@ -63,8 +63,6 @@ namespace basebmp
             return "SIXTEEN_BIT_MSB_TC_MASK";
         case Format::TwentyFourBitTcMask:
             return "TWENTYFOUR_BIT_TC_MASK";
-        case Format::ThirtyTwoBitTcMaskBGRX:
-            return "THIRTYTWO_BIT_TC_MASK_BGRX";
         case Format::ThirtyTwoBitTcMaskBGRA:
             return "THIRTYTWO_BIT_TC_MASK_BGRA";
         case Format::ThirtyTwoBitTcMaskARGB:
diff --git a/basebmp/test/bmpmasktest.cxx b/basebmp/test/bmpmasktest.cxx
index 7f7e913..daa9263 100644
--- a/basebmp/test/bmpmasktest.cxx
+++ b/basebmp/test/bmpmasktest.cxx
@@ -177,13 +177,13 @@ public:
                                     DrawMode::Paint );
 
             xBitmap = createBitmapDevice( aSize, false,
-                                          Format::ThirtyTwoBitTcMaskBGRX );
+                                          Format::ThirtyTwoBitTcMaskBGRA );
             xBitmap->clear(Color(0x80808080));
         }
         { // mpOutput & mpBitmap
             const basegfx::B2ISize aSize(9, 9);
             xOutput = createBitmapDevice( aSize, false,
-                                          Format::ThirtyTwoBitTcMaskBGRX );
+                                          Format::ThirtyTwoBitTcMaskBGRA );
             xOutput->clear(Color(0xffffffff));
         }
 
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 07607dd..987ac1b 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -316,7 +316,7 @@ void DesktopLOKTest::testPaintTile()
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     int nCanvasWidth = 100;
     int nCanvasHeight = 300;
-    sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(basebmp::Format::ThirtyTwoBitTcMaskBGRX,
+    sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(basebmp::Format::ThirtyTwoBitTcMaskBGRA,
                                                                nCanvasWidth);
     std::vector<unsigned char> aBuffer(nStride * nCanvasHeight);
     int nTilePosX = 0;
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index a9b4d30..8dd6290 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -894,33 +894,17 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
 
     pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
                     nTilePosX, nTilePosY, nTileWidth, nTileHeight);
-#elif defined(ANDROID)
-    ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ;
-
-    boost::shared_array<sal_uInt8> aBuffer(pBuffer, NoDelete< sal_uInt8 >());
-
-    boost::shared_array<sal_uInt8> aAlphaBuffer;
-
-    pDevice->SetOutputSizePixelScaleOffsetAndBuffer(
-                Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
-                aBuffer, aAlphaBuffer);
-
-    pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
-                    nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 #else
     ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT) ;
 
+#if !defined(ANDROID)
     // Set background to transparent by default.
     pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
+#endif
 
     boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() );
 
-    // Allocate a separate buffer for the alpha device.
-    sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(basebmp::Format::ThirtyTwoBitTcMaskBGRX,
-                                                               nCanvasWidth);
-    std::vector<sal_uInt8> aAlpha(nCanvasHeight * nStride);
-
-    boost::shared_array<sal_uInt8> aAlphaBuffer(aAlpha.data(), NoDelete<sal_uInt8>());
+    boost::shared_array<sal_uInt8> aAlphaBuffer;
 
     pDevice->SetOutputSizePixelScaleOffsetAndBuffer(
                 Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
@@ -941,21 +925,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
         pDevice->DrawRect(aRect);
         pDevice->Pop();
     }
-
-    // Overwrite pBuffer's alpha channel with the separate alpha buffer.
-    for (int nRow = 0; nRow < nCanvasHeight; ++nRow)
-    {
-        for (int nCol = 0; nCol < nCanvasWidth; ++nCol)
-        {
-            const int nOffset = (nRow * nStride) + nCol * 4;
-            // VCL's transparent is 0, RGBA's transparent is 0xff.
-            pBuffer[nOffset + 3] = 0xff - aAlpha[nOffset];
-            double fAlpha = pBuffer[nOffset + 3]/255.0;
-            for (int i = 0; i < 3; ++i)
-                pBuffer[nOffset + i] *= fAlpha;
-        }
-    }
-
 #endif
 
 #else
diff --git a/include/basebmp/scanlineformats.hxx b/include/basebmp/scanlineformats.hxx
index ec246d2..efdc43f 100644
--- a/include/basebmp/scanlineformats.hxx
+++ b/include/basebmp/scanlineformats.hxx
@@ -42,10 +42,6 @@ enum class Format
     SixteenBitLsbTcMask,
     SixteenBitMsbTcMask,
     TwentyFourBitTcMask,
-    // CAIRO_FORMAT_RGB24, each pixel is a 32-bit quantity, with the upper 8
-    // bits unused. Red, Green, and Blue are stored in the remaining 24 bits in
-    // that order (below U is for unused)
-    ThirtyTwoBitTcMaskBGRX,
     // The order of the channels code letters indicates the order of the
     // channel bytes in memory
     ThirtyTwoBitTcMaskBGRA,
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 02f1453..e6d962f 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -198,25 +198,6 @@ BitmapBuffer* SvpSalBitmap::AcquireBuffer( BitmapAccessMode )
                 nBitCount = 24;
                 pBuf->mnFormat = BMP_FORMAT_24BIT_TC_BGR;
                 break;
-            case Format::ThirtyTwoBitTcMaskBGRX:
-            {
-                nBitCount = 32;
-                pBuf->mnFormat = BMP_FORMAT_32BIT_TC_MASK;
-#ifdef OSL_BIGENDIAN
-                ColorMaskElement aRedMask(0x0000ff00);
-                ColorMaskElement aGreenMask(0x00ff0000);
-                ColorMaskElement aBlueMask(0xff000000);
-#else
-                ColorMaskElement aRedMask(0x00ff0000);
-                ColorMaskElement aGreenMask(0x0000ff00);
-                ColorMaskElement aBlueMask(0x000000ff);
-#endif
-                aBlueMask.CalcMaskShift();
-                aRedMask.CalcMaskShift();
-                aGreenMask.CalcMaskShift();
-                pBuf->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask);
-                break;
-            }
             case Format::ThirtyTwoBitTcMaskBGRA:
             {
                 nBitCount = 32;
@@ -457,7 +438,6 @@ sal_uInt32 SvpSalBitmap::getBitCountFromScanlineFormat( basebmp::Format nFormat
         case Format::TwentyFourBitTcMask:
             nBitCount = 24;
             break;
-        case Format::ThirtyTwoBitTcMaskBGRX:
         case Format::ThirtyTwoBitTcMaskBGRA:
         case Format::ThirtyTwoBitTcMaskARGB:
         case Format::ThirtyTwoBitTcMaskABGR:
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index e610ad4..94871be 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -308,7 +308,7 @@ namespace
         sal_Int32 nStride = rBuffer->getScanlineStride();
         cairo_format_t nFormat;
         if (rBuffer->getScanlineFormat() == SVP_CAIRO_FORMAT)
-            nFormat = CAIRO_FORMAT_RGB24;
+            nFormat = CAIRO_FORMAT_ARGB32;
         else
             nFormat = CAIRO_FORMAT_A1;
         return (cairo_format_stride_for_width(nFormat, size.getX()) == nStride);
@@ -1305,7 +1305,7 @@ cairo_surface_t* SvpSalGraphics::createCairoSurface(const basebmp::BitmapDeviceS
     basebmp::RawMemorySharedArray data = rBuffer->getBuffer();
     cairo_format_t nFormat;
     if (rBuffer->getScanlineFormat() == SVP_CAIRO_FORMAT)
-        nFormat = CAIRO_FORMAT_RGB24;
+        nFormat = CAIRO_FORMAT_ARGB32;
     else
         nFormat = CAIRO_FORMAT_A1;
     cairo_surface_t *target =
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 1adbc72..ab675a9 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -41,7 +41,7 @@
 #ifdef ANDROID
 #   define SVP_CAIRO_FORMAT basebmp::Format::ThirtyTwoBitTcMaskRGBA
 #else
-#   define SVP_CAIRO_FORMAT basebmp::Format::ThirtyTwoBitTcMaskBGRX
+#   define SVP_CAIRO_FORMAT basebmp::Format::ThirtyTwoBitTcMaskBGRA
 #endif
 
 class GlyphCache;
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index 33820e4..eb393bc 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -70,7 +70,7 @@ void BitmapTest::testConvert()
     {
         Bitmap::ScopedReadAccess pReadAccess(aBitmap);
 #if defined LINUX
-        // 24 bit Bitmap on SVP backend uses 32bit BGRX format
+        // 24 bit Bitmap on SVP backend uses 32bit BGRA format
         CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(32), pReadAccess->GetBitCount());
         CPPUNIT_ASSERT_EQUAL(sal_uLong(40), pReadAccess->GetScanlineSize());
 #else
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 75fa0df..62b2ac4 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1511,7 +1511,7 @@ void GtkSalFrame::AllocateFrame()
         if( aFrameSize.getY() == 0 )
             aFrameSize.setY( 1 );
         m_aFrame = basebmp::createBitmapDevice(aFrameSize, true, SVP_CAIRO_FORMAT);
-        assert(cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, aFrameSize.getX()) ==
+        assert(cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, aFrameSize.getX()) ==
                m_aFrame->getScanlineStride());
         m_aFrame->setDamageTracker(
             basebmp::IBitmapDeviceDamageTrackerSharedPtr(new DamageTracker(*this)) );


More information about the Libreoffice-commits mailing list