gfx/thebes/gfxGdkNativeRenderer.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef GFXGDKNATIVERENDER_H_
michael@0 7 #define GFXGDKNATIVERENDER_H_
michael@0 8
michael@0 9 #include <gdk/gdk.h>
michael@0 10 #include "nsSize.h"
michael@0 11 #ifdef MOZ_X11
michael@0 12 #include "gfxXlibNativeRenderer.h"
michael@0 13 #endif
michael@0 14
michael@0 15 class gfxContext;
michael@0 16
michael@0 17 /**
michael@0 18 * This class lets us take code that draws into an GDK drawable and lets us
michael@0 19 * use it to draw into any Thebes context. The user should subclass this class,
michael@0 20 * override DrawWithGDK, and then call Draw(). The drawing will be subjected
michael@0 21 * to all Thebes transformations, clipping etc.
michael@0 22 */
michael@0 23 class gfxGdkNativeRenderer
michael@0 24 #ifdef MOZ_X11
michael@0 25 : private gfxXlibNativeRenderer
michael@0 26 #endif
michael@0 27 {
michael@0 28 public:
michael@0 29 /**
michael@0 30 * Perform the native drawing.
michael@0 31 * @param offsetX draw at this offset into the given drawable
michael@0 32 * @param offsetY draw at this offset into the given drawable
michael@0 33 * @param clipRects an array of rects; clip to the union
michael@0 34 * @param numClipRects the number of rects in the array, or zero if
michael@0 35 * no clipping is required
michael@0 36 */
michael@0 37
michael@0 38 #if (MOZ_WIDGET_GTK == 2)
michael@0 39 virtual nsresult DrawWithGDK(GdkDrawable * drawable, gint offsetX,
michael@0 40 gint offsetY, GdkRectangle * clipRects, uint32_t numClipRects) = 0;
michael@0 41 #endif
michael@0 42
michael@0 43 enum {
michael@0 44 // If set, then Draw() is opaque, i.e., every pixel in the intersection
michael@0 45 // of the clipRect and (offset.x,offset.y,bounds.width,bounds.height)
michael@0 46 // will be set and there is no dependence on what the existing pixels
michael@0 47 // in the drawable are set to.
michael@0 48 DRAW_IS_OPAQUE =
michael@0 49 #ifdef MOZ_X11
michael@0 50 gfxXlibNativeRenderer::DRAW_IS_OPAQUE
michael@0 51 #else
michael@0 52 0x1
michael@0 53 #endif
michael@0 54 // If set, then numClipRects can be zero or one.
michael@0 55 // If not set, then numClipRects will be zero.
michael@0 56 , DRAW_SUPPORTS_CLIP_RECT =
michael@0 57 #ifdef MOZ_X11
michael@0 58 gfxXlibNativeRenderer::DRAW_SUPPORTS_CLIP_RECT
michael@0 59 #else
michael@0 60 0x2
michael@0 61 #endif
michael@0 62 };
michael@0 63
michael@0 64 /**
michael@0 65 * @param flags see above
michael@0 66 * @param bounds Draw()'s drawing is guaranteed to be restricted to
michael@0 67 * the rectangle (offset.x,offset.y,bounds.width,bounds.height)
michael@0 68 * @param dpy a display to use for the drawing if ctx doesn't have one
michael@0 69 */
michael@0 70 #if (MOZ_WIDGET_GTK == 2)
michael@0 71 void Draw(gfxContext* ctx, nsIntSize size,
michael@0 72 uint32_t flags, GdkColormap* colormap);
michael@0 73 #endif
michael@0 74
michael@0 75 private:
michael@0 76 #ifdef MOZ_X11
michael@0 77 // for gfxXlibNativeRenderer:
michael@0 78 virtual nsresult DrawWithXlib(cairo_surface_t* surface,
michael@0 79 nsIntPoint offset,
michael@0 80 nsIntRect* clipRects, uint32_t numClipRects) MOZ_OVERRIDE;
michael@0 81
michael@0 82 #if (MOZ_WIDGET_GTK == 2)
michael@0 83 GdkColormap *mColormap;
michael@0 84 #endif
michael@0 85 #endif
michael@0 86 };
michael@0 87
michael@0 88 #endif /*GFXGDKNATIVERENDER_H_*/

mercurial