gfx/thebes/gfxQtNativeRenderer.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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 GFXQTNATIVERENDER_H_
michael@0 7 #define GFXQTNATIVERENDER_H_
michael@0 8
michael@0 9 #include "gfxColor.h"
michael@0 10 #include "gfxContext.h"
michael@0 11 #include "gfxXlibSurface.h"
michael@0 12
michael@0 13 class QRect;
michael@0 14 struct nsIntRect;
michael@0 15
michael@0 16 /**
michael@0 17 * This class lets us take code that draws into an Xlib surface drawable and lets us
michael@0 18 * use it to draw into any Thebes context. The user should subclass this class,
michael@0 19 * override NativeDraw, and then call Draw(). The drawing will be subjected
michael@0 20 * to all Thebes transformations, clipping etc.
michael@0 21 */
michael@0 22 class gfxQtNativeRenderer {
michael@0 23 public:
michael@0 24 /**
michael@0 25 * Perform the native drawing.
michael@0 26 * @param offsetX draw at this offset into the given drawable
michael@0 27 * @param offsetY draw at this offset into the given drawable
michael@0 28 * @param clipRects an array of rects; clip to the union
michael@0 29 * @param numClipRects the number of rects in the array, or zero if
michael@0 30 * no clipping is required
michael@0 31 */
michael@0 32 virtual nsresult DrawWithXlib(cairo_surface_t* surface,
michael@0 33 nsIntPoint offset,
michael@0 34 nsIntRect* clipRects, uint32_t numClipRects) = 0;
michael@0 35
michael@0 36 enum {
michael@0 37 // If set, then Draw() is opaque, i.e., every pixel in the intersection
michael@0 38 // of the clipRect and (offset.x,offset.y,bounds.width,bounds.height)
michael@0 39 // will be set and there is no dependence on what the existing pixels
michael@0 40 // in the drawable are set to.
michael@0 41 DRAW_IS_OPAQUE = 0x01,
michael@0 42 // If set, then numClipRects can be zero or one
michael@0 43 DRAW_SUPPORTS_CLIP_RECT = 0x04,
michael@0 44 // If set, then numClipRects can be any value. If neither this
michael@0 45 // nor CLIP_RECT are set, then numClipRects will be zero
michael@0 46 DRAW_SUPPORTS_CLIP_LIST = 0x08,
michael@0 47 // If set, then the visual passed in can be any visual, otherwise the
michael@0 48 // visual passed in must be the default visual for dpy's default screen
michael@0 49 DRAW_SUPPORTS_ALTERNATE_VISUAL = 0x10,
michael@0 50 // If set, then the Screen 'screen' in the callback can be different
michael@0 51 // from the default Screen of the display passed to 'Draw' and can be
michael@0 52 // on a different display.
michael@0 53 DRAW_SUPPORTS_ALTERNATE_SCREEN = 0x20
michael@0 54 };
michael@0 55
michael@0 56 /**
michael@0 57 * @param flags see above
michael@0 58 * @param size Draw()'s drawing is guaranteed to be restricted to
michael@0 59 * the rectangle (offset.x,offset.y,size.width,size.height)
michael@0 60 * @param dpy a display to use for the drawing if ctx doesn't have one
michael@0 61 * @param resultSurface if non-null, we will try to capture a copy of the
michael@0 62 * rendered image into a surface similar to the surface of ctx; if
michael@0 63 * successful, a pointer to the new gfxASurface is stored in *resultSurface,
michael@0 64 * otherwise *resultSurface is set to nullptr.
michael@0 65 */
michael@0 66 nsresult Draw(gfxContext* ctx, nsIntSize size,
michael@0 67 uint32_t flags, Screen* screen, Visual* visual);
michael@0 68 };
michael@0 69
michael@0 70 #endif /*GFXQTNATIVERENDER_H_*/

mercurial