[Libreoffice-commits] .: vcl/unx

Joseph Powers jpowers at kemper.freedesktop.org
Sat Feb 19 11:10:50 PST 2011


 vcl/unx/inc/saldisp.hxx        |   32 ++++++++--------
 vcl/unx/source/gdi/salgdi3.cxx |   78 ++++++++++++++++++-----------------------
 2 files changed, 52 insertions(+), 58 deletions(-)

New commits:
commit c6bc0ec7f2d4f12b6657ee5edb1061da2e5df7b2
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sat Feb 19 11:10:30 2011 -0800

    Remove DECLARE_LIST( SalFontCache, ExtendedFontStruct* )

diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx
index 831f5bc..92344d8 100644
--- a/vcl/unx/inc/saldisp.hxx
+++ b/vcl/unx/inc/saldisp.hxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -146,7 +146,7 @@ public:
     inline	int				GetClass() const { return c_class; }
     inline	int				GetDepth() const { return depth; }
     inline  SalRGB			GetMode() const { return eRGBMode_; }
-    
+
             Pixel			GetTCPixel( SalColor nColor ) const;
             SalColor		GetTCColor( Pixel nPixel ) const;
             BOOL			Convert( int &n0, int &n1, int &n2, int &n3 ); // 32bit
@@ -219,7 +219,7 @@ protected:
     fd_set	        aExceptionFDS_;
     YieldEntry		*pYieldEntries_;
 
