[Libreoffice-commits] .: 2 commits - vcl/inc vcl/unx
Lubos Lunak
llunak at kemper.freedesktop.org
Mon Jan 17 07:26:40 PST 2011
vcl/inc/vcl/sysdata.hxx | 2 -
vcl/unx/headless/svpgdi.cxx | 2 -
vcl/unx/headless/svppspgraphics.cxx | 2 -
vcl/unx/inc/salgdi.h | 8 +++---
vcl/unx/inc/salvd.h | 2 -
vcl/unx/source/gdi/pspgraphics.cxx | 2 -
vcl/unx/source/gdi/salgdi.cxx | 44 +++++++++++++++++-------------------
vcl/unx/source/gdi/salgdi3.cxx | 10 --------
vcl/unx/source/gdi/salvd.cxx | 14 +++++------
9 files changed, 38 insertions(+), 48 deletions(-)
New commits:
commit c8b124fe8675fef888f21f1abcf81cbc5c1f5801
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Mon Jan 17 16:24:49 2011 +0100
do not mix unrelated X11 Visuals (fdo#33108)
Do not assume that there is just one generic Visual, as today's
XServers are ARGB-capable and cases of both the default depth
and 32bit visuals can happen.
diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h
index 950b753..038e129 100644
--- a/vcl/unx/inc/salgdi.h
+++ b/vcl/unx/inc/salgdi.h
@@ -89,7 +89,7 @@ protected:
SalColormap *m_pDeleteColormap;
Drawable hDrawable_; // use
int m_nScreen;
- XRenderPictFormat* m_pXRenderFormat;
+ mutable XRenderPictFormat* m_pXRenderFormat;
XID m_aXRenderPicture;
CairoFontsCache m_aCairoFontsCache;
@@ -221,7 +221,7 @@ public:
inline Drawable GetDrawable() const { return hDrawable_; }
void SetDrawable( Drawable d, int nScreen );
XID GetXRenderPicture();
- XRenderPictFormat* GetXRenderFormat() const { return m_pXRenderFormat; }
+ XRenderPictFormat* GetXRenderFormat() const;
inline void SetXRenderFormat( XRenderPictFormat* pXRenderFormat ) { m_pXRenderFormat = pXRenderFormat; }
inline const SalColormap& GetColormap() const { return *m_pColormap; }
using SalGraphics::GetPixel;
diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx
index 4b4b528..369f401 100644
--- a/vcl/unx/source/gdi/salgdi.cxx
+++ b/vcl/unx/source/gdi/salgdi.cxx
@@ -1017,18 +1017,9 @@ XID X11SalGraphics::GetXRenderPicture()
if( !m_aXRenderPicture )
{
// check xrender support for matching visual
- // find a XRenderPictFormat compatible with the Drawable
XRenderPictFormat* pVisualFormat = GetXRenderFormat();
if( !pVisualFormat )
- {
- Visual* pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
- pVisualFormat = rRenderPeer.FindVisualFormat( pVisual );
- if( !pVisualFormat )
- return 0;
- // cache the XRenderPictFormat
- SetXRenderFormat( pVisualFormat );
- }
-
+ return 0;
// get the matching xrender target for drawable
m_aXRenderPicture = rRenderPeer.CreatePicture( hDrawable_, pVisualFormat, 0, NULL );
}
@@ -1044,6 +1035,13 @@ XID X11SalGraphics::GetXRenderPicture()
return m_aXRenderPicture;
}
+XRenderPictFormat* X11SalGraphics::GetXRenderFormat() const
+{
+ if( m_pXRenderFormat == NULL )
+ m_pXRenderFormat = XRenderPeer::GetInstance().FindVisualFormat( GetVisual().visual );
+ return m_pXRenderFormat;
+}
+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
SystemGraphicsData X11SalGraphics::GetGraphicsData() const
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index d6b2858..767c91d 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -986,14 +986,6 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
// find a XRenderPictFormat compatible with the Drawable
XRenderPictFormat* pVisualFormat = GetXRenderFormat();
- if( !pVisualFormat )
- {
- Visual* pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
- pVisualFormat = XRenderPeer::GetInstance().FindVisualFormat( pVisual );
- // cache the XRenderPictFormat
- SetXRenderFormat( pVisualFormat );
- }
-
DBG_ASSERT( pVisualFormat!=NULL, "no matching XRenderPictFormat for text" );
if( !pVisualFormat )
return;
commit adcf6494095e873d8c857457fda60d820b65a45b
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Mon Jan 17 16:06:05 2011 +0100
avoid some useless and confusing void* <-> XRenderPictFormat* casts
diff --git a/vcl/inc/vcl/sysdata.hxx b/vcl/inc/vcl/sysdata.hxx
index 1a8f56d..108371b 100644
--- a/vcl/inc/vcl/sysdata.hxx
+++ b/vcl/inc/vcl/sysdata.hxx
@@ -122,7 +122,7 @@ struct SystemGraphicsData
int nScreen; // the current screen of the drawable
int nDepth; // depth of said visual
long aColormap; // the colormap being used
- void* pRenderFormat; // render format for drawable
+ void* pXRenderFormat; // render format for drawable
#endif
};
diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx
index e079857..f1cf483 100644
--- a/vcl/unx/headless/svpgdi.cxx
+++ b/vcl/unx/headless/svpgdi.cxx
@@ -577,7 +577,7 @@ SystemGraphicsData SvpSalGraphics::GetGraphicsData() const
SystemGraphicsData aRes;
aRes.nSize = sizeof(aRes);
aRes.hDrawable = 0;
- aRes.pRenderFormat = 0;
+ aRes.pXRenderFormat = 0;
return aRes;
}
diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx
index 42f95f5..a7b3c11 100644
--- a/vcl/unx/headless/svppspgraphics.cxx
+++ b/vcl/unx/headless/svppspgraphics.cxx
@@ -1363,7 +1363,7 @@ SystemGraphicsData PspGraphics::GetGraphicsData() const
SystemGraphicsData aRes;
aRes.nSize = sizeof(aRes);
aRes.hDrawable = 0;
- aRes.pRenderFormat = 0;
+ aRes.pXRenderFormat = 0;
return aRes;
}
diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h
index ef7cf8c..950b753 100644
--- a/vcl/unx/inc/salgdi.h
+++ b/vcl/unx/inc/salgdi.h
@@ -89,8 +89,8 @@ protected:
SalColormap *m_pDeleteColormap;
Drawable hDrawable_; // use
int m_nScreen;
- void* m_pRenderFormat;
- XID m_aRenderPicture;
+ XRenderPictFormat* m_pXRenderFormat;
+ XID m_aXRenderPicture;
CairoFontsCache m_aCairoFontsCache;
XLIB_Region pPaintRegion_;
@@ -221,8 +221,8 @@ public:
inline Drawable GetDrawable() const { return hDrawable_; }
void SetDrawable( Drawable d, int nScreen );
XID GetXRenderPicture();
- void* GetXRenderFormat() const { return m_pRenderFormat; }
- inline void SetXRenderFormat( void* pRenderFormat ) { m_pRenderFormat = pRenderFormat; }
+ XRenderPictFormat* GetXRenderFormat() const { return m_pXRenderFormat; }
+ inline void SetXRenderFormat( XRenderPictFormat* pXRenderFormat ) { m_pXRenderFormat = pXRenderFormat; }
inline const SalColormap& GetColormap() const { return *m_pColormap; }
using SalGraphics::GetPixel;
inline Pixel GetPixel( SalColor nSalColor ) const;
diff --git a/vcl/unx/inc/salvd.h b/vcl/unx/inc/salvd.h
index 35ba9f9..81f1e80 100644
--- a/vcl/unx/inc/salvd.h
+++ b/vcl/unx/inc/salvd.h
@@ -62,7 +62,7 @@ public:
USHORT nBitCount,
int nScreen,
Pixmap hDrawable = None,
- void* pRenderFormat = NULL );
+ XRenderPictFormat* pXRenderFormat = NULL );
inline void InitGraphics( X11SalVirtualDevice *pVD );
inline Display *GetXDisplay() const;
diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx
index 29f7eba..c25e065 100644
--- a/vcl/unx/source/gdi/pspgraphics.cxx
+++ b/vcl/unx/source/gdi/pspgraphics.cxx
@@ -1472,7 +1472,7 @@ SystemGraphicsData PspGraphics::GetGraphicsData() const
SystemGraphicsData aRes;
aRes.nSize = sizeof(aRes);
aRes.hDrawable = 0;
- aRes.pRenderFormat = 0;
+ aRes.pXRenderFormat = 0;
return aRes;
}
diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx
index 9b4c20c..4b4b528 100644
--- a/vcl/unx/source/gdi/salgdi.cxx
+++ b/vcl/unx/source/gdi/salgdi.cxx
@@ -102,8 +102,8 @@ X11SalGraphics::X11SalGraphics()
m_pVDev = NULL;
m_pDeleteColormap = NULL;
hDrawable_ = None;
- m_aRenderPicture = 0;
- m_pRenderFormat = NULL;
+ m_aXRenderPicture = 0;
+ m_pXRenderFormat = NULL;
pClipRegion_ = NULL;
pPaintRegion_ = NULL;
@@ -187,8 +187,8 @@ void X11SalGraphics::freeResources()
if( m_pDeleteColormap )
delete m_pDeleteColormap, m_pColormap = m_pDeleteColormap = NULL;
- if( m_aRenderPicture )
- XRenderPeer::GetInstance().FreePicture( m_aRenderPicture ), m_aRenderPicture = 0;
+ if( m_aXRenderPicture )
+ XRenderPeer::GetInstance().FreePicture( m_aXRenderPicture ), m_aXRenderPicture = 0;
bPenGC_ = bFontGC_ = bBrushGC_ = bMonoGC_ = bCopyGC_ = bInvertGC_ = bInvert50GC_ = bStippleGC_ = bTrackingGC_ = false;
}
@@ -209,10 +209,10 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen )
hDrawable_ = aDrawable;
SetXRenderFormat( NULL );
- if( m_aRenderPicture )
+ if( m_aXRenderPicture )
{
- XRenderPeer::GetInstance().FreePicture( m_aRenderPicture );
- m_aRenderPicture = 0;
+ XRenderPeer::GetInstance().FreePicture( m_aXRenderPicture );
+ m_aXRenderPicture = 0;
}
if( hDrawable_ )
@@ -1014,11 +1014,11 @@ XID X11SalGraphics::GetXRenderPicture()
{
XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
- if( !m_aRenderPicture )
+ if( !m_aXRenderPicture )
{
// check xrender support for matching visual
// find a XRenderPictFormat compatible with the Drawable
- XRenderPictFormat* pVisualFormat = static_cast<XRenderPictFormat*>(GetXRenderFormat());
+ XRenderPictFormat* pVisualFormat = GetXRenderFormat();
if( !pVisualFormat )
{
Visual* pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
@@ -1026,11 +1026,11 @@ XID X11SalGraphics::GetXRenderPicture()
if( !pVisualFormat )
return 0;
// cache the XRenderPictFormat
- SetXRenderFormat( static_cast<void*>(pVisualFormat) );
+ SetXRenderFormat( pVisualFormat );
}
// get the matching xrender target for drawable
- m_aRenderPicture = rRenderPeer.CreatePicture( hDrawable_, pVisualFormat, 0, NULL );
+ m_aXRenderPicture = rRenderPeer.CreatePicture( hDrawable_, pVisualFormat, 0, NULL );
}
{
@@ -1038,10 +1038,10 @@ XID X11SalGraphics::GetXRenderPicture()
// TODO: avoid clip reset if already done
XRenderPictureAttributes aAttr;
aAttr.clip_mask = None;
- rRenderPeer.ChangePicture( m_aRenderPicture, CPClipMask, &aAttr );
+ rRenderPeer.ChangePicture( m_aXRenderPicture, CPClipMask, &aAttr );
}
- return m_aRenderPicture;
+ return m_aXRenderPicture;
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -1057,7 +1057,7 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const
aRes.nScreen = m_nScreen;
aRes.nDepth = GetDisplay()->GetVisual( m_nScreen ).GetDepth();
aRes.aColormap = GetDisplay()->GetColormap( m_nScreen ).GetXColormap();
- aRes.pRenderFormat = m_pRenderFormat;
+ aRes.pXRenderFormat = m_pXRenderFormat;
return aRes;
}
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 02d9491..d6b2858 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -985,13 +985,13 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
return;
// find a XRenderPictFormat compatible with the Drawable
- XRenderPictFormat* pVisualFormat = static_cast<XRenderPictFormat*>(GetXRenderFormat());
+ XRenderPictFormat* pVisualFormat = GetXRenderFormat();
if( !pVisualFormat )
{
Visual* pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
pVisualFormat = XRenderPeer::GetInstance().FindVisualFormat( pVisual );
// cache the XRenderPictFormat
- SetXRenderFormat( static_cast<void*>(pVisualFormat) );
+ SetXRenderFormat( pVisualFormat );
}
DBG_ASSERT( pVisualFormat!=NULL, "no matching XRenderPictFormat for text" );
diff --git a/vcl/unx/source/gdi/salvd.cxx b/vcl/unx/source/gdi/salvd.cxx
index ac1a03c..dc8b4b1 100644
--- a/vcl/unx/source/gdi/salvd.cxx
+++ b/vcl/unx/source/gdi/salvd.cxx
@@ -68,7 +68,8 @@ SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
}
nDX = (long)w;
nDY = (long)h;
- if( !pVDev->Init( GetX11SalData()->GetDisplay(), nDX, nDY, nBitCount, nScreen, pData->hDrawable, pData->pRenderFormat ) )
+ if( !pVDev->Init( GetX11SalData()->GetDisplay(), nDX, nDY, nBitCount, nScreen, pData->hDrawable,
+ static_cast< XRenderPictFormat* >( pData->pXRenderFormat )) )
{
delete pVDev;
return NULL;
@@ -136,7 +137,7 @@ BOOL X11SalVirtualDevice::Init( SalDisplay *pDisplay,
USHORT nBitCount,
int nScreen,
Pixmap hDrawable,
- void* pRenderFormatVoid )
+ XRenderPictFormat* pXRenderFormat )
{
SalColormap* pColormap = NULL;
bool bDeleteColormap = false;
@@ -144,11 +145,10 @@ BOOL X11SalVirtualDevice::Init( SalDisplay *pDisplay,
pDisplay_ = pDisplay;
pGraphics_ = new X11SalGraphics();
m_nScreen = nScreen;
- if( pRenderFormatVoid ) {
- XRenderPictFormat *pRenderFormat = ( XRenderPictFormat* )pRenderFormatVoid;
- pGraphics_->SetXRenderFormat( pRenderFormat );
- if( pRenderFormat->colormap )
- pColormap = new SalColormap( pDisplay, pRenderFormat->colormap, m_nScreen );
+ if( pXRenderFormat ) {
+ pGraphics_->SetXRenderFormat( pXRenderFormat );
+ if( pXRenderFormat->colormap )
+ pColormap = new SalColormap( pDisplay, pXRenderFormat->colormap, m_nScreen );
else
pColormap = new SalColormap( nBitCount );
bDeleteColormap = true;
More information about the Libreoffice-commits
mailing list