gfx/thebes/gfxQuartzSurface.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.

     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 GFX_QUARTZSURFACE_H
     7 #define GFX_QUARTZSURFACE_H
     9 #include "gfxASurface.h"
    10 #include "nsSize.h"
    11 #include "gfxPoint.h"
    13 #include <Carbon/Carbon.h>
    15 class gfxContext;
    16 class gfxImageSurface;
    18 class gfxQuartzSurface : public gfxASurface {
    19 public:
    20     gfxQuartzSurface(const gfxSize& size, gfxImageFormat format, bool aForPrinting = false);
    21     gfxQuartzSurface(CGContextRef context, const gfxSize& size, bool aForPrinting = false);
    22     gfxQuartzSurface(CGContextRef context, const gfxIntSize& size, bool aForPrinting = false);
    23     gfxQuartzSurface(cairo_surface_t *csurf, const gfxIntSize& aSize, bool aForPrinting = false);
    24     gfxQuartzSurface(unsigned char *data, const gfxSize& size, long stride, gfxImageFormat format, bool aForPrinting = false);
    25     gfxQuartzSurface(unsigned char *data, const gfxIntSize& size, long stride, gfxImageFormat format, bool aForPrinting = false);
    27     virtual ~gfxQuartzSurface();
    29     virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
    30                                                                const gfxIntSize& aSize);
    32     virtual const gfxIntSize GetSize() const { return gfxIntSize(mSize.width, mSize.height); }
    34     CGContextRef GetCGContext() { return mCGContext; }
    36     CGContextRef GetCGContextWithClip(gfxContext *ctx);
    38     virtual int32_t GetDefaultContextFlags() const;
    40     already_AddRefed<gfxImageSurface> GetAsImageSurface();
    42     void MovePixels(const nsIntRect& aSourceRect,
    43                     const nsIntPoint& aDestTopLeft)
    44     {
    45         FastMovePixels(aSourceRect, aDestTopLeft);
    46     }
    48 protected:
    49     void MakeInvalid();
    51     CGContextRef mCGContext;
    52     gfxSize      mSize;
    53     bool mForPrinting;
    54 };
    56 #endif /* GFX_QUARTZSURFACE_H */

mercurial