Kaydet (Commit) 056c7b46 authored tarafından Michael Meeks's avatar Michael Meeks

Revert "pass argb32 pixmaps from vcl to canvas, avoiding costly x11 ...

This reverts commit 22f63477.

Conflicts:
	canvas/source/cairo/cairo_canvasbitmap.cxx

Change-Id: Ib266050ebc6eaca4fbd36ed013ac95a1b4b9d316
üst 85165a18
...@@ -134,30 +134,6 @@ namespace cairocanvas ...@@ -134,30 +134,6 @@ namespace cairocanvas
return maCanvasHelper.repaint( pSurface, viewState, renderState ); 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 SAL_CALL CanvasBitmap::getFastPropertyValue( sal_Int32 nHandle ) throw (uno::RuntimeException)
{ {
uno::Any aRV( sal_Int32(0) ); uno::Any aRV( sal_Int32(0) );
...@@ -176,11 +152,10 @@ namespace cairocanvas ...@@ -176,11 +152,10 @@ namespace cairocanvas
#ifdef CAIRO_HAS_XLIB_SURFACE #ifdef CAIRO_HAS_XLIB_SURFACE
X11Surface* pXlibSurface=dynamic_cast<X11Surface*>(mpBufferSurface.get()); X11Surface* pXlibSurface=dynamic_cast<X11Surface*>(mpBufferSurface.get());
OSL_ASSERT(pXlibSurface); 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[0] = uno::Any( false ); // do not call XFreePixmap on it
args[1] = uno::Any( pXlibSurface->getPixmap()->mhDrawable ); args[1] = uno::Any( pXlibSurface->getPixmap()->mhDrawable );
args[2] = uno::Any( sal_Int32( pXlibSurface->getDepth() ) ); args[2] = uno::Any( sal_Int32( pXlibSurface->getDepth() ) );
args[3] = uno::Any( sal_Int64( pXlibSurface->getVisual () ) );
aRV = uno::Any( args ); aRV = uno::Any( args );
#elif defined CAIRO_HAS_QUARTZ_SURFACE #elif defined CAIRO_HAS_QUARTZ_SURFACE
...@@ -205,7 +180,7 @@ namespace cairocanvas ...@@ -205,7 +180,7 @@ namespace cairocanvas
case 2: case 2:
{ {
#ifdef CAIRO_HAS_XLIB_SURFACE #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 ); SurfaceSharedPtr pAlphaSurface = mpSurfaceProvider->createSurface( maSize, CAIRO_CONTENT_COLOR );
CairoSharedPtr pAlphaCairo = pAlphaSurface->getCairo(); CairoSharedPtr pAlphaCairo = pAlphaSurface->getCairo();
X11Surface* pXlibSurface=dynamic_cast<X11Surface*>(pAlphaSurface.get()); X11Surface* pXlibSurface=dynamic_cast<X11Surface*>(pAlphaSurface.get());
...@@ -224,7 +199,6 @@ namespace cairocanvas ...@@ -224,7 +199,6 @@ namespace cairocanvas
args[0] = uno::Any( true ); args[0] = uno::Any( true );
args[1] = ::com::sun::star::uno::Any( pPixmap->mhDrawable ); args[1] = ::com::sun::star::uno::Any( pPixmap->mhDrawable );
args[2] = ::com::sun::star::uno::Any( sal_Int32( pXlibSurface->getDepth () ) ); 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 pPixmap->clear(); // caller takes ownership of pixmap
// return pixmap and alphachannel pixmap - it will be used in BitmapEx // return pixmap and alphachannel pixmap - it will be used in BitmapEx
......
...@@ -115,14 +115,14 @@ namespace cairocanvas ...@@ -115,14 +115,14 @@ namespace cairocanvas
// 2nd the pixmap handle // 2nd the pixmap handle
// 3rd the pixmap depth // 3rd the pixmap depth
virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw (::com::sun::star::uno::RuntimeException); 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: private:
SurfaceProviderRef mpSurfaceProvider; SurfaceProviderRef mpSurfaceProvider;
::cairo::SurfaceSharedPtr mpBufferSurface; ::cairo::SurfaceSharedPtr mpBufferSurface;
::cairo::CairoSharedPtr mpBufferCairo; ::cairo::CairoSharedPtr mpBufferCairo;
::basegfx::B2ISize maSize; const ::basegfx::B2ISize maSize;
const bool mbHasAlpha; const bool mbHasAlpha;
}; };
} }
......
...@@ -187,7 +187,7 @@ namespace cairo ...@@ -187,7 +187,7 @@ namespace cairo
mpSurface( mpSurface(
cairo_xlib_surface_create( (Display*)rSysData.pDisplay, cairo_xlib_surface_create( (Display*)rSysData.pDisplay,
(Drawable)rData.aPixmap, (Drawable)rData.aPixmap,
(Visual*) (rData.aVisual ? rData.aVisual : rSysData.pVisual), (Visual*) rSysData.pVisual,
rData.mnWidth, rData.mnHeight ), rData.mnWidth, rData.mnHeight ),
&cairo_surface_destroy) &cairo_surface_destroy)
{ {
...@@ -312,11 +312,6 @@ namespace cairo ...@@ -312,11 +312,6 @@ namespace cairo
return -1; return -1;
} }
void* X11Surface::getVisual() const
{
return cairo_xlib_surface_get_visual( mpSurface.get() );
}
SurfaceSharedPtr createSurface( const CairoSurfaceSharedPtr& rSurface ) SurfaceSharedPtr createSurface( const CairoSurfaceSharedPtr& rSurface )
{ {
return SurfaceSharedPtr(new X11Surface(rSurface)); return SurfaceSharedPtr(new X11Surface(rSurface));
......
...@@ -92,7 +92,6 @@ namespace cairo { ...@@ -92,7 +92,6 @@ namespace cairo {
X11PixmapSharedPtr getPixmap() const { return mpPixmap; } X11PixmapSharedPtr getPixmap() const { return mpPixmap; }
void* getRenderFormat() const { return maSysData.pRenderFormat; } void* getRenderFormat() const { return maSysData.pRenderFormat; }
long getDrawable() const { return mpPixmap ? mpPixmap->mhDrawable : maSysData.hDrawable; } long getDrawable() const { return mpPixmap ? mpPixmap->mhDrawable : maSysData.hDrawable; }
void* getVisual() const;
}; };
} }
......
...@@ -307,7 +307,6 @@ struct BitmapSystemData ...@@ -307,7 +307,6 @@ struct BitmapSystemData
void* rImageContext; //Image context (CGContextRef) void* rImageContext; //Image context (CGContextRef)
#else #else
void* aPixmap; void* aPixmap;
void* aVisual;
#endif #endif
int mnWidth; int mnWidth;
int mnHeight; int mnHeight;
...@@ -823,8 +822,6 @@ public: ...@@ -823,8 +822,6 @@ public:
const BmpFilterParam* pFilterParam = NULL, const BmpFilterParam* pFilterParam = NULL,
const Link* pProgress = NULL ); const Link* pProgress = NULL );
bool HasAlpha();
public: public:
/** Draw a blend frame to the Bitmap /** Draw a blend frame to the Bitmap
......
...@@ -81,7 +81,6 @@ public: ...@@ -81,7 +81,6 @@ public:
SAL_DLLPRIVATE bool ImplCreateFromDrawable( SAL_DLLPRIVATE bool ImplCreateFromDrawable(
Drawable aDrawable, Drawable aDrawable,
void* pVisual,
SalX11Screen nXScreen, SalX11Screen nXScreen,
long nDrawableDepth, long nDrawableDepth,
long nX, long nX,
...@@ -164,7 +163,6 @@ class ImplSalDDB ...@@ -164,7 +163,6 @@ class ImplSalDDB
private: private:
Pixmap maPixmap; Pixmap maPixmap;
void* mpVisual;
SalTwoRect maTwoRect; SalTwoRect maTwoRect;
long mnDepth; long mnDepth;
SalX11Screen mnXScreen; SalX11Screen mnXScreen;
...@@ -196,7 +194,6 @@ public: ...@@ -196,7 +194,6 @@ public:
ImplSalDDB( ImplSalDDB(
Drawable aDrawable, Drawable aDrawable,
void *pVisual,
SalX11Screen nXScreen, SalX11Screen nXScreen,
long nDrawableDepth, long nDrawableDepth,
long nX, long nX,
...@@ -208,7 +205,6 @@ public: ...@@ -208,7 +205,6 @@ public:
~ImplSalDDB(); ~ImplSalDDB();
Pixmap ImplGetPixmap() const { return maPixmap; } Pixmap ImplGetPixmap() const { return maPixmap; }
void* ImplGetVisual() const { return mpVisual; }
long ImplGetWidth() const { return maTwoRect.mnDestWidth; } long ImplGetWidth() const { return maTwoRect.mnDestWidth; }
long ImplGetHeight() const { return maTwoRect.mnDestHeight; } long ImplGetHeight() const { return maTwoRect.mnDestHeight; }
long ImplGetDepth() const { return mnDepth; } long ImplGetDepth() const { return mnDepth; }
......
...@@ -1812,17 +1812,4 @@ bool Bitmap::GetSystemData( BitmapSystemData& rData ) const ...@@ -1812,17 +1812,4 @@ bool Bitmap::GetSystemData( BitmapSystemData& rData ) const
return bRet; 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include <rtl/logfile.hxx> #include <rtl/logfile.hxx>
#include <cppuhelper/compbase1.hxx> #include <cppuhelper/compbase1.hxx>
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <com/sun/star/geometry/RealSize2D.hpp> #include <com/sun/star/geometry/RealSize2D.hpp>
#include <com/sun/star/geometry/RealPoint2D.hpp> #include <com/sun/star/geometry/RealPoint2D.hpp>
#include <com/sun/star/geometry/RealRectangle2D.hpp> #include <com/sun/star/geometry/RealRectangle2D.hpp>
...@@ -72,32 +70,11 @@ namespace vcl ...@@ -72,32 +70,11 @@ namespace vcl
{ {
namespace unotools 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 ) const ::BitmapEx& inputBitmap )
{ {
RTL_LOGFILE_CONTEXT( aLog, "::vcl::unotools::xBitmapFromBitmapEx()" ); 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 ); return new vcl::unotools::VclCanvasBitmap( inputBitmap );
} }
......
...@@ -567,7 +567,6 @@ XImage* X11SalBitmap::ImplCreateXImage( ...@@ -567,7 +567,6 @@ XImage* X11SalBitmap::ImplCreateXImage(
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool X11SalBitmap::ImplCreateFromDrawable( bool X11SalBitmap::ImplCreateFromDrawable(
Drawable aDrawable, Drawable aDrawable,
void *pVisual,
SalX11Screen nScreen, SalX11Screen nScreen,
long nDrawableDepth, long nDrawableDepth,
long nX, long nX,
...@@ -578,7 +577,7 @@ bool X11SalBitmap::ImplCreateFromDrawable( ...@@ -578,7 +577,7 @@ bool X11SalBitmap::ImplCreateFromDrawable(
Destroy(); Destroy();
if( aDrawable && nWidth && nHeight && nDrawableDepth ) 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 ); return( mpDDB != NULL );
} }
...@@ -738,8 +737,7 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp ) ...@@ -738,8 +737,7 @@ bool X11SalBitmap::Create( const SalBitmap& rSSalBmp )
} }
else if( rSalBmp.mpDDB ) else if( rSalBmp.mpDDB )
ImplCreateFromDrawable( rSalBmp.mpDDB->ImplGetPixmap(), ImplCreateFromDrawable( rSalBmp.mpDDB->ImplGetPixmap(),
rSalBmp.mpDDB->ImplGetVisual(), rSalBmp.mpDDB->ImplGetScreen(),
rSalBmp.mpDDB->ImplGetScreen(),
rSalBmp.mpDDB->ImplGetDepth(), rSalBmp.mpDDB->ImplGetDepth(),
0, 0, rSalBmp.mpDDB->ImplGetWidth(), rSalBmp.mpDDB->ImplGetHeight() ); 0, 0, rSalBmp.mpDDB->ImplGetWidth(), rSalBmp.mpDDB->ImplGetHeight() );
...@@ -778,13 +776,11 @@ bool X11SalBitmap::Create( ...@@ -778,13 +776,11 @@ bool X11SalBitmap::Create(
if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) { if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) {
long pixmapHandle; long pixmapHandle;
sal_Int64 nVisualPtr; if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) {
if( args.getLength() >= 4 && ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) && ( args[3] >>= nVisualPtr ) ) {
mbGrey = bMask; mbGrey = bMask;
bool bSuccess = ImplCreateFromDrawable( bool bSuccess = ImplCreateFromDrawable(
pixmapHandle, pixmapHandle,
reinterpret_cast<void*>(nVisualPtr),
// FIXME: this seems multi-screen broken to me // FIXME: this seems multi-screen broken to me
SalX11Screen( 0 ), SalX11Screen( 0 ),
depth, depth,
...@@ -896,7 +892,6 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData ) ...@@ -896,7 +892,6 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData )
// prolly not a good idea, since it's accessed from // prolly not a good idea, since it's accessed from
// non-platform aware code in vcl/bitmap.hxx) // non-platform aware code in vcl/bitmap.hxx)
rData.aPixmap = (void*)mpDDB->ImplGetPixmap(); rData.aPixmap = (void*)mpDDB->ImplGetPixmap();
rData.aVisual = mpDDB->ImplGetVisual ();
rData.mnWidth = mpDDB->ImplGetWidth (); rData.mnWidth = mpDDB->ImplGetWidth ();
rData.mnHeight = mpDDB->ImplGetHeight (); rData.mnHeight = mpDDB->ImplGetHeight ();
return true; return true;
...@@ -912,7 +907,6 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData ) ...@@ -912,7 +907,6 @@ bool X11SalBitmap::GetSystemData( BitmapSystemData& rData )
ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable,
SalX11Screen nXScreen, const SalTwoRect& rTwoRect ) SalX11Screen nXScreen, const SalTwoRect& rTwoRect )
: maPixmap ( 0 ) : maPixmap ( 0 )
, mpVisual ( NULL )
, maTwoRect ( rTwoRect ) , maTwoRect ( rTwoRect )
, mnDepth ( pImage->depth ) , mnDepth ( pImage->depth )
, mnXScreen ( nXScreen ) , mnXScreen ( nXScreen )
...@@ -944,15 +938,13 @@ ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, ...@@ -944,15 +938,13 @@ ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable,
ImplSalDDB::ImplSalDDB( ImplSalDDB::ImplSalDDB(
Drawable aDrawable, Drawable aDrawable,
void *pVisual,
SalX11Screen nXScreen, SalX11Screen nXScreen,
long nDrawableDepth, long nDrawableDepth,
long nX, long nX,
long nY, long nY,
long nWidth, long nWidth,
long nHeight long nHeight
) : mpVisual ( pVisual ) ) : mnDepth( nDrawableDepth )
, mnDepth( nDrawableDepth )
, mnXScreen( nXScreen ) , mnXScreen( nXScreen )
{ {
SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay(); SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
......
...@@ -83,7 +83,7 @@ void X11SalGraphics::CopyScreenArea( Display* pDisplay, ...@@ -83,7 +83,7 @@ void X11SalGraphics::CopyScreenArea( Display* pDisplay,
else else
{ {
X11SalBitmap aBM; 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; SalTwoRect aTwoRect;
aTwoRect.mnSrcX = aTwoRect.mnSrcY = 0; aTwoRect.mnSrcX = aTwoRect.mnSrcY = 0;
aTwoRect.mnSrcWidth = aTwoRect.mnDestWidth = w; aTwoRect.mnSrcWidth = aTwoRect.mnDestWidth = w;
...@@ -887,7 +887,7 @@ SalBitmap *X11SalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) ...@@ -887,7 +887,7 @@ SalBitmap *X11SalGraphics::getBitmap( long nX, long nY, long nDX, long nDY )
nBitCount = 1; nBitCount = 1;
if( ! bFakeWindowBG ) if( ! bFakeWindowBG )
pSalBitmap->ImplCreateFromDrawable( GetDrawable(), NULL, m_nXScreen, nBitCount, nX, nY, nDX, nDY ); pSalBitmap->ImplCreateFromDrawable( GetDrawable(), m_nXScreen, nBitCount, nX, nY, nDX, nDY );
else else
pSalBitmap->Create( Size( nDX, nDY ), (nBitCount > 8) ? 24 : nBitCount, BitmapPalette( nBitCount > 8 ? nBitCount : 0 ) ); pSalBitmap->Create( Size( nDX, nDY ), (nBitCount > 8) ? 24 : nBitCount, BitmapPalette( nBitCount > 8 ? nBitCount : 0 ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment