LCOV - code coverage report
Current view: top level - vcl/unx/generic/gdi - cairo_xlib_cairo.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 8 62.5 %
Date: 2015-06-13 12:38:46 Functions: 4 7 57.1 %
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             : #ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_XLIB_CAIRO_HXX
      21             : #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_XLIB_CAIRO_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <sal/types.h>
      26             : 
      27             : #include <vcl/cairo.hxx>
      28             : 
      29             : struct BitmapSystemData;
      30             : struct SystemEnvData;
      31             : struct SystemGraphicsData;
      32             : 
      33             : namespace cairo {
      34             : 
      35             :     /// Holds all X11-output relevant data
      36             :     struct X11SysData
      37             :     {
      38             :         X11SysData();
      39             :         explicit X11SysData( const SystemGraphicsData& );
      40             :         explicit X11SysData( const SystemEnvData& );
      41             : 
      42             :         void*   pDisplay;       // the relevant display connection
      43             :         long    hDrawable;      // a drawable
      44             :         void*   pVisual;        // the visual in use
      45             :         int nScreen;        // the current screen of the drawable
      46             :         int     nDepth;         // depth of said visual
      47             :         long    aColormap;      // the colormap being used
      48             :         void*   pRenderFormat;  // render format for drawable
      49             :     };
      50             : 
      51             :     /// RAII wrapper for a pixmap
      52             :     struct X11Pixmap
      53             :     {
      54             :         void* mpDisplay;  // the relevant display connection
      55             :         long  mhDrawable; // a drawable
      56             : 
      57           2 :         X11Pixmap( long hDrawable, void* pDisplay ) :
      58             :             mpDisplay(pDisplay),
      59           2 :             mhDrawable(hDrawable)
      60           2 :         {}
      61             : 
      62             :         ~X11Pixmap();
      63             : 
      64             :         void clear() { mpDisplay=NULL; mhDrawable=0; }
      65             :     };
      66             : 
      67             :     typedef boost::shared_ptr<X11Pixmap>       X11PixmapSharedPtr;
      68             : 
      69          12 :     class X11Surface : public Surface
      70             :     {
      71             :         const X11SysData      maSysData;
      72             :         X11PixmapSharedPtr    mpPixmap;
      73             :         CairoSurfaceSharedPtr mpSurface;
      74             : 
      75             :         X11Surface( const X11SysData& rSysData, const X11PixmapSharedPtr& rPixmap, const CairoSurfaceSharedPtr& pSurface );
      76             : 
      77             :     public:
      78             :         /// takes over ownership of passed cairo_surface
      79             :         explicit X11Surface( const CairoSurfaceSharedPtr& pSurface );
      80             :         /// create surface on subarea of given drawable
      81             :         X11Surface( const X11SysData& rSysData, int x, int y, int width, int height );
      82             :         /// create surface for given bitmap data
      83             :         X11Surface( const X11SysData& rSysData, const BitmapSystemData& rBmpData );
      84             : 
      85             :         // Surface interface
      86             :         virtual CairoSharedPtr getCairo() const SAL_OVERRIDE;
      87           4 :         virtual CairoSurfaceSharedPtr getCairoSurface() const SAL_OVERRIDE { return mpSurface; }
      88             :         virtual SurfaceSharedPtr getSimilar(int cairo_content_type, int width, int height) const SAL_OVERRIDE;
      89             : 
      90             :         virtual VclPtr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;
      91             : 
      92             :         virtual bool Resize( int width, int height ) SAL_OVERRIDE;
      93             : 
      94             :         virtual void flush() const SAL_OVERRIDE;
      95             : 
      96             :         int getDepth() const;
      97           0 :         X11PixmapSharedPtr getPixmap() const { return mpPixmap; }
      98           0 :         void* getRenderFormat() const { return maSysData.pRenderFormat; }
      99           0 :         long getDrawable() const { return mpPixmap ? mpPixmap->mhDrawable : maSysData.hDrawable; }
     100             :     };
     101             : }
     102             : 
     103             : #endif
     104             : 
     105             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11