[Libreoffice-commits] core.git: 6 commits - canvas/source cppcanvas/Module_cppcanvas.mk cppcanvas/qa include/vcl solenv/gbuild vcl/inc vcl/source vcl/unx

Michael Meeks michael.meeks at suse.com
Tue Jun 11 06:42:59 PDT 2013


 canvas/source/cairo/cairo_canvasbitmap.cxx |  161 ++++++++++++-----------------
 canvas/source/cairo/cairo_canvasbitmap.hxx |    4 
 canvas/source/cairo/cairo_xlib_cairo.cxx   |    7 -
 canvas/source/cairo/cairo_xlib_cairo.hxx   |    1 
 cppcanvas/Module_cppcanvas.mk              |    7 +
 cppcanvas/qa/unit/test.cxx                 |   92 ++++++++++++++++
 include/vcl/bitmap.hxx                     |    3 
 include/vcl/bitmapex.hxx                   |   11 +
 solenv/gbuild/CppunitTest.mk               |    8 +
 vcl/inc/salbmp.hxx                         |    1 
 vcl/inc/unx/salbmp.h                       |    7 -
 vcl/inc/unx/salgdi.h                       |    5 
 vcl/source/gdi/bitmap.cxx                  |   13 --
 vcl/source/gdi/bitmapex.cxx                |   78 +++++++++++++-
 vcl/source/gdi/gdimtf.cxx                  |   59 +---------
 vcl/source/helper/canvastools.cxx          |   25 ----
 vcl/source/window/window.cxx               |    2 
 vcl/unx/generic/gdi/salbmp.cxx             |   18 ---
 vcl/unx/generic/gdi/salgdi2.cxx            |  152 ++++++++++++---------------
 19 files changed, 345 insertions(+), 309 deletions(-)

New commits:
commit eb5e3e3a4e82a55abfb1894dead6a1fb3c10bb41
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Jun 11 14:14:31 2013 +0100

    create a cairo canvas unit test, if only I could use the XCanvas API.
    
    Change-Id: I3b0fdbe92db751e59ecb3f3b59f27e160b3ca226

diff --git a/cppcanvas/Module_cppcanvas.mk b/cppcanvas/Module_cppcanvas.mk
index fad05f1..9894f9c 100644
--- a/cppcanvas/Module_cppcanvas.mk
+++ b/cppcanvas/Module_cppcanvas.mk
@@ -24,4 +24,11 @@ $(eval $(call gb_Module_add_targets,cppcanvas,\
 	Library_mtfrenderer \
 ))
 
