LCOV - code coverage report
Current view: top level - libreoffice/vcl/unx/generic/gdi - gcach_xpeer.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 42 0.0 %
Date: 2012-12-27 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "rtl/ustring.hxx"
      22             : #include "osl/module.h"
      23             : #include "osl/thread.h"
      24             : 
      25             : #include "unx/saldisp.hxx"
      26             : #include "unx/saldata.hxx"
      27             : #include "unx/salgdi.h"
      28             : 
      29             : #include "gcach_xpeer.hxx"
      30             : #include "xrender_peer.hxx"
      31             : 
      32             : // ===========================================================================
      33             : 
      34           0 : X11GlyphPeer::X11GlyphPeer()
      35             : {
      36           0 : }
      37             : 
      38             : // ---------------------------------------------------------------------------
      39             : 
      40           0 : X11GlyphPeer::~X11GlyphPeer()
      41             : {
      42           0 :     if( !ImplGetSVData() )
      43             :         return;
      44             : 
      45             :     //Why do this here, move into dtor/shutdown of display?
      46           0 :     SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
      47           0 :     Display* const pX11Disp = pSalDisp->GetDisplay();
      48           0 :     int nMaxScreens = pSalDisp->GetXScreenCount();
      49           0 :     XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
      50             : 
      51           0 :     for( int i = 0; i < nMaxScreens; i++ )
      52             :     {
      53           0 :         SalDisplay::RenderEntryMap& rMap = pSalDisp->GetRenderEntries( SalX11Screen (i) );
      54           0 :         for( SalDisplay::RenderEntryMap::iterator it = rMap.begin(); it != rMap.end(); ++it )
      55             :         {
      56           0 :             if( it->second.m_aPixmap )
      57           0 :                 ::XFreePixmap( pX11Disp, it->second.m_aPixmap );
      58           0 :             if( it->second.m_aPicture )
      59           0 :                 rRenderPeer.FreePicture( it->second.m_aPicture );
      60             :         }
      61           0 :         rMap.clear();
      62             :     }
      63           0 : }
      64             : 
      65             : // ===========================================================================
      66             : 
      67           0 : X11GlyphCache::X11GlyphCache( X11GlyphPeer& rPeer )
      68           0 : :   GlyphCache( rPeer )
      69             : {
      70           0 : }
      71             : 
      72             : // ---------------------------------------------------------------------------
      73             : 
      74             : namespace
      75             : {
      76             :     struct GlyphCacheHolder
      77             :     {
      78             :     private:
      79             :         X11GlyphPeer* m_pX11GlyphPeer;
      80             :         X11GlyphCache* m_pX11GlyphCache;
      81             :     public:
      82           0 :         GlyphCacheHolder()
      83             :         {
      84           0 :             m_pX11GlyphPeer = new X11GlyphPeer();
      85           0 :             m_pX11GlyphCache = new X11GlyphCache( *m_pX11GlyphPeer );
      86           0 :         }
      87           0 :         void release()
      88             :         {
      89           0 :             delete m_pX11GlyphCache;
      90           0 :             delete m_pX11GlyphPeer;
      91           0 :             m_pX11GlyphCache = NULL;
      92           0 :             m_pX11GlyphPeer = NULL;
      93           0 :         }
      94           0 :         X11GlyphCache& getGlyphCache()
      95             :         {
      96           0 :             return *m_pX11GlyphCache;
      97             :         }
      98           0 :         ~GlyphCacheHolder()
      99             :         {
     100           0 :             release();
     101           0 :         }
     102             :     };
     103             : 
     104             :     struct theGlyphCacheHolder :
     105             :         public rtl::Static<GlyphCacheHolder, theGlyphCacheHolder>
     106             :     {};
     107             : }
     108             : 
     109           0 : X11GlyphCache& X11GlyphCache::GetInstance()
     110             : {
     111           0 :     return theGlyphCacheHolder::get().getGlyphCache();
     112             : }
     113             : 
     114             : // ---------------------------------------------------------------------------
     115             : 
     116           0 : void X11GlyphCache::KillInstance()
     117             : {
     118           0 :     return theGlyphCacheHolder::get().release();
     119             : }
     120             : 
     121             : // ===========================================================================
     122             : 
     123           0 : void X11SalGraphics::releaseGlyphPeer()
     124             : {
     125           0 :     X11GlyphCache::KillInstance();
     126           0 : }
     127             : 
     128             : // ===========================================================================
     129             : 
     130             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10