LCOV - code coverage report
Current view: top level - gfx/thebes - gfxXlibNativeRenderer.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef GFXXLIBNATIVERENDER_H_
       7             : #define GFXXLIBNATIVERENDER_H_
       8             : 
       9             : #include "nsPoint.h"
      10             : #include "nsRect.h"
      11             : #include "mozilla/gfx/Rect.h"
      12             : #include "mozilla/gfx/Point.h"
      13             : #include <X11/Xlib.h>
      14             : 
      15             : namespace mozilla {
      16             : namespace gfx {
      17             :   class DrawTarget;
      18             : }
      19             : }
      20             : 
      21             : class gfxASurface;
      22             : class gfxContext;
      23             : typedef struct _cairo cairo_t;
      24             : typedef struct _cairo_surface cairo_surface_t;
      25             : 
      26             : /**
      27             :  * This class lets us take code that draws into an X drawable and lets us
      28             :  * use it to draw into any Thebes context. The user should subclass this class,
      29             :  * override DrawWithXib, and then call Draw(). The drawing will be subjected
      30             :  * to all Thebes transformations, clipping etc.
      31             :  */
      32           0 : class gfxXlibNativeRenderer {
      33             : public:
      34             :     /**
      35             :      * Perform the native drawing.
      36             :      * @param surface the cairo_surface_t for drawing. Must be a cairo_xlib_surface_t.
      37             :      *                The extents of this surface do not necessarily cover the
      38             :      *                entire rectangle with size provided to Draw().
      39             :      * @param offset  draw at this offset into the given drawable
      40             :      * @param clipRects an array of rectangles; clip to the union.
      41             :      *                  Any rectangles provided will be contained by the
      42             :      *                  rectangle with size provided to Draw and by the
      43             :      *                  surface extents.
      44             :      * @param numClipRects the number of rects in the array, or zero if
      45             :      *                     no clipping is required.
      46             :      */
      47             :     virtual nsresult DrawWithXlib(cairo_surface_t* surface,
      48             :                                   mozilla::gfx::IntPoint offset,
      49             :                                   mozilla::gfx::IntRect* clipRects,
      50             :                                   uint32_t numClipRects) = 0;
      51             :   
      52             :     enum {
      53             :         // If set, then Draw() is opaque, i.e., every pixel in the intersection
      54             :         // of the clipRect and (offset.x,offset.y,bounds.width,bounds.height)
      55             :         // will be set and there is no dependence on what the existing pixels
      56             :         // in the drawable are set to.
      57             :         DRAW_IS_OPAQUE = 0x01,
      58             :         // If set, then numClipRects can be zero or one
      59             :         DRAW_SUPPORTS_CLIP_RECT = 0x04,
      60             :         // If set, then numClipRects can be any value. If neither this
      61             :         // nor CLIP_RECT are set, then numClipRects will be zero
      62             :         DRAW_SUPPORTS_CLIP_LIST = 0x08,
      63             :         // If set, then the surface in the callback may have any visual;
      64             :         // otherwise the pixels will have the same format as the visual
      65             :         // passed to 'Draw'.
      66             :         DRAW_SUPPORTS_ALTERNATE_VISUAL = 0x10,
      67             :         // If set, then the Screen 'screen' in the callback can be different
      68             :         // from the default Screen of the display passed to 'Draw' and can be
      69             :         // on a different display.
      70             :         DRAW_SUPPORTS_ALTERNATE_SCREEN = 0x20
      71             :     };
      72             : 
      73             :     /**
      74             :      * @param flags see above
      75             :      * @param size the size of the rectangle being drawn;
      76             :      * the caller guarantees that drawing will not extend beyond the rectangle
      77             :      * (0,0,size.width,size.height).
      78             :      * @param screen a Screen to use for the drawing if ctx doesn't have one.
      79             :      * @param visual a Visual to use for the drawing if ctx doesn't have one.
      80             :      * @param result if non-null, we will try to capture a copy of the
      81             :      * rendered image into a surface similar to the surface of ctx; if
      82             :      * successful, a pointer to the new gfxASurface is stored in *resultSurface,
      83             :      * otherwise *resultSurface is set to nullptr.
      84             :      */
      85             :     void Draw(gfxContext* ctx, mozilla::gfx::IntSize size,
      86             :               uint32_t flags, Screen *screen, Visual *visual);
      87             : 
      88             : private:
      89             :     bool DrawDirect(mozilla::gfx::DrawTarget* aDT, mozilla::gfx::IntSize bounds,
      90             :                     uint32_t flags, Screen *screen, Visual *visual);
      91             : 
      92             :     bool DrawCairo(cairo_t* cr, mozilla::gfx::IntSize size,
      93             :                    uint32_t flags, Screen *screen, Visual *visual);
      94             : 
      95             :     void DrawFallback(mozilla::gfx::DrawTarget* dt, gfxContext* ctx,
      96             :                       gfxASurface* aSurface, mozilla::gfx::IntSize& size,
      97             :                       mozilla::gfx::IntRect& drawingRect, bool canDrawOverBackground,
      98             :                       uint32_t flags, Screen* screen, Visual* visual);
      99             : 
     100             :     bool DrawOntoTempSurface(cairo_surface_t *tempXlibSurface,
     101             :                              mozilla::gfx::IntPoint offset);
     102             : 
     103             : };
     104             : 
     105             : #endif /*GFXXLIBNATIVERENDER_H_*/

Generated by: LCOV version 1.13