+# FIXME: should generalize these ...
+ifeq ($(ENABLE_CAIRO_CANVAS),TRUE)
+$(eval $(call gb_Module_add_check_targets,cppcanvas,\
+    CppunitTest_cppcanvas_test \
+))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/cppcanvas/qa/unit/test.cxx b/cppcanvas/qa/unit/test.cxx
new file mode 100644
index 0000000..03d0e73
--- /dev/null
+++ b/cppcanvas/qa/unit/test.cxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+
+#include <osl/file.hxx>
+#include <osl/process.h>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/canvastools.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/rendering/XBitmap.hpp>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+
+using namespace ::com::sun::star;
+
+class CanvasTest : public test::BootstrapFixture
+{
+public:
+    CanvasTest() : BootstrapFixture(true, false) {}
+
+    void testComposite();
+
+    CPPUNIT_TEST_SUITE(CanvasTest);
+    CPPUNIT_TEST(testComposite);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void CanvasTest::testComposite()
+{
+#ifdef LINUX
+    Window* pWin = new WorkWindow( (Window *)NULL );
+    CPPUNIT_ASSERT( pWin != NULL );
+
+    uno::Reference<rendering::XCanvas> xCanvas = pWin->GetCanvas ();
+    CPPUNIT_ASSERT( xCanvas.is() );
+
+    // a huge canvas ...
+    Size aSize (1, 1);
+    uno::Reference<rendering::XBitmap> xBitmap;
+    xBitmap = xCanvas->getDevice ()->createCompatibleAlphaBitmap(
+                        vcl::unotools::integerSize2DFromSize( aSize ) );
+    CPPUNIT_ASSERT( xBitmap.is() );
+
+    uno::Reference< rendering::XBitmapCanvas > xBitmapCanvas( xBitmap, uno::UNO_QUERY );
+    CPPUNIT_ASSERT( xBitmapCanvas.is() );
+
+    BitmapEx aBitmapEx;
+    {
+        // clear the canvas and basic sanity check ...
+        xBitmapCanvas->clear();
+        CPPUNIT_ASSERT( aBitmapEx.Create( xBitmapCanvas, aSize ) );
+        CPPUNIT_ASSERT( aBitmapEx.IsAlpha() );
+        CPPUNIT_ASSERT( aBitmapEx.GetAlpha() );
+    }
+
+    {
+        // render something
+        rendering::RenderState aDefaultState;
+        uno::Sequence< double > aRedTransparent( 4 );
+        aRedTransparent[0] = 1.0; // R
+        aRedTransparent[1] = 0.0; // G
+        aRedTransparent[2] = 0.0; // B
+        aRedTransparent[3] = 0.5; // A
+        aDefaultState.DeviceColor = aRedTransparent;
+#if 0
+        // words fail me to describe the sheer beauty of allocating an UNO
+        // object to represent a polygon, and manually handling the ViewState
+        // and there being no public helper for this - to render ... a rectangle.
+        XCachedPrimitive    fillPolyPolygon( [in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState )
+#endif
+    }
+
+#endif
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(CanvasTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 02ee261150c350f85c55925d01ed342b8a1854c0
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Jun 11 12:16:18 2013 +0100

    Allow --headless to be disabled for unit tests.
    
    Change-Id: I9f2a97715dc0d7fc5905afb1b908de97acdafc57

diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index fd4b122..2e5d4df 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -51,7 +51,7 @@ gb_CppunitTest_CPPTESTCOMMAND := $(call gb_Executable_get_target_for_build,cppun
 gb_CppunitTest__get_linktargetname = CppunitTest/$(call gb_CppunitTest_get_filename,$(1))
 
 define gb_CppunitTest__make_args
---headless \
+$(HEADLESS) \
 "-env:BRAND_BASE_DIR=$(call gb_Helper_make_url,$(OUTDIR)/unittest/install)" \
 $(if $(URE),\
     $(if $(strip $(CONFIGURATION_LAYERS)),\
@@ -127,6 +127,7 @@ $(call gb_CppunitTest_get_target,$(1)) : UNO_SERVICES :=
 $(call gb_CppunitTest_get_target,$(1)) : UNO_TYPES :=
 $(call gb_CppunitTest_get_target,$(1)) : DBGSV_ERROR_OUT := shell
 $(call gb_CppunitTest_get_target,$(1)) : SAL_DIAGNOSE_ABORT :=
+$(call gb_CppunitTest_get_target,$(1)) : HEADLESS := --headless
 $$(eval $$(call gb_Module_register_target,$(call gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1))))
 $(call gb_Helper_make_userfriendly_targets,$(1),CppunitTest)
 
@@ -285,6 +286,11 @@ $(call gb_CppunitTest__use_configuration,$(1),xcsxcu,$(gb_Configuration_registry
 
 endef
 
+define gb_CppunitTest_unset_headless
+$(call gb_CppunitTest_get_target,$(1)) : HEADLESS=
+
+endef
+
 # Use configuration for filters.
 #
 # Okay, this is not exactly true, because there may be configuration
commit 2b2f00e03cb4ad2abfe7787d966b67dabe6fb408
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Jun 11 11:47:28 2013 +0100

    protect against exception during construction.
    
    Change-Id: Ied19ddc28dc8413a35ee7b7269cd6c6f22ca9a91

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index c76e2d7..1c8e890 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -4598,7 +4598,7 @@ Window::~Window()
     if ( pSVData->maWinData.mpLastDeacWin == this )
         pSVData->maWinData.mpLastDeacWin = NULL;
 
-    if ( mpWindowImpl->mbFrame )
+    if ( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData )
     {
         if ( mpWindowImpl->mpFrameData->mnFocusId )
             Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnFocusId );
commit 7cf2b5809f7137acc7a5eed9159042b3d748da01
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Jun 10 17:02:06 2013 +0100

    Cairo canvas fixes
    
    + Move BitmapEx construction from an XBitmapCanvas into BitmapEx
      where (arguably) it will be easier to re-factor later, treat a
      mask fetch failure as if we have no mask
    + Teach the cairo canvas to return a non-pre-multiplied RGB +
      separate Alpha BitmapEx when it can to avoid unpleasantness with
      the underlying X resources.
    + Add tentative code-path to convert 32bit color Bitmaps into
      24bit color, to avoid confusing X
    
    Change-Id: Iaf6998c796aea6d73c57bed2bc03152d9636d5f5

diff --git a/canvas/source/cairo/cairo_canvasbitmap.cxx b/canvas/source/cairo/cairo_canvasbitmap.cxx
index 91f6194..496b5cf 100644
--- a/canvas/source/cairo/cairo_canvasbitmap.cxx
+++ b/canvas/source/cairo/cairo_canvasbitmap.cxx
@@ -23,6 +23,9 @@
 
 #include "cairo_canvasbitmap.hxx"
 
+#include <vcl/bmpacc.hxx>
+#include <vcl/bitmapex.hxx>
+
 #ifdef CAIRO_HAS_XLIB_SURFACE
 # include "cairo_xlib_cairo.hxx"
 #elif defined CAIRO_HAS_QUARTZ_SURFACE
@@ -144,7 +147,67 @@ namespace cairocanvas
         {
             case 0:
             {
-                aRV = uno::Any( reinterpret_cast<sal_Int64>( (BitmapEx*) NULL ) );
+                aRV = uno::Any( reinterpret_cast<sal_Int64>( (BitmapEx *) NULL ) );
+                if ( !mbHasAlpha )
+                    break;
+
+                ::Size aSize( maSize.getX(), maSize.getY() );
+                // FIXME: if we could teach VCL/ about cairo handles, life could
+                // be significantly better here perhaps.
+                cairo_surface_t *pPixels;
+                pPixels = cairo_image_surface_create( CAIRO_FORMAT_ARGB32,
+                                                      aSize.Width(), aSize.Height() );
+                cairo_t *pCairo = cairo_create( pPixels );
+                if( !pPixels || !pCairo )
+                    break;
+
+                // suck ourselves from the X server to this buffer so then we can fiddle with
+                // Alpha to turn it into the ultra-lame vcl required format and then push it
+                // all back again later at vast expense [ urgh ]
+                cairo_set_source_surface( pCairo, getSurface()->getCairoSurface().get(), 0, 0 );
+                cairo_set_operator( pCairo, CAIRO_OPERATOR_SOURCE );
+                cairo_paint( pCairo );
+
+                ::Bitmap aRGB( aSize, 24 );
+                ::AlphaMask aMask( aSize );
+
+                BitmapWriteAccess *pRGBWrite( aRGB.AcquireWriteAccess() );
+                BitmapWriteAccess *pMaskWrite( aMask.AcquireWriteAccess() );
+
+                unsigned char *pSrc = cairo_image_surface_get_data( pPixels );
+                unsigned int nStride = cairo_image_surface_get_stride( pPixels );
+                for( unsigned long y = 0; y < (unsigned long) aSize.Height(); y++ )
+                {
+                    sal_uInt32 *pPix = (sal_uInt32 *)(pSrc + nStride * y);
+                    for( unsigned long x = 0; x < (unsigned long) aSize.Width(); x++ )
+                    {
+                        sal_uInt8 nAlpha = (*pPix >> 24);
+                        sal_uInt8 nR = (*pPix >> 16) & 0xff;
+                        sal_uInt8 nG = (*pPix >> 8) & 0xff;
+                        sal_uInt8 nB = *pPix & 0xff;
+                        if( nAlpha != 0 && nAlpha != 255 )
+                        {
+//                            fprintf (stderr, "From A(0x%.2x) 0x%.2x 0x%.2x 0x%.2x -> ",
+//                                     nAlpha, nR, nG, nB );
+                            // Cairo uses pre-multiplied alpha - we do not => re-multiply
+                            nR = (sal_uInt8) MinMax( ((sal_uInt32)nR * 255) / nAlpha, 0, 255 );
+                            nG = (sal_uInt8) MinMax( ((sal_uInt32)nG * 255) / nAlpha, 0, 255 );
+                            nB = (sal_uInt8) MinMax( ((sal_uInt32)nB * 255) / nAlpha, 0, 255 );
+//                            fprintf (stderr, "0x%.2x 0x%.2x 0x%.2x\n", nR, nG, nB );
+                        }
+                        pRGBWrite->SetPixel( y, x, BitmapColor( nR, nG, nB ) );
+                        pMaskWrite->SetPixelIndex( y, x, 255 - nAlpha );
+                        pPix++;
+                    }
+                }
+                aMask.ReleaseAccess( pMaskWrite );
+                aRGB.ReleaseAccess( pRGBWrite );
+
+                ::BitmapEx *pBitmapEx = new ::BitmapEx( aRGB, aMask );
+
+                cairo_surface_destroy( pPixels );
+
+                aRV = uno::Any( reinterpret_cast<sal_Int64>( pBitmapEx ) );
                 break;
             }
             case 1:
@@ -179,71 +242,9 @@ namespace cairocanvas
             }
             case 2:
             {
-#ifdef CAIRO_HAS_XLIB_SURFACE
-                uno::Sequence< uno::Any > args( 3 );
-                SurfaceSharedPtr pAlphaSurface = mpSurfaceProvider->createSurface( maSize, CAIRO_CONTENT_COLOR );
-                CairoSharedPtr   pAlphaCairo = pAlphaSurface->getCairo();
-                X11Surface* pXlibSurface=dynamic_cast<X11Surface*>(pAlphaSurface.get());
-                OSL_ASSERT(pXlibSurface);
-
-                // create RGB image (levels of gray) of alpha channel of original picture
-                cairo_set_source_rgba( pAlphaCairo.get(), 1, 1, 1, 1 );
-                cairo_set_operator( pAlphaCairo.get(), CAIRO_OPERATOR_SOURCE );
-                cairo_paint( pAlphaCairo.get() );
-                cairo_set_source_surface( pAlphaCairo.get(), mpBufferSurface->getCairoSurface().get(), 0, 0 );
-                cairo_set_operator( pAlphaCairo.get(), CAIRO_OPERATOR_XOR );
-                cairo_paint( pAlphaCairo.get() );
-                pAlphaCairo.reset();
-
-                X11PixmapSharedPtr pPixmap = pXlibSurface->getPixmap();
-                args[0] = uno::Any( true );
-                args[1] = ::com::sun::star::uno::Any( pPixmap->mhDrawable );
-                args[2] = ::com::sun::star::uno::Any( sal_Int32( pXlibSurface->getDepth () ) );
-                pPixmap->clear(); // caller takes ownership of pixmap
-
-                // return pixmap and alphachannel pixmap - it will be used in BitmapEx
-                aRV = uno::Any( args );
-#elif defined CAIRO_HAS_QUARTZ_SURFACE
-                SurfaceSharedPtr pAlphaSurface = mpSurfaceProvider->createSurface( maSize, CAIRO_CONTENT_COLOR );
-                CairoSharedPtr   pAlphaCairo = pAlphaSurface->getCairo();
-                QuartzSurface* pQuartzSurface=dynamic_cast<QuartzSurface*>(pAlphaSurface.get());
-                OSL_ASSERT(pQuartzSurface);
-
-                // create RGB image (levels of gray) of alpha channel of original picture
-                cairo_set_source_rgba( pAlphaCairo.get(), 1, 1, 1, 1 );
-                cairo_set_operator( pAlphaCairo.get(), CAIRO_OPERATOR_SOURCE );
-                cairo_paint( pAlphaCairo.get() );
-                cairo_set_source_surface( pAlphaCairo.get(), mpBufferSurface->getCairoSurface().get(), 0, 0 );
-                cairo_set_operator( pAlphaCairo.get(), CAIRO_OPERATOR_XOR );
-                cairo_paint( pAlphaCairo.get() );
-                pAlphaCairo.reset();
-
-                uno::Sequence< uno::Any > args( 1 );
-                args[0] = uno::Any( sal_IntPtr (pQuartzSurface->getCGContext()) );
-                // return ??? and alphachannel ??? - it will be used in BitmapEx
-                aRV = uno::Any( args );
-#elif defined CAIRO_HAS_WIN32_SURFACE
-                SurfaceSharedPtr pAlphaSurface = mpSurfaceProvider->createSurface( maSize, CAIRO_CONTENT_COLOR );
-                CairoSharedPtr   pAlphaCairo = pAlphaSurface->getCairo();
-
-                // create RGB image (levels of gray) of alpha channel of original picture
-                cairo_set_source_rgba( pAlphaCairo.get(), 1, 1, 1, 1 );
-                cairo_set_operator( pAlphaCairo.get(), CAIRO_OPERATOR_SOURCE );
-                cairo_paint( pAlphaCairo.get() );
-                cairo_set_source_surface( pAlphaCairo.get(), mpBufferSurface->getCairoSurface().get(), 0, 0 );
-                cairo_set_operator( pAlphaCairo.get(), CAIRO_OPERATOR_XOR );
-                cairo_paint( pAlphaCairo.get() );
-                pAlphaCairo.reset();
-
-                // cant seem to retrieve HBITMAP from cairo. copy content then
-                uno::Sequence< uno::Any > args( 1 );
-                args[1] = uno::Any( sal_Int64(surface2HBitmap(pAlphaSurface,maSize)) );
-
-                aRV = uno::Any( args );
-                // caller frees the bitmap
-#else
-# error Please define fast prop retrieval for your platform!
-#endif
+                // Always return nothing - for the RGB surface support.
+                // Alpha code paths go via the above case 0.
+                aRV = uno::Any();
                 break;
             }
         }
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 3b42244..ce1b2ae 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -25,6 +25,12 @@
 #include <vcl/alpha.hxx>
 #include <tools/color.hxx>
 
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com { namespace sun { namespace star { namespace rendering {
+    class XBitmapCanvas;
+} } } }
+
 // -------------------
 // - TransparentType -
 // -------------------
@@ -382,6 +388,11 @@ public:
     friend VCL_DLLPUBLIC SvStream&  operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx );
     friend VCL_DLLPUBLIC SvStream&  operator>>( SvStream& rIStm, BitmapEx& rBitmapEx );
     static BitmapEx AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize);
+
+    /// populate from a canvas implementation
+    bool Create( const ::com::sun::star::uno::Reference<
+                 ::com::sun::star::rendering::XBitmapCanvas > &xBitmapCanvas,
+                 const Size &rSize );
 };
 
 #endif // _SV_BITMAPEX_HXX
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 8e769c1..5ac3c36 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include <ctype.h>
 
 #include <rtl/crc.h>
@@ -39,6 +38,13 @@
 #include <image.h>
 #include <impimagetree.hxx>
 
+// BitmapEx::Create
+#include <salbmp.hxx>
+#include <salinst.hxx>
+#include <svdata.hxx>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+using namespace ::com::sun::star;
+
 BitmapEx::BitmapEx() :
         eTransparent( TRANSPARENT_NONE ),
         bAlpha      ( sal_False )
@@ -873,4 +879,74 @@ SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx )
     return rIStm;
 }
 
+// Shift alpha transparent pixels between cppcanvas/ implementations
+// and vcl in a generally grotesque and under-performing fashion
+bool BitmapEx::Create( const ::com::sun::star::uno::Reference<
+                       ::com::sun::star::rendering::XBitmapCanvas > &xBitmapCanvas,
+                       const Size &rSize )
+{
+    SetEmpty();
+    Size aSize( rSize );
+
+    uno::Reference< beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, uno::UNO_QUERY );
+    if( xFastPropertySet.get() )
+    {
+        // 0 means get BitmapEx
+        uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 );
+        BitmapEx* pBitmapEx = (BitmapEx*) *reinterpret_cast<const sal_Int64*>(aAny.getValue());
+        if( pBitmapEx )
+        {
+            *this = *pBitmapEx;
+            delete pBitmapEx;
+            return true;
+        }
+    }
+
+    SalBitmap* pSalBmp, *pSalMask;
+
+    pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
+    pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
+
+    if( pSalBmp->Create( xBitmapCanvas, aSize ) )
+    {
+#ifdef CLAMP_BITDEPTH_PARANOIA
+        // did we get alpha mixed up in the bitmap itself
+        // eg. Cairo Canvas ... yes performance of this is awful.
+        if( pSalBmp->GetBitCount() > 24 )
+        {
+            // Format convert the pixels with generic code
+            Bitmap aSrcPixels( pSalBmp );
+            aBitmap = Bitmap( rSize, 24 );
+            BitmapReadAccess aSrcRead( aSrcPixels );
+            BitmapWriteAccess aDestWrite( aBitmap );
+            aDestWrite.CopyBuffer( aSrcRead );
+        }
+        else
+#endif
+            aBitmap = Bitmap( pSalBmp );
+
+        aBitmapSize = rSize;
+        if ( pSalMask->Create( xBitmapCanvas, aSize, true ) )
+        {
+            aMask = Bitmap( pSalMask );
+            bAlpha = sal_True;
+            aBitmapSize = rSize;
+            eTransparent = !aMask ? TRANSPARENT_NONE : TRANSPARENT_BITMAP;
+
+            return true;
+        }
+        else
+        {
+            bAlpha = sal_False;
+            eTransparent = TRANSPARENT_NONE;
+            return true;
+        }
+    }
+
+    delete pSalBmp;
+    delete pSalMask;
+
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 2195f23..fce3d09 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -432,36 +432,15 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
 
                 xMtfRenderer->draw( rDestSize.Width(), rDestSize.Height() );
 
-                uno::Reference< beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, uno::UNO_QUERY );
-                if( xFastPropertySet.get() )
+                BitmapEx aBitmapEx;
+                if( aBitmapEx.Create( xBitmapCanvas, aSize ) )
                 {
-                    // 0 means get BitmapEx
-                    uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 );
-                    BitmapEx* pBitmapEx = (BitmapEx*) *reinterpret_cast<const sal_Int64*>(aAny.getValue());
-                    if( pBitmapEx ) {
-                        pOut->DrawBitmapEx( rPos, rLogicDestSize, *pBitmapEx );
-                        delete pBitmapEx;
-                        return true;
-                    }
-                }
-
-                SalBitmap* pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
-                SalBitmap* pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
-                if( pSalBmp->Create( xBitmapCanvas, aSize ) && pSalMask->Create( xBitmapCanvas, aSize, true ) )
-                {
-                    Bitmap aBitmap( pSalBmp );
-                    Bitmap aMask( pSalMask );
-                    AlphaMask aAlphaMask( aMask );
-                    BitmapEx aBitmapEx( aBitmap, aAlphaMask );
                     if ( pOut->GetMapMode() == MAP_PIXEL )
                         pOut->DrawBitmapEx( rPos, aBitmapEx );
                     else
                         pOut->DrawBitmapEx( rPos, rLogicDestSize, aBitmapEx );
                     return true;
                 }
