summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-08-19 23:37:37 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-08-19 23:37:37 +0000
commit80030dcfc802989023531203366bac1cd7ddbfa6 (patch)
tree774977f216a09028f07d8821ae2c6b26991b20a9
parent0e72d7f77372fec46814d2f52e36129d94b078a0 (diff)
INTEGRATION: CWS aw033 (1.3.38); FILE MERGED
2008/05/14 15:07:32 aw 1.3.38.9: RESYNC: (1.4-1.5); FILE MERGED 2007/12/13 16:44:20 aw 1.3.38.8: #i39532# AA work for unxlngi6 2007/12/12 15:33:24 hdu 1.3.38.7: #i75669# prepare use of xrender alpha color 2007/10/17 15:29:16 hdu 1.3.38.6: #i75669# simplify color handling for xrender targets 2007/05/23 22:17:36 aw 1.3.38.5: RESYNC: (1.3-1.4); FILE MERGED 2007/03/26 13:44:19 hdu 1.3.38.4: #i75669# use common 8bit-alpha render mask format 2007/03/23 09:29:46 hdu 1.3.38.3: #i75669# fix compilation when XRENDER_LINK is defined 2007/03/23 09:23:38 hdu 1.3.38.2: #i75669# prepare use of XRenderAddTraps 2007/03/23 08:53:05 hdu 1.3.38.1: #i75669# prepare use of XRenderCompositeTrapezoids
-rw-r--r--vcl/unx/source/gdi/xrender_peer.hxx103
1 files changed, 89 insertions, 14 deletions
diff --git a/vcl/unx/source/gdi/xrender_peer.hxx b/vcl/unx/source/gdi/xrender_peer.hxx
index 87cb11c9d9d8..6b5a7688575c 100644
--- a/vcl/unx/source/gdi/xrender_peer.hxx
+++ b/vcl/unx/source/gdi/xrender_peer.hxx
@@ -35,6 +35,7 @@
#include <X11/extensions/Xrender.h>
#include <postx.h>
+#include <vcl/salgtype.hxx>
#include <osl/module.h>
class XRenderPeer
@@ -51,19 +52,24 @@ protected:
void InitRenderLib();
Display* mpDisplay;
- XRenderPictFormat* mpGlyphFormat;
+ XRenderPictFormat* mpStandardFormatA8;
int mnRenderVersion;
oslModule mpRenderLib;
public:
+ XRenderPictFormat* GetStandardFormatA8() const;
+ XRenderPictFormat* FindStandardFormat(int nFormat) const;
+
+ // the methods below are thin wrappers for the XRENDER API
XRenderPictFormat* FindVisualFormat( Visual* ) const;
XRenderPictFormat* FindPictureFormat( unsigned long nMask,
const XRenderPictFormat& ) const;
- Picture CreatePicture( Drawable, XRenderPictFormat*,
- unsigned long, const XRenderPictureAttributes& ) const;
+ Picture CreatePicture( Drawable, const XRenderPictFormat*,
+ unsigned long nDrawable, const XRenderPictureAttributes& ) const;
void SetPictureClipRegion( Picture, XLIB_Region ) const;
- void CompositePicture( int,Picture,Picture,Picture,
- int,int,int,int,int,int,unsigned int,unsigned int) const;
+ void CompositePicture( int nOp, Picture aSrc, Picture aMask, Picture aDst,
+ int nXSrc, int nYSrc, int nXMask, int nYMask,
+ int nXDst, int nYDst, unsigned nWidth, unsigned nHeight ) const;
void FreePicture( Picture ) const;
GlyphSet CreateGlyphSet() const;
@@ -73,32 +79,48 @@ public:
void FreeGlyph( GlyphSet, Glyph nGlyphId ) const;
void CompositeString32( Picture aSrc, Picture aDst, GlyphSet,
int nDstX, int nDstY, const unsigned* pText, int nTextLen ) const;
- void FillRectangle( int, Picture, const XRenderColor*,
- int, int, unsigned int, unsigned int);
+ void FillRectangle( int nOp, Picture aDst, const XRenderColor*,
+ int nX, int nY, unsigned nW, unsigned nH ) const;
+ void CompositeTrapezoids( int nOp, Picture aSrc, Picture aDst,
+ const XRenderPictFormat*, int nXSrc, int nYSrc,
+ const XTrapezoid*, int nCount ) const;
+ bool AddTraps( Picture aDst, int nXOfs, int nYOfs,
+ const XTrap*, int nCount ) const;
+
+ bool AreTrapezoidsSupported() const
+#ifdef XRENDER_LINK
+ { return true; }
+#else
+ { return mpXRenderCompositeTrapezoids!=NULL; }
private:
XRenderPictFormat* (*mpXRenderFindFormat)(Display*,unsigned long,
const XRenderPictFormat*,int);
XRenderPictFormat* (*mpXRenderFindVisualFormat)(Display*,Visual*);
+ XRenderPictFormat* (*mpXRenderFindStandardFormat)(Display*,int);
Bool (*mpXRenderQueryExtension)(Display*,int*,int*);
void (*mpXRenderQueryVersion)(Display*,int*,int*);
- Picture (*mpXRenderCreatePicture)(Display*,Drawable,XRenderPictFormat*,
+ Picture (*mpXRenderCreatePicture)(Display*,Drawable, const XRenderPictFormat*,
unsigned long,const XRenderPictureAttributes*);
void (*mpXRenderSetPictureClipRegion)(Display*,Picture,XLIB_Region);
void (*mpXRenderFreePicture)(Display*,Picture);
void (*mpXRenderComposite)(Display*,int,Picture,Picture,Picture,
int,int,int,int,int,int,unsigned,unsigned);
- GlyphSet (*mpXRenderCreateGlyphSet)(Display*,XRenderPictFormat*);
+ GlyphSet (*mpXRenderCreateGlyphSet)(Display*, const XRenderPictFormat*);
void (*mpXRenderFreeGlyphSet)(Display*,GlyphSet);
void (*mpXRenderAddGlyphs)(Display*,GlyphSet,Glyph*,
const XGlyphInfo*,int,const char*,int);
void (*mpXRenderFreeGlyphs)(Display*,GlyphSet,Glyph*,int);
void (*mpXRenderCompositeString32)(Display*,int,Picture,Picture,
- XRenderPictFormat*,GlyphSet,int,int,int,int,const unsigned*,int);
+ const XRenderPictFormat*,GlyphSet,int,int,int,int,const unsigned*,int);
void (*mpXRenderFillRectangle)(Display*,int,Picture,
const XRenderColor*,int,int,unsigned int,unsigned int);
+ void (*mpXRenderCompositeTrapezoids)(Display*,int,Picture,Picture,
+ const XRenderPictFormat*,int,int,const XTrapezoid*,int);
+ void (*mpXRenderAddTraps)(Display*,Picture,int,int,const XTrap*,int);
+#endif // XRENDER_LINK
};
//=====================================================================
@@ -126,6 +148,20 @@ inline int XRenderPeer::GetVersion() const
return mnRenderVersion;
}
+inline XRenderPictFormat* XRenderPeer::GetStandardFormatA8() const
+{
+ return mpStandardFormatA8;
+}
+
+inline XRenderPictFormat* XRenderPeer::FindStandardFormat(int nFormat) const
+{
+#ifdef XRENDER_LINK
+ return XRenderFindStandardFormat(mpDisplay, nFormat);
+#else
+ return (*mpXRenderFindStandardFormat)(mpDisplay, nFormat);
+#endif
+}
+
inline XRenderPictFormat* XRenderPeer::FindVisualFormat( Visual* pVisual ) const
{
#ifdef XRENDER_LINK
@@ -146,7 +182,7 @@ inline XRenderPictFormat* XRenderPeer::FindPictureFormat( unsigned long nFormatM
}
inline Picture XRenderPeer::CreatePicture( Drawable aDrawable,
- XRenderPictFormat* pVisFormat, unsigned long nValueMask,
+ const XRenderPictFormat* pVisFormat, unsigned long nValueMask,
const XRenderPictureAttributes& rRenderAttr ) const
{
#ifdef XRENDER_LINK
@@ -194,9 +230,9 @@ inline void XRenderPeer::FreePicture( Picture aPicture ) const
inline GlyphSet XRenderPeer::CreateGlyphSet() const
{
#ifdef XRENDER_LINK
- return XRenderCreateGlyphSet( mpDisplay, mpGlyphFormat );
+ return XRenderCreateGlyphSet( mpDisplay, mpStandardFormatA8 );
#else
- return (*mpXRenderCreateGlyphSet)( mpDisplay, mpGlyphFormat );
+ return (*mpXRenderCreateGlyphSet)( mpDisplay, mpStandardFormatA8 );
#endif
}
@@ -255,7 +291,7 @@ inline void XRenderPeer::CompositeString32( Picture aSrc, Picture aDst,
}
inline void XRenderPeer::FillRectangle( int a, Picture b, const XRenderColor* c,
- int d, int e, unsigned int f, unsigned int g)
+ int d, int e, unsigned int f, unsigned int g) const
{
#ifdef XRENDER_LINK
XRenderFillRectangle( mpDisplay, a, b, c, d, e, f, g );
@@ -264,6 +300,33 @@ inline void XRenderPeer::FillRectangle( int a, Picture b, const XRenderColor* c,
#endif
}
+
+inline void XRenderPeer::CompositeTrapezoids( int nOp,
+ Picture aSrc, Picture aDst, const XRenderPictFormat* pXRPF,
+ int nXSrc, int nYSrc, const XTrapezoid* pXT, int nCount ) const
+{
+#ifdef XRENDER_LINK
+ XRenderCompositeTrapezoids( mpDisplay, nOp, aSrc, aDst, pXRPF,
+ nXSrc, nYSrc, pXT, nCount );
+#else
+ (*mpXRenderCompositeTrapezoids)( mpDisplay, nOp, aSrc, aDst, pXRPF,
+ nXSrc, nYSrc, pXT, nCount );
+#endif
+}
+
+inline bool XRenderPeer::AddTraps( Picture aDst, int nXOfs, int nYOfs,
+ const XTrap* pTraps, int nCount ) const
+{
+#ifdef XRENDER_LINK
+ XRenderAddTraps( mpDisplay, aDst, nXOfs, nYOfs, pTraps, nCount );
+#else
+ if( !mpXRenderAddTraps )
+ return false;
+ (*mpXRenderAddTraps)( mpDisplay, aDst, nXOfs, nYOfs, pTraps, nCount );
+#endif
+ return true;
+}
+
//=====================================================================
inline ScopedPic::ScopedPic( XRenderPeer& rPeer, Picture& rPic )
@@ -284,4 +347,16 @@ inline Picture& ScopedPic::Get()
//=====================================================================
+inline XRenderColor GetXRenderColor( const SalColor& rSalColor, double fTransparency = 0.0 )
+{
+ XRenderColor aRetVal;
+ aRetVal.red = SALCOLOR_RED( rSalColor ); aRetVal.red |= (aRetVal.red << 8);
+ aRetVal.green = SALCOLOR_GREEN( rSalColor ); aRetVal.green |= (aRetVal.green << 8);
+ aRetVal.blue = SALCOLOR_BLUE( rSalColor ); aRetVal.blue |= (aRetVal.blue << 8);
+ aRetVal.alpha = static_cast< unsigned short >((1.0 - fTransparency) * double(0xffff));
+ return aRetVal;
+}
+
+//=====================================================================
+
#endif // _SV_XRENDER_PEER_HXX