Sat, 03 Jan 2015 20:18:00 +0100
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.
michael@0 | 1 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2010 Google Inc. |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | |
michael@0 | 11 | #ifndef SkGr_DEFINED |
michael@0 | 12 | #define SkGr_DEFINED |
michael@0 | 13 | |
michael@0 | 14 | #include <stddef.h> |
michael@0 | 15 | |
michael@0 | 16 | // Gr headers |
michael@0 | 17 | #include "GrTypes.h" |
michael@0 | 18 | #include "GrContext.h" |
michael@0 | 19 | #include "GrFontScaler.h" |
michael@0 | 20 | |
michael@0 | 21 | // skia headers |
michael@0 | 22 | #include "SkBitmap.h" |
michael@0 | 23 | #include "SkPath.h" |
michael@0 | 24 | #include "SkPoint.h" |
michael@0 | 25 | #include "SkRegion.h" |
michael@0 | 26 | #include "SkClipStack.h" |
michael@0 | 27 | |
michael@0 | 28 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 29 | // Sk to Gr Type conversions |
michael@0 | 30 | |
michael@0 | 31 | GR_STATIC_ASSERT((int)kZero_GrBlendCoeff == (int)SkXfermode::kZero_Coeff); |
michael@0 | 32 | GR_STATIC_ASSERT((int)kOne_GrBlendCoeff == (int)SkXfermode::kOne_Coeff); |
michael@0 | 33 | GR_STATIC_ASSERT((int)kSC_GrBlendCoeff == (int)SkXfermode::kSC_Coeff); |
michael@0 | 34 | GR_STATIC_ASSERT((int)kISC_GrBlendCoeff == (int)SkXfermode::kISC_Coeff); |
michael@0 | 35 | GR_STATIC_ASSERT((int)kDC_GrBlendCoeff == (int)SkXfermode::kDC_Coeff); |
michael@0 | 36 | GR_STATIC_ASSERT((int)kIDC_GrBlendCoeff == (int)SkXfermode::kIDC_Coeff); |
michael@0 | 37 | GR_STATIC_ASSERT((int)kSA_GrBlendCoeff == (int)SkXfermode::kSA_Coeff); |
michael@0 | 38 | GR_STATIC_ASSERT((int)kISA_GrBlendCoeff == (int)SkXfermode::kISA_Coeff); |
michael@0 | 39 | GR_STATIC_ASSERT((int)kDA_GrBlendCoeff == (int)SkXfermode::kDA_Coeff); |
michael@0 | 40 | GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff); |
michael@0 | 41 | |
michael@0 | 42 | #define sk_blend_to_grblend(X) ((GrBlendCoeff)(X)) |
michael@0 | 43 | |
michael@0 | 44 | /////////////////////////////////////////////////////////////////////////////// |
michael@0 | 45 | |
michael@0 | 46 | #include "SkColorPriv.h" |
michael@0 | 47 | |
michael@0 | 48 | /** |
michael@0 | 49 | * Convert the SkBitmap::Config to the corresponding PixelConfig, or |
michael@0 | 50 | * kUnknown_PixelConfig if the conversion cannot be done. |
michael@0 | 51 | */ |
michael@0 | 52 | GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config); |
michael@0 | 53 | GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType, SkAlphaType); |
michael@0 | 54 | bool GrPixelConfig2ColorType(GrPixelConfig, SkColorType*); |
michael@0 | 55 | |
michael@0 | 56 | static inline GrColor SkColor2GrColor(SkColor c) { |
michael@0 | 57 | SkPMColor pm = SkPreMultiplyColor(c); |
michael@0 | 58 | unsigned r = SkGetPackedR32(pm); |
michael@0 | 59 | unsigned g = SkGetPackedG32(pm); |
michael@0 | 60 | unsigned b = SkGetPackedB32(pm); |
michael@0 | 61 | unsigned a = SkGetPackedA32(pm); |
michael@0 | 62 | return GrColorPackRGBA(r, g, b, a); |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 66 | |
michael@0 | 67 | bool GrIsBitmapInCache(const GrContext*, const SkBitmap&, const GrTextureParams*); |
michael@0 | 68 | |
michael@0 | 69 | GrTexture* GrLockAndRefCachedBitmapTexture(GrContext*, const SkBitmap&, const GrTextureParams*); |
michael@0 | 70 | |
michael@0 | 71 | void GrUnlockAndUnrefCachedBitmapTexture(GrTexture*); |
michael@0 | 72 | |
michael@0 | 73 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 74 | // Classes |
michael@0 | 75 | |
michael@0 | 76 | class SkGlyphCache; |
michael@0 | 77 | |
michael@0 | 78 | class SkGrFontScaler : public GrFontScaler { |
michael@0 | 79 | public: |
michael@0 | 80 | explicit SkGrFontScaler(SkGlyphCache* strike); |
michael@0 | 81 | virtual ~SkGrFontScaler(); |
michael@0 | 82 | |
michael@0 | 83 | // overrides |
michael@0 | 84 | virtual const GrKey* getKey(); |
michael@0 | 85 | virtual GrMaskFormat getMaskFormat(); |
michael@0 | 86 | virtual bool getPackedGlyphBounds(GrGlyph::PackedID, SkIRect* bounds); |
michael@0 | 87 | virtual bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height, |
michael@0 | 88 | int rowBytes, void* image); |
michael@0 | 89 | virtual bool getGlyphPath(uint16_t glyphID, SkPath*); |
michael@0 | 90 | |
michael@0 | 91 | private: |
michael@0 | 92 | SkGlyphCache* fStrike; |
michael@0 | 93 | GrKey* fKey; |
michael@0 | 94 | // DECLARE_INSTANCE_COUNTER(SkGrFontScaler); |
michael@0 | 95 | }; |
michael@0 | 96 | |
michael@0 | 97 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 98 | |
michael@0 | 99 | #endif |