-
-                delete pSalBmp;
-                delete pSalMask;
             }
         }
     }
commit 03b4c0e0724f9928e00abd822bd846c6e200fa14
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Jun 10 12:34:39 2013 +0100

    Revert "fix canvas bitmap rendering (argb32 pixmaps) fixes color in n#780830"
    
    This reverts commit 46e53913e9dcc84ffed8fb5f1b4959c70c7e5649.
    
    Conflicts:
    	vcl/inc/salbmp.hxx
    	vcl/source/gdi/gdimtf.cxx
    	vcl/unx/generic/gdi/salgdi2.cxx
    
    Change-Id: Ifa893b687c724ea71655aa4e084a44858695073e

diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index 09b40d9..7c3839a 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -47,7 +47,6 @@ public:
     virtual bool            Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
                                     Size& rSize,
                                     bool bMask = false ) = 0;
-    virtual bool            HasAlpha() const { return false; }
     virtual void            Destroy() = 0;
     virtual Size            GetSize() const = 0;
     virtual sal_uInt16      GetBitCount() const = 0;
diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h
index ea69da4..4b72fcf 100644
--- a/vcl/inc/unx/salbmp.h
+++ b/vcl/inc/unx/salbmp.h
@@ -75,7 +75,6 @@ private:
     BitmapBuffer*   mpDIB;
     ImplSalDDB*     mpDDB;
     bool            mbGrey;
