LCOV - code coverage report
Current view: directory - gfx/thebes - gfxGdkNativeRenderer.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 26 0 0.0 %
Date: 2012-06-02 Functions: 2 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                 :  *   Karl Tomlinson <karlt+@karlt.net>, Mozilla Corporation
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      27                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #include "gfxGdkNativeRenderer.h"
      40                 : #include "gfxContext.h"
      41                 : #include "gfxPlatformGtk.h"
      42                 : 
      43                 : #ifdef MOZ_X11
      44                 : #include <gdk/gdkx.h>
      45                 : #include "cairo-xlib.h"
      46                 : #include "gfxXlibSurface.h"
      47                 : nsresult
      48               0 : gfxGdkNativeRenderer::DrawWithXlib(gfxXlibSurface* surface,
      49                 :                                    nsIntPoint offset,
      50                 :                                    nsIntRect* clipRects, PRUint32 numClipRects)
      51                 : {
      52               0 :     GdkDrawable *drawable = gfxPlatformGtk::GetGdkDrawable(surface);
      53               0 :     if (!drawable) {
      54               0 :         gfxIntSize size = surface->GetSize();
      55               0 :         int depth = cairo_xlib_surface_get_depth(surface->CairoSurface());
      56               0 :         GdkScreen* screen = gdk_colormap_get_screen(mColormap);
      57                 :         drawable =
      58               0 :             gdk_pixmap_foreign_new_for_screen(screen, surface->XDrawable(),
      59               0 :                                               size.width, size.height, depth);
      60               0 :         if (!drawable)
      61               0 :             return NS_ERROR_FAILURE;
      62                 : 
      63               0 :         gdk_drawable_set_colormap(drawable, mColormap);
      64               0 :         gfxPlatformGtk::SetGdkDrawable(surface, drawable);
      65               0 :         g_object_unref(drawable); // The drawable now belongs to |surface|.
      66                 :     }
      67                 :     
      68                 :     GdkRectangle clipRect;
      69               0 :     if (numClipRects) {
      70               0 :         NS_ASSERTION(numClipRects == 1, "Too many clip rects");
      71               0 :         clipRect.x = clipRects[0].x;
      72               0 :         clipRect.y = clipRects[0].y;
      73               0 :         clipRect.width = clipRects[0].width;
      74               0 :         clipRect.height = clipRects[0].height;
      75                 :     }
      76                 : 
      77                 :     return DrawWithGDK(drawable, offset.x, offset.y,
      78               0 :                        numClipRects ? &clipRect : NULL, numClipRects);
      79                 : }
      80                 : 
      81                 : void
      82               0 : gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
      83                 :                            PRUint32 flags, GdkColormap* colormap)
      84                 : {
      85               0 :     mColormap = colormap;
      86                 : 
      87                 :     Visual* visual =
      88               0 :         gdk_x11_visual_get_xvisual(gdk_colormap_get_visual(colormap));
      89                 :     Screen* screen =
      90               0 :         gdk_x11_screen_get_xscreen(gdk_colormap_get_screen(colormap));
      91                 : 
      92               0 :     gfxXlibNativeRenderer::Draw(ctx, size, flags, screen, visual, nsnull);
      93               0 : }
      94                 : 
      95                 : #endif

Generated by: LCOV version 1.7