gfx/skia/trunk/include/gpu/SkGr.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 2010 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  */
    11 #ifndef SkGr_DEFINED
    12 #define SkGr_DEFINED
    14 #include <stddef.h>
    16 // Gr headers
    17 #include "GrTypes.h"
    18 #include "GrContext.h"
    19 #include "GrFontScaler.h"
    21 // skia headers
    22 #include "SkBitmap.h"
    23 #include "SkPath.h"
    24 #include "SkPoint.h"
    25 #include "SkRegion.h"
    26 #include "SkClipStack.h"
    28 ////////////////////////////////////////////////////////////////////////////////
    29 // Sk to Gr Type conversions
    31 GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff);
    32 GR_STATIC_ASSERT((int)kOne_GrBlendCoeff  == (int)SkXfermode::kOne_Coeff);
    33 GR_STATIC_ASSERT((int)kSC_GrBlendCoeff   == (int)SkXfermode::kSC_Coeff);
    34 GR_STATIC_ASSERT((int)kISC_GrBlendCoeff  == (int)SkXfermode::kISC_Coeff);
    35 GR_STATIC_ASSERT((int)kDC_GrBlendCoeff   == (int)SkXfermode::kDC_Coeff);
    36 GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff  == (int)SkXfermode::kIDC_Coeff);
    37 GR_STATIC_ASSERT((int)kSA_GrBlendCoeff   == (int)SkXfermode::kSA_Coeff);
    38 GR_STATIC_ASSERT((int)kISA_GrBlendCoeff  == (int)SkXfermode::kISA_Coeff);
    39 GR_STATIC_ASSERT((int)kDA_GrBlendCoeff   == (int)SkXfermode::kDA_Coeff);
    40 GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff  == (int)SkXfermode::kIDA_Coeff);
    42 #define sk_blend_to_grblend(X) ((GrBlendCoeff)(X))
    44 ///////////////////////////////////////////////////////////////////////////////
    46 #include "SkColorPriv.h"
    48 /**
    49  *  Convert the SkBitmap::Config to the corresponding PixelConfig, or
    50  *  kUnknown_PixelConfig if the conversion cannot be done.
    51  */
    52 GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config);
    53 GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType, SkAlphaType);
    54 bool GrPixelConfig2ColorType(GrPixelConfig, SkColorType*);
    56 static inline GrColor SkColor2GrColor(SkColor c) {
    57     SkPMColor pm = SkPreMultiplyColor(c);
    58     unsigned r = SkGetPackedR32(pm);
    59     unsigned g = SkGetPackedG32(pm);
    60     unsigned b = SkGetPackedB32(pm);
    61     unsigned a = SkGetPackedA32(pm);
    62     return GrColorPackRGBA(r, g, b, a);
    63 }
    65 ////////////////////////////////////////////////////////////////////////////////
    67 bool GrIsBitmapInCache(const GrContext*, const SkBitmap&, const GrTextureParams*);
    69 GrTexture* GrLockAndRefCachedBitmapTexture(GrContext*, const SkBitmap&, const GrTextureParams*);
    71 void GrUnlockAndUnrefCachedBitmapTexture(GrTexture*);
    73 ////////////////////////////////////////////////////////////////////////////////
    74 // Classes
    76 class SkGlyphCache;
    78 class SkGrFontScaler : public GrFontScaler {
    79 public:
    80     explicit SkGrFontScaler(SkGlyphCache* strike);
    81     virtual ~SkGrFontScaler();
    83     // overrides
    84     virtual const GrKey* getKey();
    85     virtual GrMaskFormat getMaskFormat();
    86     virtual bool getPackedGlyphBounds(GrGlyph::PackedID, SkIRect* bounds);
    87     virtual bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height,
    88                                      int rowBytes, void* image);
    89     virtual bool getGlyphPath(uint16_t glyphID, SkPath*);
    91 private:
    92     SkGlyphCache* fStrike;
    93     GrKey*  fKey;
    94 //    DECLARE_INSTANCE_COUNTER(SkGrFontScaler);
    95 };
    97 ////////////////////////////////////////////////////////////////////////////////
    99 #endif

mercurial