gfx/skia/trunk/include/utils/mac/SkCGUtils.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     2 /*
     3  * Copyright 2011 Google Inc.
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
     8 #ifndef SkCGUtils_DEFINED
     9 #define SkCGUtils_DEFINED
    11 #include "SkTypes.h"
    13 #ifdef SK_BUILD_FOR_MAC
    14 #include <ApplicationServices/ApplicationServices.h>
    15 #endif
    17 #ifdef SK_BUILD_FOR_IOS
    18 #include <CoreGraphics/CoreGraphics.h>
    19 #endif
    21 class SkBitmap;
    22 class SkData;
    23 class SkStream;
    25 /**
    26  *  Create an imageref from the specified bitmap using the specified colorspace.
    27  *  If space is NULL, then CGColorSpaceCreateDeviceRGB() is used.
    28  */
    29 SK_API CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
    30                                                    CGColorSpaceRef space);
    32 /**
    33  *  Create an imageref from the specified bitmap using the colorspace returned
    34  *  by CGColorSpaceCreateDeviceRGB()
    35  */
    36 static inline CGImageRef SkCreateCGImageRef(const SkBitmap& bm) {
    37     return SkCreateCGImageRefWithColorspace(bm, NULL);
    38 }
    40 /**
    41  *  Draw the bitmap into the specified CG context. The bitmap will be converted
    42  *  to a CGImage using the generic RGB colorspace. (x,y) specifies the position
    43  *  of the top-left corner of the bitmap. The bitmap is converted using the
    44  *  colorspace returned by CGColorSpaceCreateDeviceRGB()
    45  */
    46 void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y);
    48 bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output);
    50 /**
    51  *  Return a provider that wraps the specified stream. It will become an
    52  *  owner of the stream, so the caller must still manage its ownership.
    53  *
    54  *  To hand-off ownership of the stream to the provider, the caller must do
    55  *  something like the following:
    56  *
    57  *  SkStream* stream = new ...;
    58  *  CGDataProviderRef provider = SkStreamToDataProvider(stream);
    59  *  stream->unref();
    60  *
    61  *  Now when the provider is finally deleted, it will delete the stream.
    62  */
    63 CGDataProviderRef SkCreateDataProviderFromStream(SkStream*);
    65 CGDataProviderRef SkCreateDataProviderFromData(SkData*);
    67 #endif

mercurial