[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 4 commits - canvas/source include/vcl vcl/inc vcl/source vcl/unx
Michael Meeks
michael.meeks at suse.com
Wed Jun 12 01:13:51 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
include/vcl/bitmap.hxx | 3
include/vcl/bitmapex.hxx | 11 +
include/vcl/gdimtf.hxx | 2
vcl/inc/salbmp.hxx | 3
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 | 35 +-----
vcl/source/gdi/pdfwriter_impl2.cxx | 2
vcl/source/helper/canvastools.cxx | 25 ----
vcl/unx/generic/gdi/salbmp.cxx | 18 ---
vcl/unx/generic/gdi/salgdi2.cxx | 152 ++++++++++++---------------
17 files changed, 245 insertions(+), 282 deletions(-)
New commits:
commit b1ddd22afee045c3ef91756c4f605bb2dd973340
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
Conflicts:
vcl/source/gdi/gdimtf.cxx
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 61edab7..3e0d331 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 40448ef..f5666a6 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -428,33 +428,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 );
if ( pOut->GetMapMode() == MAP_PIXEL )
- pOut->DrawBitmap( rPos, aBitmap );
+ pOut->DrawBitmapEx( rPos, aBitmapEx );
else
- pOut->DrawBitmap( rPos, rLogicDestSize, aBitmap );
+ pOut->DrawBitmapEx( rPos, rLogicDestSize, aBitmapEx );
return true;
}
-
- delete pSalBmp;
- delete pSalMask;
}
}
}
commit 162f76b63a68110b031d1a87332a6693b7e44457
Author: Radek Doulik <rodo at novell.com>
Date: Mon Apr 29 00:00:00 2013 +0200
Fix bnc#795857 Use correct sizes for EMF+ bitmap rendering
Fix pdf export wrong size issues for embedded EMF+ images.
Change-Id: I998c9535bde32fc9f452d61d7cb7609c95f5528d
(cherry picked from commit 4c676625d4016d428e9becd5512b7cfc8b0c4b24)
Conflicts:
vcl/inc/vcl/gdimtf.hxx
vcl/source/gdi/gdimtf.cxx
Conflicts:
vcl/source/gdi/gdimtf.cxx
diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index bbdf141..c790acd 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -111,7 +111,7 @@ private:
const OutputDevice& rMapDev,
const PolyPolygon& rPolyPoly,
const Gradient& rGrad );
- SAL_DLLPRIVATE bool ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize );
+ SAL_DLLPRIVATE bool ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rLogicDestSize );
SAL_DLLPRIVATE void ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, OutputDevice* pOut );
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 7583e37..40448ef 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -355,7 +355,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos )
OSL_TRACE("GDIMetaFile::Play on device of size: %d x %d", pOut->GetOutputSizePixel().Width(), pOut->GetOutputSizePixel().Height());
- if( !ImplPlayWithRenderer( pOut, Point(0,0), pOut->GetOutputSizePixel() ) ) {
+ if( !ImplPlayWithRenderer( pOut, Point(0,0), pOut->GetOutputSize() ) ) {
size_t i = 0;
for( size_t nCurPos = nCurrentActionElement; nCurPos < nPos; nCurPos++ )
{
@@ -384,11 +384,13 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos )
}
}
-bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize )
+bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rLogicDestSize )
{
if (!bUseCanvas)
return false;
+ Size rDestSize( pOut->LogicToPixel( rLogicDestSize ) );
+
const Window* win = dynamic_cast <Window*> ( pOut );
if (!win)
@@ -433,7 +435,7 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 );
BitmapEx* pBitmapEx = (BitmapEx*) *reinterpret_cast<const sal_Int64*>(aAny.getValue());
if( pBitmapEx ) {
- pOut->DrawBitmapEx( rPos, *pBitmapEx );
+ pOut->DrawBitmapEx( rPos, rLogicDestSize, *pBitmapEx );
delete pBitmapEx;
return true;
}
@@ -444,13 +446,10 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
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 );
+ pOut->DrawBitmap( rPos, aBitmap );
else
- pOut->DrawBitmapEx( rPos, rLogicDestSize, aBitmapEx );
+ pOut->DrawBitmap( rPos, rLogicDestSize, aBitmap );
return true;
}
@@ -555,7 +554,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
{
GDIMetaFile* pMtf = pOut->GetConnectMetaFile();
- if( ImplPlayWithRenderer( pOut, rPos, aDestSize ) )
+ if( ImplPlayWithRenderer( pOut, rPos, rSize ) )
return;
Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 7775741..a8e0d7d 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -774,7 +774,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
BitmapEx aBitmapEx( pA->GetBitmap() );
Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
- aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
+ aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
if( ! ( aSize.Width() && aSize.Height() ) )
aSize = pDummyVDev->PixelToLogic( aBitmapEx.GetSizePixel() );
implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, pDummyVDev, i_rContext );
commit 4996db892138963746b22c45654cf3b733859ffa
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
Conflicts:
vcl/inc/salbmp.hxx
vcl/source/gdi/gdimtf.cxx
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index be181f9..bd95a36 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -47,8 +47,7 @@ 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 SetHasAlpha( bool ) { }
+
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 223fd65..7583e37 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -440,16 +440,22 @@ bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, S
}
SalBitmap* pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
- pSalBmp->SetHasAlpha( true );
-
- if( pSalBmp->Create( xBitmapCanvas, aSize ) )
+ SalBitmap* pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
+ if( pSalBmp->Create( xBitmapCanvas, aSize ) && pSalMask->Create( xBitmapCanvas, aSize, true ) )
{
Bitmap aBitmap( pSalBmp );
- pOut->DrawBitmap( rPos, aBitmap );
+ 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 87b32becda5c16eac318e69936f6533da472bda2
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 bacec11..85aead9 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -305,7 +305,6 @@ struct BitmapSystemData
void* rImageContext; //Image context (CGContextRef)
#else
void* aPixmap;
- void* aVisual;
#endif
int mnWidth;
int mnHeight;
@@ -821,8 +820,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 223dc64..bf5398d 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