-    bool            mbHasAlpha;
 
 public:
 
@@ -150,8 +149,6 @@ public:
     virtual BitmapBuffer*       AcquireBuffer( bool bReadOnly );
     virtual void                ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly );
     virtual bool                GetSystemData( BitmapSystemData& rData );
-    virtual bool                HasAlpha() const { return mbHasAlpha; }
-    virtual void                SetHasAlpha( bool bHasAlpha ) { mbHasAlpha = bHasAlpha; }
 };
 
 // --------------
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 84834e3..3a20ff6 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -322,11 +322,6 @@ public:
                                              const SalBitmap& rSourceBitmap,
                                              const SalBitmap& rAlphaBitmap );
 
-    bool                    drawAlphaBitmapOpt( const SalTwoRect&,
-                                                const SalBitmap& rSourceBitmap,
-                                                const SalBitmap& rAlphaBitmap,
-                                                bool bUseAlphaBitmap = true );
-
     virtual bool            drawAlphaRect( long nX, long nY, long nWidth,
                                            long nHeight, sal_uInt8 nTransparency );
 
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 1a9c8e9..2195f23 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -446,46 +446,22 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
                 }
 
                 SalBitmap* pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
-#if defined(UNX) && !defined(ANDROID) && !defined(IOS) && !defined(MACOSX) && !defined(LIBO_HEADLESS)
-                X11SalBitmap* X11Bmp = static_cast< X11SalBitmap* >( pSalBmp );
-
-                // for pdf export metafile recording, don't break
-                // other code's assumption that Bitmap with alpha
-                // channel comes as BitmapEx
-                if( !pOut->GetExtOutDevData() )
-                {
-                    X11Bmp->SetHasAlpha( true );
-                    if( X11Bmp->Create( xBitmapCanvas, aSize ) )
-                    {
-                        Bitmap aBitmap( X11Bmp );
-                        if ( pOut->GetMapMode() == MAP_PIXEL )
-                            pOut->DrawBitmap( rPos, aBitmap );
-                        else
-                            pOut->DrawBitmap( rPos, rLogicDestSize, aBitmap );
-                        return true;
-                    }
-                }
-                else
-#endif
+                SalBitmap* pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
+                if( pSalBmp->Create( xBitmapCanvas, aSize ) && pSalMask->Create( xBitmapCanvas, aSize, true ) )
                 {
-                    // for Windows and Mac, exclusively use this code
-                    // path. The inline alpha on X11 is a hack.
-                    SalBitmap* pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
-                    if( pSalBmp->Create( xBitmapCanvas, aSize ) && pSalMask->Create( xBitmapCanvas, aSize, true ) )
-                    {
-                        Bitmap aBitmap( pSalBmp );
-                        Bitmap aMask( pSalMask );
-                        AlphaMask aAlphaMask( aMask );
-                        BitmapEx aBitmapEx( aBitmap, aAlphaMask );
-                        if ( pOut->GetMapMode() == MAP_PIXEL )
-                            pOut->DrawBitmapEx( rPos, aBitmapEx );
-                        else
-                            pOut->DrawBitmapEx( rPos, rLogicDestSize, aBitmapEx );
-                        return true;
-                    }
-                    delete pSalMask;
+                    Bitmap aBitmap( pSalBmp );
+                    Bitmap aMask( pSalMask );
+                    AlphaMask aAlphaMask( aMask );
+                    BitmapEx aBitmapEx( aBitmap, aAlphaMask );
+                    if ( pOut->GetMapMode() == MAP_PIXEL )
+                        pOut->DrawBitmapEx( rPos, aBitmapEx );
+                    else
+                        pOut->DrawBitmapEx( rPos, rLogicDestSize, aBitmapEx );
+                    return true;
                 }
+
                 delete pSalBmp;
+                delete pSalMask;
             }
         }
     }
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index bc4d8c7..00538b0 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -43,7 +43,6 @@
 #include <unx/salbmp.h>
 #include <unx/salinst.h>
 #include <unx/x11/xlimits.hxx>
-#include "xrender_peer.hxx"
 
 #if defined HAVE_VALGRIND_HEADERS
 #include <valgrind/memcheck.h>
