Bug 1492908 [wpt PR 13122] - Update wpt metadata, a=testonly
[gecko.git] / gfx / thebes / gfxGdkNativeRenderer.h
blob75e01b9f822b80fadf289587884016f98b28b7e0
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/. */
6 #ifndef GFXGDKNATIVERENDER_H_
7 #define GFXGDKNATIVERENDER_H_
9 #include <gdk/gdk.h>
10 #include "nsSize.h"
11 #ifdef MOZ_X11
12 #include "gfxXlibNativeRenderer.h"
13 #endif
15 class gfxContext;
17 /**
18 * This class lets us take code that draws into an GDK drawable and lets us
19 * use it to draw into any Thebes context. The user should subclass this class,
20 * override DrawWithGDK, and then call Draw(). The drawing will be subjected
21 * to all Thebes transformations, clipping etc.
23 class gfxGdkNativeRenderer
24 #ifdef MOZ_X11
25 : private gfxXlibNativeRenderer
26 #endif
28 public:
29 /**
30 * Perform the native drawing.
31 * @param offsetX draw at this offset into the given drawable
32 * @param offsetY draw at this offset into the given drawable
33 * @param clipRects an array of rects; clip to the union
34 * @param numClipRects the number of rects in the array, or zero if
35 * no clipping is required
38 enum {
39 // If set, then Draw() is opaque, i.e., every pixel in the intersection
40 // of the clipRect and (offset.x,offset.y,bounds.width,bounds.height)
41 // will be set and there is no dependence on what the existing pixels
42 // in the drawable are set to.
43 DRAW_IS_OPAQUE =
44 #ifdef MOZ_X11
45 gfxXlibNativeRenderer::DRAW_IS_OPAQUE
46 #else
47 0x1
48 #endif
49 // If set, then numClipRects can be zero or one.
50 // If not set, then numClipRects will be zero.
51 , DRAW_SUPPORTS_CLIP_RECT =
52 #ifdef MOZ_X11
53 gfxXlibNativeRenderer::DRAW_SUPPORTS_CLIP_RECT
54 #else
55 0x2
56 #endif
59 /**
60 * @param flags see above
61 * @param bounds Draw()'s drawing is guaranteed to be restricted to
62 * the rectangle (offset.x,offset.y,bounds.width,bounds.height)
63 * @param dpy a display to use for the drawing if ctx doesn't have one
66 private:
67 #ifdef MOZ_X11
68 // for gfxXlibNativeRenderer:
69 virtual nsresult DrawWithXlib(cairo_surface_t* surface,
70 nsIntPoint offset,
71 mozilla::gfx::IntRect* clipRects, uint32_t numClipRects) override;
73 #endif
76 #endif /*GFXGDKNATIVERENDER_H_*/