diff options
author | Radek Doulik <rodo@novell.com> | 2013-03-14 09:36:43 +0100 |
---|---|---|
committer | Radek Doulik <rodo@novell.com> | 2013-03-14 09:39:52 +0100 |
commit | c6c0e73e0fda18b7bb37685ab8f8630e15bb427a (patch) | |
tree | c8b127497b6d83a2deec7d6688296fdb2f979abd /vcl/source/helper/canvastools.cxx | |
parent | 35e2749cb534fdbe355166ec656beb72248cb096 (diff) |
pass argb32 pixmaps from vcl to canvas, avoiding costly x11 roundtrips
- fixes also problem with emf+ rendering for slideshow
Change-Id: Icb894d3f37b29f23d3f267c944d827eefbf47fda
Diffstat (limited to 'vcl/source/helper/canvastools.cxx')
-rw-r--r-- | vcl/source/helper/canvastools.cxx | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx index b8dce8d6ecb4..a0a69375a1e3 100644 --- a/vcl/source/helper/canvastools.cxx +++ b/vcl/source/helper/canvastools.cxx @@ -30,6 +30,8 @@ #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> @@ -79,11 +81,32 @@ 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 ); } |