@@ -67,7 +66,6 @@ X11SalBitmap::X11SalBitmap()
     : mpDIB( NULL )
     , mpDDB( NULL )
     , mbGrey( false )
-    , mbHasAlpha( false )
 {
 }
 
diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx
index e33a449..0288e05 100644
--- a/vcl/unx/generic/gdi/salgdi2.cxx
+++ b/vcl/unx/generic/gdi/salgdi2.cxx
@@ -479,10 +479,7 @@ void X11SalGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSa
         XChangeGC( pXDisp, aGC, nValues, &aNewVal );
     }
 
-    if ( rSalBitmap.GetBitCount() == 32 && rSalBitmap.HasAlpha() )
-        drawAlphaBitmapOpt( *pPosAry, rSalBitmap, rSalBitmap, false );
-    else
-        static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aDrawable, m_nXScreen, nDepth, *pPosAry, aGC );
+    static_cast<const X11SalBitmap&>(rSalBitmap).ImplDraw( aDrawable, m_nXScreen, nDepth, *pPosAry, aGC );
 
     if( rSalBitmap.GetBitCount() == 1 )
         XChangeGC( pXDisp, aGC, nValues, &aOldVal );
@@ -605,16 +602,10 @@ void X11SalGraphics::drawMaskedBitmap( const SalTwoRect* pPosAry,
 }
 
 bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
