LCOV - code coverage report
Current view: directory - objdir/dist/include - gfxXlibNativeRenderer.h (source / functions) Found Hit Coverage
Test: app.info Lines: 1 0 0.0 %
Date: 2012-06-02 Functions: 1 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2                 :  * ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Novell code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is Novell.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2006
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   rocallahan@novell.com
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      26                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : #ifndef GFXXLIBNATIVERENDER_H_
      39                 : #define GFXXLIBNATIVERENDER_H_
      40                 : 
      41                 : #include "gfxColor.h"
      42                 : #include "nsAutoPtr.h"
      43                 : #include "nsRect.h"
      44                 : #include <X11/Xlib.h>
      45                 : 
      46                 : class gfxASurface;
      47                 : class gfxXlibSurface;
      48                 : class gfxContext;
      49                 : 
      50                 : /**
      51                 :  * This class lets us take code that draws into an X drawable and lets us
      52                 :  * use it to draw into any Thebes context. The user should subclass this class,
      53                 :  * override DrawWithXib, and then call Draw(). The drawing will be subjected
      54                 :  * to all Thebes transformations, clipping etc.
      55                 :  */
      56               0 : class THEBES_API gfxXlibNativeRenderer {
      57                 : public:
      58                 :     /**
      59                 :      * Perform the native drawing.
      60                 :      * @param surface the drawable for drawing.
      61                 :      *                The extents of this surface do not necessarily cover the
      62                 :      *                entire rectangle with size provided to Draw().
      63                 :      * @param offsetX draw at this offset into the given drawable
      64                 :      * @param offsetY draw at this offset into the given drawable
      65                 :      * @param clipRects an array of rectangles; clip to the union.
      66                 :      *                  Any rectangles provided will be contained by the
      67                 :      *                  rectangle with size provided to Draw and by the
      68                 :      *                  surface extents.
      69                 :      * @param numClipRects the number of rects in the array, or zero if
      70                 :      *                     no clipping is required.
      71                 :      */
      72                 :     virtual nsresult DrawWithXlib(gfxXlibSurface* surface,
      73                 :                                   nsIntPoint offset,
      74                 :                                   nsIntRect* clipRects, PRUint32 numClipRects) = 0;
      75                 :   
      76                 :     enum {
      77                 :         // If set, then Draw() is opaque, i.e., every pixel in the intersection
      78                 :         // of the clipRect and (offset.x,offset.y,bounds.width,bounds.height)
      79                 :         // will be set and there is no dependence on what the existing pixels
      80                 :         // in the drawable are set to.
      81                 :         DRAW_IS_OPAQUE = 0x01,
      82                 :         // If set, then numClipRects can be zero or one
      83                 :         DRAW_SUPPORTS_CLIP_RECT = 0x04,
      84                 :         // If set, then numClipRects can be any value. If neither this
      85                 :         // nor CLIP_RECT are set, then numClipRects will be zero
      86                 :         DRAW_SUPPORTS_CLIP_LIST = 0x08,
      87                 :         // If set, then the surface in the callback may have any visual;
      88                 :         // otherwise the pixels will have the same format as the visual
      89                 :         // passed to 'Draw'.
      90                 :         DRAW_SUPPORTS_ALTERNATE_VISUAL = 0x10,
      91                 :         // If set, then the Screen 'screen' in the callback can be different
      92                 :         // from the default Screen of the display passed to 'Draw' and can be
      93                 :         // on a different display.
      94                 :         DRAW_SUPPORTS_ALTERNATE_SCREEN = 0x20
      95                 :     };
      96                 : 
      97                 :     struct DrawOutput {
      98                 :         nsRefPtr<gfxASurface> mSurface;
      99                 :         bool mUniformAlpha;
     100                 :         bool mUniformColor;
     101                 :         gfxRGBA      mColor;
     102                 :     };
     103                 : 
     104                 :     /**
     105                 :      * @param flags see above
     106                 :      * @param size the size of the rectangle being drawn;
     107                 :      * the caller guarantees that drawing will not extend beyond the rectangle
     108                 :      * (0,0,size.width,size.height).
     109                 :      * @param screen a Screen to use for the drawing if ctx doesn't have one.
     110                 :      * @param visual a Visual to use for the drawing if ctx doesn't have one.
     111                 :      * @param result if non-null, we will try to capture a copy of the
     112                 :      * rendered image into a surface similar to the surface of ctx; if
     113                 :      * successful, a pointer to the new gfxASurface is stored in *resultSurface,
     114                 :      * otherwise *resultSurface is set to nsnull.
     115                 :      */
     116                 :     void Draw(gfxContext* ctx, nsIntSize size,
     117                 :               PRUint32 flags, Screen *screen, Visual *visual,
     118                 :               DrawOutput* result);
     119                 : 
     120                 : private:
     121                 :     bool DrawDirect(gfxContext *ctx, nsIntSize bounds,
     122                 :                       PRUint32 flags, Screen *screen, Visual *visual);
     123                 : 
     124                 :     bool DrawOntoTempSurface(gfxXlibSurface *tempXlibSurface,
     125                 :                                nsIntPoint offset);
     126                 : 
     127                 : };
     128                 : 
     129                 : #endif /*GFXXLIBNATIVERENDER_H_*/

Generated by: LCOV version 1.7