-    
+
     struct XErrorStackEntry
     {
         bool            m_bIgnore;
@@ -252,11 +252,11 @@ public:
     void PopXErrorLevel();
 
     virtual void			StartTimer( ULONG nMS );
-    virtual void			StopTimer();    
+    virtual void			StopTimer();
 
     bool            CheckTimeout( bool bExecuteTimers = true );
 
-    void			setHaveSystemChildFrame() 
+    void			setHaveSystemChildFrame()
     { m_bHaveSystemChildFrames = true; }
     bool            getHaveSystemChildFrame() const
     { return m_bHaveSystemChildFrames; }
@@ -273,7 +273,7 @@ class AttributeProvider;
 class SalUnicodeConverter;
 class SalConverterCache;
 
-DECLARE_LIST( SalFontCache, ExtendedFontStruct* )
+typedef ::std::vector< ExtendedFontStruct* > SalFontCache;
 
 extern "C" {
     struct SnDisplay;
@@ -333,14 +333,14 @@ public:
         void*			m_pData;
         USHORT			m_nEvent;
 
-        SalUserEvent( SalFrame* pFrame, void* pData, USHORT nEvent = SALEVENT_USEREVENT ) 
+        SalUserEvent( SalFrame* pFrame, void* pData, USHORT nEvent = SALEVENT_USEREVENT )
                 : m_pFrame( pFrame ),
                   m_pData( pData ),
                   m_nEvent( nEvent )
         {}
     };
 
-protected:	
+protected:
     SalXLib		   *pXLib_;
     SalI18N_InputMethod			*mpInputMethod;
     SalI18N_KeyboardExtension	*mpKbdExtension;
@@ -360,7 +360,7 @@ protected:
     srv_vendor_t	meServerVendor;
     SalWM			eWindowManager_;
     ULONG			nProperties_;		// PROPERTY_SUPPORT, BUG, FEATURE
-    BOOL			bLocal_;			// Server==Client? Init 
+    BOOL			bLocal_;			// Server==Client? Init
     // in SalDisplay::IsLocal()
     BOOL			mbLocalIsValid;		// bLocal_ is valid ?
     // until x bytes
@@ -390,9 +390,9 @@ protected:
     std::vector< int > m_aXineramaScreenIndexMap;
     std::list<SalFrame*> m_aFrames;
     std::list<SalObject*> m_aSalObjects;
-    
+
     bool            m_bUseRandRWrapper; // don't use randr on gtk, use gdk signals there
-    
+
     mutable XLIB_Time  m_nLastUserEventTime; // mutable because changed on first access
 
     void			DestroyFontCache();
@@ -417,7 +417,7 @@ public:
 
     virtual void			registerFrame( SalFrame* pFrame );
     virtual void			deregisterFrame( SalFrame* pFrame );
-    void					setHaveSystemChildFrame() const 
+    void					setHaveSystemChildFrame() const
     { pXLib_->setHaveSystemChildFrame(); }
     bool                    getHaveSystemChildFrame() const
     { return pXLib_->getHaveSystemChildFrame(); }
@@ -434,7 +434,7 @@ public:
 
     XlfdStorage* 	GetXlfdList() const;
     ExtendedFontStruct*
-    GetFont( const ExtendedXlfd *pFont, 
+    GetFont( const ExtendedXlfd *pFont,
              const Size& rPixelSize, sal_Bool bVertical ) const;
     const ExtendedXlfd*
     GetFallbackFactory()
@@ -496,7 +496,7 @@ public:
     ULONG			GetProperties() const { return nProperties_; }
     ULONG			GetMaxRequestSize() const { return nMaxRequestSize_; }
     XLIB_Time       GetLastUserEventTime( bool bAlwaysReget = false ) const;
-    
+
     bool            XIfEventWithTimeout( XEvent*, XPointer, X_if_predicate, long i_nTimeout = 1000 ) const;
 
     BOOL			MouseCaptured( const SalFrame *pFrameData ) const
@@ -507,10 +507,10 @@ public:
 
     SalI18N_InputMethod*			GetInputMethod()  const { return mpInputMethod;  }
     SalI18N_KeyboardExtension* 	GetKbdExtension() const { return mpKbdExtension; }
-    void 			SetInputMethod( SalI18N_InputMethod *pInputMethod ) 
+    void 			SetInputMethod( SalI18N_InputMethod *pInputMethod )
     { mpInputMethod = pInputMethod; }
     void			SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension)
-    { mpKbdExtension = pKbdExtension; } 
+    { mpKbdExtension = pKbdExtension; }
     const char*	GetKeyboardName( bool bRefresh = false );
     ::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor; }
     DtIntegrator* getDtIntegrator() const { return m_pDtIntegrator; }
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 7ddc565..122d6c2 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -420,21 +420,20 @@ SalDisplay::GetFont( const ExtendedXlfd *pRequestedFont,
     // TODO: either get rid of X11 fonts or get rid of the non-hashmapped cache
     if( !m_pFontCache )
     {
-        m_pFontCache = new SalFontCache( 64, 64, 16 ); // ???
+        m_pFontCache = new SalFontCache();
     }
     else
     {
         ExtendedFontStruct *pItem;
-        for ( pItem  = m_pFontCache->First();
-              pItem != NULL;
-              pItem  = m_pFontCache->Next() )
+        for ( size_t i = 0, n = m_pFontCache->size(); i < n; ++i )
         {
+            pItem = (*m_pFontCache)[ i ];
             if ( pItem->Match(pRequestedFont, rPixelSize, bVertical) )
             {
-                if( m_pFontCache->GetCurPos() )
+                if( i > 0 )
                 {
-                    m_pFontCache->Remove( pItem );
-                    m_pFontCache->Insert( pItem, 0UL );
+                    m_pFontCache->erase( m_pFontCache->begin() + i );
+                    m_pFontCache->insert( m_pFontCache->begin(), pItem );
                 }
                 return pItem;
             }
@@ -442,18 +441,17 @@ SalDisplay::GetFont( const ExtendedXlfd *pRequestedFont,
     }
 
     // before we expand the cache, we look for very old and unused items
-    if( m_pFontCache->Count() >= 64 )
+    if( m_pFontCache->size() >= 64 )
     {
         ExtendedFontStruct *pItem;
-        for ( pItem = m_pFontCache->Last();
-              pItem != NULL;
-              pItem = m_pFontCache->Prev() )
+        for ( size_t i = m_pFontCache->size(); i > 0; )
         {
+            pItem  = (*m_pFontCache)[ --i ];
             if( 1 == pItem->GetRefCount() )
             {
-                m_pFontCache->Remove( pItem );
+                m_pFontCache->erase( m_pFontCache->begin() + i );
                 pItem->ReleaseRef();
-                if( m_pFontCache->Count() < 64 )
+                if( m_pFontCache->size() < 64 )
                     break;
             }
         }
@@ -462,7 +460,7 @@ SalDisplay::GetFont( const ExtendedXlfd *pRequestedFont,
     ExtendedFontStruct *pItem = new ExtendedFontStruct( GetDisplay(),
                                         rPixelSize, bVertical,
                                         const_cast<ExtendedXlfd*>(pRequestedFont) );
-    m_pFontCache->Insert( pItem, 0UL );
+    m_pFontCache->insert( m_pFontCache->begin(), pItem );
     pItem->AddRef();
 
     return pItem;
@@ -475,13 +473,9 @@ SalDisplay::DestroyFontCache()
 {
     if( m_pFontCache )
     {
-        ExtendedFontStruct *pItem = m_pFontCache->First();
-        while( pItem )
-        {
-            delete pItem;
-            pItem = m_pFontCache->Next();
+        for ( size_t i = 0, n = m_pFontCache->size(); i < n; ++i ) {
+            delete (*m_pFontCache)[ i ];
         }
-        delete m_pFontCache;
     }
     if( mpFontList )
     {
@@ -603,7 +597,7 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
     {
         const ImplX11FontData* pRequestedFont = static_cast<const ImplX11FontData*>( pEntry->mpFontData );
         const ExtendedXlfd& rX11Font = pRequestedFont->GetExtendedXlfd();
-    
+
         Size aReqSize( pEntry->mnWidth, pEntry->mnHeight );
         mXFont[ nFallbackLevel ] = GetDisplay()->GetFont( &rX11Font, aReqSize, bFontVertical_ );
         bFontGC_ = FALSE;
@@ -624,7 +618,7 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
         // register to use the font
         mpServerFont[ nFallbackLevel ] = pServerFont;
 
-        // apply font specific-hint settings if needed 
+        // apply font specific-hint settings if needed
         // TODO: also disable it for reference devices
     if( !bPrinter_ )
     {
@@ -741,7 +735,7 @@ class CairoWrapper
 {
 private:
     oslModule mpCairoLib;
-    
+
     cairo_surface_t* (*mp_xlib_surface_create_with_xrender_format)(Display *, Drawable , Screen *, XRenderPictFormat *, int , int );
     void (*mp_surface_destroy)(cairo_surface_t *);
     cairo_t* (*mp_create)(cairo_surface_t *);
@@ -774,7 +768,7 @@ public:
     cairo_t* create(cairo_surface_t *surface) { return (*mp_create)(surface); }
     void destroy(cairo_t *cr) { (*mp_destroy)(cr); }
     void clip(cairo_t *cr) { (*mp_clip)(cr); }
-    void rectangle(cairo_t *cr, double x, double y, double width, double height) 
+    void rectangle(cairo_t *cr, double x, double y, double width, double height)
         { (*mp_rectangle)(cr, x, y, width, height); }
     cairo_font_face_t* ft_font_face_create_for_ft_face(FT_Face face, int load_flags)
         { return (*mp_ft_font_face_create_for_ft_face)(face, load_flags); }
@@ -815,7 +809,7 @@ CairoWrapper::CairoWrapper()
     static const char* pDisableCairoText = getenv( "SAL_DISABLE_CAIROTEXT" );
     if( pDisableCairoText && (pDisableCairoText[0] != '0') )
         return;
-    
+
     int nDummy;
     if( !XQueryExtension( GetX11SalData()->GetDisplay()->GetDisplay(), "RENDER", &nDummy, &nDummy, &nDummy ) )
         return;
@@ -824,7 +818,7 @@ CairoWrapper::CairoWrapper()
     OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libcairo.2.dylib" ));
 #else
     OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libcairo.so.2" ));
-#endif    
+#endif
     mpCairoLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT );
     if( !mpCairoLib )
         return;
@@ -837,11 +831,11 @@ CairoWrapper::CairoWrapper()
     fprintf( stderr, "CAIRO version=%d\n", nVersion );
 #endif
 
-    mp_xlib_surface_create_with_xrender_format = (cairo_surface_t* (*)(Display *, Drawable , Screen *, XRenderPictFormat *, int , int )) 
+    mp_xlib_surface_create_with_xrender_format = (cairo_surface_t* (*)(Display *, Drawable , Screen *, XRenderPictFormat *, int , int ))
         osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_xlib_surface_create_with_xrender_format" );
-    mp_surface_destroy = (void(*)(cairo_surface_t*)) 
+    mp_surface_destroy = (void(*)(cairo_surface_t*))
         osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_surface_destroy" );
-    mp_create = (cairo_t*(*)(cairo_surface_t*)) 
+    mp_create = (cairo_t*(*)(cairo_surface_t*))
         osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_create" );
     mp_destroy = (void(*)(cairo_t*))
         osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_destroy" );
@@ -872,7 +866,7 @@ CairoWrapper::CairoWrapper()
     mp_ft_font_options_substitute = (void (*)(const void *, void *))
         osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_options_substitute" );
 
-    if( !( 
+    if( !(
             mp_xlib_surface_create_with_xrender_format &&
             mp_surface_destroy &&
             mp_create &&
@@ -952,7 +946,7 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
 {
     std::vector<cairo_glyph_t> cairo_glyphs;
     cairo_glyphs.reserve( 256 );
-    
+
     Point aPos;
     sal_GlyphId aGlyphId;
     for( int nStart = 0; rLayout.GetNextGlyphs( 1, &aGlyphId, aPos, nStart ); )
@@ -996,8 +990,8 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
     {
     for (long i = 0; i < pClipRegion_->numRects; ++i)
     {
-            rCairo.rectangle(cr, 
-                pClipRegion_->rects[i].x1, 
+            rCairo.rectangle(cr,
+                pClipRegion_->rects[i].x1,
                 pClipRegion_->rects[i].y1,
                 pClipRegion_->rects[i].x2 - pClipRegion_->rects[i].x1,
                 pClipRegion_->rects[i].y2 - pClipRegion_->rects[i].y1);
@@ -1005,8 +999,8 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
         rCairo.clip(cr);
     }
 
-    rCairo.set_source_rgb(cr, 
-        SALCOLOR_RED(nTextColor_)/255.0, 
+    rCairo.set_source_rgb(cr,
+        SALCOLOR_RED(nTextColor_)/255.0,
         SALCOLOR_GREEN(nTextColor_)/255.0,
         SALCOLOR_BLUE(nTextColor_)/255.0);
 
@@ -1082,7 +1076,7 @@ void X11SalGraphics::DrawServerAAFontString( const ServerFontLayout& rLayout )
     // set font foreground color and opacity
     XRenderColor aRenderColor = GetXRenderColor( nTextColor_ );
     rRenderPeer.FillRectangle( PictOpSrc, rEntry.m_aPicture, &aRenderColor, 0, 0, 1, 1 );
-    
+
     // set clipping
     // TODO: move into GetXRenderPicture()?
     if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
@@ -1447,7 +1441,7 @@ void X11SalGraphics::DrawStringUCS2MB( ExtendedFontStruct& rFont,
         int nItem = 0;
 
         DBG_ASSERT( nLength<=1, "#i49902# DrawStringUCS2MB with nLength>1 => problems with XOrg6.8.[0123]");
-    
+
         for( int nChar = 0; nChar < nLength; ++nChar )
         {
             rtl_TextEncoding  nEnc;
@@ -1612,7 +1606,7 @@ void X11SalGraphics::GetDevFontList( ImplDevFontList *pList )
     // register platform specific font substitutions if available
     if( rMgr.hasFontconfig() )
         RegisterFontSubstitutors( pList );
-    
+
     ImplGetSVData()->maGDIData.mbNativeFontConfig = rMgr.hasFontconfig();
 }
 
@@ -1863,7 +1857,7 @@ SystemFontData X11SalGraphics::GetSysFontData( int nFallbacklevel ) const
 
     if (nFallbacklevel >= MAX_FALLBACK) nFallbacklevel = MAX_FALLBACK - 1;
     if (nFallbacklevel < 0 ) nFallbacklevel = 0;
-    
+
     if (mpServerFont[nFallbacklevel] != NULL)
     {
         ServerFont* rFont = mpServerFont[nFallbacklevel];
@@ -1874,7 +1868,7 @@ SystemFontData X11SalGraphics::GetSysFontData( int nFallbacklevel ) const
         aSysFontData.bAntialias = rFont->GetAntialiasAdvice();
         aSysFontData.bVerticalCharacterType = rFont->GetFontSelData().mbVertical;
     }
-            
+
     return aSysFontData;
 }
 
@@ -2002,7 +1996,7 @@ void RegisterFontSubstitutors( ImplDevFontList* pList )
     if( pEnvStr )
     {
         if( (*pEnvStr >= '0') && (*pEnvStr <= '9') )
-            nDisableBits = (*pEnvStr - '0'); 
+            nDisableBits = (*pEnvStr - '0');
         else
             nDisableBits = ~0U; // no specific bits set: disable all
     }


More information about the Libreoffice-commits mailing list