-                                      const SalBitmap& rSrcBitmap, const SalBitmap& rAlphaBmp )
-{
-    return drawAlphaBitmapOpt( rTR, rSrcBitmap, rAlphaBmp );
-}
-
-bool X11SalGraphics::drawAlphaBitmapOpt( const SalTwoRect& rTR,
-                                         const SalBitmap& rSrcBitmap, const SalBitmap& rAlphaBmp, bool bUseAlphaBitmap )
+    const SalBitmap& rSrcBitmap, const SalBitmap& rAlphaBmp )
 {
     // non 8-bit alpha not implemented yet
-    if( bUseAlphaBitmap && rAlphaBmp.GetBitCount() != 8 )
+    if( rAlphaBmp.GetBitCount() != 8 )
         return false;
 
     // horizontal mirroring not implemented yet
@@ -636,12 +627,10 @@ bool X11SalGraphics::drawAlphaBitmapOpt( const SalTwoRect& rTR,
     const SalVisual& rSalVis = pSalDisp->GetVisual( m_nXScreen );
     Display* pXDisplay = pSalDisp->GetDisplay();
 
-    Picture aAlphaPic = 0;
-    Pixmap aAlphaPM = 0;
     // create source Picture
     int nDepth = m_pVDev ? m_pVDev->GetDepth() : rSalVis.GetDepth();
     const X11SalBitmap& rSrcX11Bmp = static_cast<const X11SalBitmap&>( rSrcBitmap );
-    ImplSalDDB* pSrcDDB = rSrcX11Bmp.ImplGetDDB( hDrawable_, m_nXScreen, bUseAlphaBitmap ? nDepth : 32, rTR );
+    ImplSalDDB* pSrcDDB = rSrcX11Bmp.ImplGetDDB( hDrawable_, m_nXScreen, nDepth, rTR );
     if( !pSrcDDB )
         return false;
 
@@ -649,7 +638,7 @@ bool X11SalGraphics::drawAlphaBitmapOpt( const SalTwoRect& rTR,
     // we requested. E.g. mask pixmaps are always compatible with the drawable
     // TODO: find an appropriate picture format for these cases
     //       then remove the workaround below and the one for #i75531#
-    if( bUseAlphaBitmap && nDepth != pSrcDDB->ImplGetDepth() )
+    if( nDepth != pSrcDDB->ImplGetDepth() )
         return false;
 
     Pixmap aSrcPM = pSrcDDB->ImplGetPixmap();
@@ -660,88 +649,81 @@ bool X11SalGraphics::drawAlphaBitmapOpt( const SalTwoRect& rTR,
     // TODO: use scoped picture
     Visual* pSrcXVisual = rSalVis.GetVisual();
     XRenderPeer& rPeer = XRenderPeer::GetInstance();
-    XRenderPictFormat* pSrcVisFmt = bUseAlphaBitmap ? rPeer.FindVisualFormat( pSrcXVisual ) : rPeer.FindStandardFormat( PictStandardARGB32 );
+    XRenderPictFormat* pSrcVisFmt = rPeer.FindVisualFormat( pSrcXVisual );
     if( !pSrcVisFmt )
         return false;
     Picture aSrcPic = rPeer.CreatePicture( aSrcPM, pSrcVisFmt, 0, NULL );
     if( !aSrcPic )
         return false;
 
-    if ( bUseAlphaBitmap ) {
-        // create alpha Picture
+    // create alpha Picture
 
-        // TODO: use SalX11Bitmap functionality and caching for the Alpha Pixmap
-        // problem is that they don't provide an 8bit Pixmap on a non-8bit display
-        BitmapBuffer* pAlphaBuffer = const_cast<SalBitmap&>(rAlphaBmp).AcquireBuffer( sal_True );
-
-        // an XImage needs its data top_down
-        // TODO: avoid wrongly oriented images in upper layers!
-        const int nImageSize = pAlphaBuffer->mnHeight * pAlphaBuffer->mnScanlineSize;
-        const char* pSrcBits = (char*)pAlphaBuffer->mpBits;
-        char* pAlphaBits = new char[ nImageSize ];
-        if( BMP_SCANLINE_ADJUSTMENT( pAlphaBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )
-            memcpy( pAlphaBits, pSrcBits, nImageSize );
-        else
-            {
-                char* pDstBits = pAlphaBits + nImageSize;
-                const int nLineSize = pAlphaBuffer->mnScanlineSize;
-                for(; (pDstBits -= nLineSize) >= pAlphaBits; pSrcBits += nLineSize )
-                    memcpy( pDstBits, pSrcBits, nLineSize );
-            }
+    // TODO: use SalX11Bitmap functionality and caching for the Alpha Pixmap
+    // problem is that they don't provide an 8bit Pixmap on a non-8bit display
+    BitmapBuffer* pAlphaBuffer = const_cast<SalBitmap&>(rAlphaBmp).AcquireBuffer( sal_True );
 
-        // the alpha values need to be inverted for XRender
-        // TODO: make upper layers use standard alpha
-        long* pLDst = (long*)pAlphaBits;
-        for( int i = nImageSize/sizeof(long); --i >= 0; ++pLDst )
-            *pLDst = ~*pLDst;
-
-        char* pCDst = (char*)pLDst;
-        for( int i = nImageSize & (sizeof(long)-1); --i >= 0; ++pCDst )
-            *pCDst = ~*pCDst;
-
-        const XRenderPictFormat* pAlphaFormat = rPeer.GetStandardFormatA8();
-        XImage* pAlphaImg = XCreateImage( pXDisplay, pSrcXVisual, 8, ZPixmap, 0,
-                                          pAlphaBits, pAlphaBuffer->mnWidth, pAlphaBuffer->mnHeight,
-                                          pAlphaFormat->depth, pAlphaBuffer->mnScanlineSize );
-
-        aAlphaPM = limitXCreatePixmap( pXDisplay, hDrawable_,
-                                       rTR.mnDestWidth, rTR.mnDestHeight, 8 );
-
-        XGCValues aAlphaGCV;
-        aAlphaGCV.function = GXcopy;
-        GC aAlphaGC = XCreateGC( pXDisplay, aAlphaPM, GCFunction, &aAlphaGCV );
-        XPutImage( pXDisplay, aAlphaPM, aAlphaGC, pAlphaImg,
-                   rTR.mnSrcX, rTR.mnSrcY, 0, 0, rTR.mnDestWidth, rTR.mnDestHeight );
-        XFreeGC( pXDisplay, aAlphaGC );
-        XFree( pAlphaImg );
-        if( pAlphaBits != (char*)pAlphaBuffer->mpBits )
-            delete[] pAlphaBits;
-
-        const_cast<SalBitmap&>(rAlphaBmp).ReleaseBuffer( pAlphaBuffer, sal_True );
-
-        XRenderPictureAttributes aAttr;
-        aAttr.repeat = true;
-        aAlphaPic = rPeer.CreatePicture( aAlphaPM, pAlphaFormat, CPRepeat, &aAttr );
-        if( !aAlphaPic )
-            return false;
-    }
+    // an XImage needs its data top_down
+    // TODO: avoid wrongly oriented images in upper layers!
+    const int nImageSize = pAlphaBuffer->mnHeight * pAlphaBuffer->mnScanlineSize;
+    const char* pSrcBits = (char*)pAlphaBuffer->mpBits;
+    char* pAlphaBits = new char[ nImageSize ];
+    if( BMP_SCANLINE_ADJUSTMENT( pAlphaBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )
+        memcpy( pAlphaBits, pSrcBits, nImageSize );
+    else
+    {
+        char* pDstBits = pAlphaBits + nImageSize;
+        const int nLineSize = pAlphaBuffer->mnScanlineSize;
+        for(; (pDstBits -= nLineSize) >= pAlphaBits; pSrcBits += nLineSize )
+            memcpy( pDstBits, pSrcBits, nLineSize );
+    }
+
+    // the alpha values need to be inverted for XRender
+    // TODO: make upper layers use standard alpha
+    long* pLDst = (long*)pAlphaBits;
+    for( int i = nImageSize/sizeof(long); --i >= 0; ++pLDst )
+        *pLDst = ~*pLDst;
+
+    char* pCDst = (char*)pLDst;
+    for( int i = nImageSize & (sizeof(long)-1); --i >= 0; ++pCDst )
+        *pCDst = ~*pCDst;
+
+    const XRenderPictFormat* pAlphaFormat = rPeer.GetStandardFormatA8();
+    XImage* pAlphaImg = XCreateImage( pXDisplay, pSrcXVisual, 8, ZPixmap, 0,
+        pAlphaBits, pAlphaBuffer->mnWidth, pAlphaBuffer->mnHeight,
+        pAlphaFormat->depth, pAlphaBuffer->mnScanlineSize );
+
+    Pixmap aAlphaPM = limitXCreatePixmap( pXDisplay, hDrawable_,
+        rTR.mnDestWidth, rTR.mnDestHeight, 8 );
+
+    XGCValues aAlphaGCV;
+    aAlphaGCV.function = GXcopy;
+    GC aAlphaGC = XCreateGC( pXDisplay, aAlphaPM, GCFunction, &aAlphaGCV );
+    XPutImage( pXDisplay, aAlphaPM, aAlphaGC, pAlphaImg,
+        rTR.mnSrcX, rTR.mnSrcY, 0, 0, rTR.mnDestWidth, rTR.mnDestHeight );
+    XFreeGC( pXDisplay, aAlphaGC );
+    XFree( pAlphaImg );
+    if( pAlphaBits != (char*)pAlphaBuffer->mpBits )
+        delete[] pAlphaBits;
+
+    const_cast<SalBitmap&>(rAlphaBmp).ReleaseBuffer( pAlphaBuffer, sal_True );
+
+    XRenderPictureAttributes aAttr;
+    aAttr.repeat = true;
+    Picture aAlphaPic = rPeer.CreatePicture( aAlphaPM, pAlphaFormat, CPRepeat, &aAttr );
+    if( !aAlphaPic )
+        return false;
 
     // set clipping
     if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
         rPeer.SetPictureClipRegion( aDstPic, mpClipRegion );
 
     // paint source * mask over destination picture
-    rPeer.CompositePicture( PictOpOver, aSrcPic, bUseAlphaBitmap ? aAlphaPic : None, aDstPic,
-                            rTR.mnSrcX, rTR.mnSrcY, 0, 0,
-                            rTR.mnDestX, rTR.mnDestY, rTR.mnDestWidth, rTR.mnDestHeight );
+    rPeer.CompositePicture( PictOpOver, aSrcPic, aAlphaPic, aDstPic,
+        rTR.mnSrcX, rTR.mnSrcY, 0, 0,
+        rTR.mnDestX, rTR.mnDestY, rTR.mnDestWidth, rTR.mnDestHeight );
 
-    if ( bUseAlphaBitmap )
-    {
-        if ( aAlphaPic )
-            rPeer.FreePicture( aAlphaPic );
-        if ( aAlphaPM )
-            XFreePixmap( pXDisplay, aAlphaPM );
-    }
+    rPeer.FreePicture( aAlphaPic );
+    XFreePixmap(pXDisplay, aAlphaPM);
     rPeer.FreePicture( aSrcPic );
     return true;
 }
commit 056c7b46d42c9cb891cb269a2561f1cf34cafe10
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Jun 10 12:24:10 2013 +0100

    Revert "pass argb32 pixmaps from vcl to canvas, avoiding costly x11 ...
    
    This reverts commit 22f63477a3300d474c3d6832232b888f75c7290c.
    
    Conflicts:
    	canvas/source/cairo/cairo_canvasbitmap.cxx
    
    Change-Id: Ib266050ebc6eaca4fbd36ed013ac95a1b4b9d316

diff --git a/canvas/source/cairo/cairo_canvasbitmap.cxx b/canvas/source/cairo/cairo_canvasbitmap.cxx
index 0f7be7f..91f6194 100644
--- a/canvas/source/cairo/cairo_canvasbitmap.cxx
+++ b/canvas/source/cairo/cairo_canvasbitmap.cxx
@@ -134,30 +134,6 @@ namespace cairocanvas
         return maCanvasHelper.repaint( pSurface, viewState, renderState );
     }
 
-    void SAL_CALL CanvasBitmap::setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rAny )  throw (uno::RuntimeException)
-    {
-        sal_Int64 nPointer = 0;
-
-        if ( nHandle == 0 )
-        {
-            rAny >>= nPointer;
-
-            if ( nPointer )
-            {
-                ::Bitmap *pBitmap = reinterpret_cast< ::Bitmap* >( nPointer );
-
-                mpBufferSurface = createSurface( *pBitmap );
-                mpBufferCairo = mpBufferSurface->getCairo();
-
-                ::Size aSize( pBitmap->GetSizePixel() );
-                maSize = ::basegfx::B2ISize( aSize.getWidth(), aSize.getHeight() );
-
-                maCanvasHelper.setSize( maSize );
-                maCanvasHelper.setSurface( mpBufferSurface, mbHasAlpha );
-            }
-        }
-    }
-
     uno::Any SAL_CALL CanvasBitmap::getFastPropertyValue( sal_Int32 nHandle )  throw (uno::RuntimeException)
     {
         uno::Any aRV( sal_Int32(0) );
@@ -176,11 +152,10 @@ namespace cairocanvas
 #ifdef CAIRO_HAS_XLIB_SURFACE
                 X11Surface* pXlibSurface=dynamic_cast<X11Surface*>(mpBufferSurface.get());
                 OSL_ASSERT(pXlibSurface);
-                uno::Sequence< uno::Any > args( 4 );
+                uno::Sequence< uno::Any > args( 3 );
                 args[0] = uno::Any( false );  // do not call XFreePixmap on it
                 args[1] = uno::Any( pXlibSurface->getPixmap()->mhDrawable );
                 args[2] = uno::Any( sal_Int32( pXlibSurface->getDepth() ) );
-                args[3] = uno::Any( sal_Int64( pXlibSurface->getVisual () ) );
 
                 aRV = uno::Any( args );
 #elif defined CAIRO_HAS_QUARTZ_SURFACE
@@ -205,7 +180,7 @@ namespace cairocanvas
             case 2:
             {
 #ifdef CAIRO_HAS_XLIB_SURFACE
-                uno::Sequence< uno::Any > args( 4 );
+                uno::Sequence< uno::Any > args( 3 );
                 SurfaceSharedPtr pAlphaSurface = mpSurfaceProvider->createSurface( maSize, CAIRO_CONTENT_COLOR );
                 CairoSharedPtr   pAlphaCairo = pAlphaSurface->getCairo();
                 X11Surface* pXlibSurface=dynamic_cast<X11Surface*>(pAlphaSurface.get());
@@ -224,7 +199,6 @@ namespace cairocanvas
                 args[0] = uno::Any( true );
                 args[1] = ::com::sun::star::uno::Any( pPixmap->mhDrawable );
                 args[2] = ::com::sun::star::uno::Any( sal_Int32( pXlibSurface->getDepth () ) );
-                args[3] = ::com::sun::star::uno::Any( sal_Int64( pXlibSurface->getVisual () ) );
                 pPixmap->clear(); // caller takes ownership of pixmap
 
                 // return pixmap and alphachannel pixmap - it will be used in BitmapEx
diff --git a/canvas/source/cairo/cairo_canvasbitmap.hxx b/canvas/source/cairo/cairo_canvasbitmap.hxx
index bef03f5..b1d669e 100644
--- a/canvas/source/cairo/cairo_canvasbitmap.hxx
+++ b/canvas/source/cairo/cairo_canvasbitmap.hxx
@@ -115,14 +115,14 @@ namespace cairocanvas
         //     2nd the pixmap handle
         //     3rd the pixmap depth
         virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle)  throw (::com::sun::star::uno::RuntimeException);
-        virtual void SAL_CALL setFastPropertyValue(sal_Int32, const ::com::sun::star::uno::Any&)  throw (::com::sun::star::uno::RuntimeException);
+        virtual void SAL_CALL setFastPropertyValue(sal_Int32, const ::com::sun::star::uno::Any&)  throw (::com::sun::star::uno::RuntimeException) {}
 
     private:
         SurfaceProviderRef        mpSurfaceProvider;
         ::cairo::SurfaceSharedPtr mpBufferSurface;
         ::cairo::CairoSharedPtr   mpBufferCairo;
 
-        ::basegfx::B2ISize        maSize;
+        const ::basegfx::B2ISize  maSize;
         const bool                mbHasAlpha;
     };
 }
diff --git a/canvas/source/cairo/cairo_xlib_cairo.cxx b/canvas/source/cairo/cairo_xlib_cairo.cxx
index 8b26292..bae6943 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.cxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.cxx
@@ -187,7 +187,7 @@ namespace cairo
         mpSurface(
             cairo_xlib_surface_create( (Display*)rSysData.pDisplay,
                                        (Drawable)rData.aPixmap,
-                                       (Visual*) (rData.aVisual ? rData.aVisual : rSysData.pVisual),
+                                       (Visual*) rSysData.pVisual,
                                        rData.mnWidth, rData.mnHeight ),
             &cairo_surface_destroy)
     {
@@ -312,11 +312,6 @@ namespace cairo
         return -1;
     }
 
-    void* X11Surface::getVisual() const
-    {
-        return cairo_xlib_surface_get_visual( mpSurface.get() );
-    }
-
     SurfaceSharedPtr createSurface( const CairoSurfaceSharedPtr& rSurface )
     {
         return SurfaceSharedPtr(new X11Surface(rSurface));
diff --git a/canvas/source/cairo/cairo_xlib_cairo.hxx b/canvas/source/cairo/cairo_xlib_cairo.hxx
index 080258b..105c570 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.hxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.hxx
@@ -92,7 +92,6 @@ namespace cairo {
         X11PixmapSharedPtr getPixmap() const { return mpPixmap; }
         void* getRenderFormat() const { return maSysData.pRenderFormat; }
         long getDrawable() const { return mpPixmap ? mpPixmap->mhDrawable : maSysData.hDrawable; }
-        void* getVisual() const;
     };
 }
 
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 4ca9cc1..1715022 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -307,7 +307,6 @@ struct BitmapSystemData
     void* rImageContext;     //Image context (CGContextRef)
     #else
     void* aPixmap;
-    void* aVisual;
     #endif
     int mnWidth;
     int mnHeight;
@@ -823,8 +822,6 @@ public:
                                     const BmpFilterParam* pFilterParam = NULL,
                                     const Link* pProgress = NULL );
 
-    bool                        HasAlpha();
-
 public:
     /** Draw a blend frame to the Bitmap
 
diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h
index 0fc9884..ea69da4 100644
--- a/vcl/inc/unx/salbmp.h
+++ b/vcl/inc/unx/salbmp.h
@@ -81,7 +81,6 @@ public:
 
     SAL_DLLPRIVATE bool         ImplCreateFromDrawable(
                                     Drawable aDrawable,
-                                    void* pVisual,
                                     SalX11Screen nXScreen,
                                     long nDrawableDepth,
                                     long nX,
@@ -164,7 +163,6 @@ class ImplSalDDB
 private:
 
     Pixmap          maPixmap;
-    void*           mpVisual;
     SalTwoRect      maTwoRect;
     long            mnDepth;
     SalX11Screen    mnXScreen;
@@ -196,7 +194,6 @@ public:
 
                     ImplSalDDB(
                         Drawable aDrawable,
-                        void *pVisual,
                         SalX11Screen nXScreen,
                         long nDrawableDepth,
                         long nX,
@@ -208,7 +205,6 @@ public:
                     ~ImplSalDDB();
 
     Pixmap          ImplGetPixmap() const { return maPixmap; }
-    void*           ImplGetVisual() const { return mpVisual; }
     long            ImplGetWidth() const { return maTwoRect.mnDestWidth; }
     long            ImplGetHeight() const { return maTwoRect.mnDestHeight; }
     long            ImplGetDepth() const { return mnDepth; }
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 3520159..2bb1a9d 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -1812,17 +1812,4 @@ bool Bitmap::GetSystemData( BitmapSystemData& rData ) const
     return bRet;
 }
 
-bool Bitmap::HasAlpha()
-{
-    bool bRet = false;
-    if( mpImpBmp )
-    {
-        SalBitmap* pSalBitmap = mpImpBmp->ImplGetSalBitmap();
-        if( pSalBitmap )
-            bRet = pSalBitmap->HasAlpha();
-    }
-
-    return bRet;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx
index ae48e4b..9ba85d0 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -21,8 +21,6 @@
 #include <rtl/logfile.hxx>
 #include <cppuhelper/compbase1.hxx>
 
-#include <com/sun/star/beans/XFastPropertySet.hpp>
-
 #include <com/sun/star/geometry/RealSize2D.hpp>
 #include <com/sun/star/geometry/RealPoint2D.hpp>
 #include <com/sun/star/geometry/RealRectangle2D.hpp>
@@ -72,32 +70,11 @@ namespace vcl
 {
     namespace unotools
     {
-        uno::Reference< rendering::XBitmap > xBitmapFromBitmapEx( const uno::Reference< rendering::XGraphicDevice >& xGraphicDevice,
+        uno::Reference< rendering::XBitmap > xBitmapFromBitmapEx( const uno::Reference< rendering::XGraphicDevice >&    /*xGraphicDevice*/,
                                                                   const ::BitmapEx&                                     inputBitmap )
         {
             RTL_LOGFILE_CONTEXT( aLog, "::vcl::unotools::xBitmapFromBitmapEx()" );
 
-            if ( inputBitmap.GetBitmap().HasAlpha() )
-            {
-                geometry::IntegerSize2D aSize;
-
-                aSize.Width = aSize.Height = 1;
-
-                uno::Reference< rendering::XBitmap > xBitmap = xGraphicDevice->createCompatibleAlphaBitmap( aSize );
-
-                uno::Reference< beans::XFastPropertySet > rPropSet( xBitmap, uno::UNO_QUERY );
-                if ( rPropSet.is() )
-                {
-                    Bitmap aBitmap = inputBitmap.GetBitmap();
-                    rPropSet->setFastPropertyValue( 0, uno::Any( sal_Int64( &aBitmap )));
-
-                    aSize = xBitmap->getSize();
-
-                    if ( aSize.Width != 1 || aSize.Height != 1 )
-                        return xBitmap;
-                }
-            }
-
             return new vcl::unotools::VclCanvasBitmap( inputBitmap );
         }
 
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 9c7a798..bc4d8c7 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -567,7 +567,6 @@ XImage* X11SalBitmap::ImplCreateXImage(
 // -----------------------------------------------------------------------------
 bool X11SalBitmap::ImplCreateFromDrawable(
     Drawable aDrawable,
-    void *pVisual,
     SalX11Screen nScreen,
     long nDrawableDepth,
     long nX,
@@ -578,7 +577,7 @@ bool X11SalBitmap::ImplCreateFromDrawable(
     Destroy();
 
     if( aDrawable && nWidth && nHeight && nDrawableDepth )
-        mpDDB = new ImplSalDDB( aDrawable, pVisual, nScreen, nDrawableDepth, nX, nY, nWidth, nHeight );
+        mpDDB = new ImplSalDDB( aDrawable, nScreen, nDrawableDepth, nX, nY, nWidth, nHeight );
 
     return( mpDDB != NULL );
 }
@@ -738,8 +737,7 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp )
     }
     else if(  rSalBmp.mpDDB )
         ImplCreateFromDrawable( rSalBmp.mpDDB->ImplGetPixmap(),
-                                rSalBmp.mpDDB->ImplGetVisual(),
-                               rSalBmp.mpDDB->ImplGetScreen(),
+                                rSalBmp.mpDDB->ImplGetScreen(),
                                 rSalBmp.mpDDB->ImplGetDepth(),
                                 0, 0, rSalBmp.mpDDB->ImplGetWidth(), rSalBmp.mpDDB->ImplGetHeight() );
 
@@ -778,13 +776,11 @@ bool X11SalBitmap::Create(
 
         if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) {
             long pixmapHandle;
-            sal_Int64 nVisualPtr;
-            if( args.getLength() >= 4 && ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) && ( args[3] >>= nVisualPtr ) ) {
+            if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) {
 
                 mbGrey = bMask;
                 bool bSuccess = ImplCreateFromDrawable(
                                     pixmapHandle,
-                                    reinterpret_cast<void*>(nVisualPtr),
                                     // FIXME: this seems multi-screen broken to me
                                     SalX11Screen( 0 ),
                                     depth,
@@ -896,7 +892,6 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData )
         // prolly not a good idea, since it's accessed from
         // non-platform aware code in vcl/bitmap.hxx)
         rData.aPixmap = (void*)mpDDB->ImplGetPixmap();
-        rData.aVisual = mpDDB->ImplGetVisual ();
         rData.mnWidth = mpDDB->ImplGetWidth ();
         rData.mnHeight = mpDDB->ImplGetHeight ();
         return true;
@@ -912,7 +907,6 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData )
 ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable,
                         SalX11Screen nXScreen, const SalTwoRect& rTwoRect )
     : maPixmap    ( 0 )
-    , mpVisual    ( NULL )
     , maTwoRect   ( rTwoRect )
     , mnDepth     ( pImage->depth )
     , mnXScreen   ( nXScreen )
@@ -944,15 +938,13 @@ ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable,
 
 ImplSalDDB::ImplSalDDB(
     Drawable aDrawable,
-    void *pVisual,
     SalX11Screen nXScreen,
     long nDrawableDepth,
     long nX,
     long nY,
     long nWidth,
     long nHeight
-)   : mpVisual    ( pVisual )
-    , mnDepth( nDrawableDepth )
+)   : mnDepth( nDrawableDepth )
     , mnXScreen( nXScreen )
 {
     SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx
index 29ea8ec..e33a449 100644
--- a/vcl/unx/generic/gdi/salgdi2.cxx
+++ b/vcl/unx/generic/gdi/salgdi2.cxx
@@ -83,7 +83,7 @@ void X11SalGraphics::CopyScreenArea( Display* pDisplay,
     else
     {
         X11SalBitmap aBM;
-        aBM.ImplCreateFromDrawable( aSrc, NULL, nXScreenSrc, nSrcDepth, src_x, src_y, w, h );
+        aBM.ImplCreateFromDrawable( aSrc, nXScreenSrc, nSrcDepth, src_x, src_y, w, h );
         SalTwoRect aTwoRect;
         aTwoRect.mnSrcX = aTwoRect.mnSrcY = 0;
         aTwoRect.mnSrcWidth = aTwoRect.mnDestWidth = w;
@@ -887,7 +887,7 @@ SalBitmap *X11SalGraphics::getBitmap( long nX, long nY, long nDX, long nDY )
         nBitCount = 1;
 
     if( ! bFakeWindowBG )
-        pSalBitmap->ImplCreateFromDrawable( GetDrawable(), NULL, m_nXScreen, nBitCount, nX, nY, nDX, nDY );
+        pSalBitmap->ImplCreateFromDrawable( GetDrawable(), m_nXScreen, nBitCount, nX, nY, nDX, nDY );
     else
         pSalBitmap->Create( Size( nDX, nDY ), (nBitCount > 8) ? 24 : nBitCount, BitmapPalette( nBitCount > 8 ? nBitCount : 0 ) );
 


More information about the Libreoffice-commits mailing list