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 2006 The Android Open Source Project |
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 | #ifndef SkBlurMask_DEFINED |
michael@0 | 11 | #define SkBlurMask_DEFINED |
michael@0 | 12 | |
michael@0 | 13 | #include "SkShader.h" |
michael@0 | 14 | #include "SkMask.h" |
michael@0 | 15 | #include "SkRRect.h" |
michael@0 | 16 | |
michael@0 | 17 | class SkBlurMask { |
michael@0 | 18 | public: |
michael@0 | 19 | enum Style { |
michael@0 | 20 | kNormal_Style, //!< fuzzy inside and outside |
michael@0 | 21 | kSolid_Style, //!< solid inside, fuzzy outside |
michael@0 | 22 | kOuter_Style, //!< nothing inside, fuzzy outside |
michael@0 | 23 | kInner_Style, //!< fuzzy inside, nothing outside |
michael@0 | 24 | |
michael@0 | 25 | kStyleCount |
michael@0 | 26 | }; |
michael@0 | 27 | |
michael@0 | 28 | enum Quality { |
michael@0 | 29 | kLow_Quality, //!< box blur |
michael@0 | 30 | kHigh_Quality //!< three pass box blur (similar to gaussian) |
michael@0 | 31 | }; |
michael@0 | 32 | |
michael@0 | 33 | static bool BlurRect(SkScalar sigma, SkMask *dst, const SkRect &src, |
michael@0 | 34 | Style style, |
michael@0 | 35 | SkIPoint *margin = NULL, |
michael@0 | 36 | SkMask::CreateMode createMode = |
michael@0 | 37 | SkMask::kComputeBoundsAndRenderImage_CreateMode); |
michael@0 | 38 | static bool BlurRRect(SkScalar sigma, SkMask *dst, const SkRRect &src, |
michael@0 | 39 | Style style, |
michael@0 | 40 | SkIPoint *margin = NULL, |
michael@0 | 41 | SkMask::CreateMode createMode = |
michael@0 | 42 | SkMask::kComputeBoundsAndRenderImage_CreateMode); |
michael@0 | 43 | static bool BoxBlur(SkMask* dst, const SkMask& src, |
michael@0 | 44 | SkScalar sigma, Style style, Quality quality, |
michael@0 | 45 | SkIPoint* margin = NULL); |
michael@0 | 46 | |
michael@0 | 47 | // the "ground truth" blur does a gaussian convolution; it's slow |
michael@0 | 48 | // but useful for comparison purposes. |
michael@0 | 49 | static bool BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src, |
michael@0 | 50 | Style style, |
michael@0 | 51 | SkIPoint* margin = NULL); |
michael@0 | 52 | |
michael@0 | 53 | static SkScalar ConvertRadiusToSigma(SkScalar radius); |
michael@0 | 54 | |
michael@0 | 55 | /* Helper functions for analytic rectangle blurs */ |
michael@0 | 56 | |
michael@0 | 57 | /** Look up the intensity of the (one dimnensional) blurred half-plane. |
michael@0 | 58 | @param profile The precomputed 1D blur profile; memory allocated by and managed by |
michael@0 | 59 | ComputeBlurProfile below. |
michael@0 | 60 | @param loc the location to look up; The lookup will clamp invalid inputs, but |
michael@0 | 61 | meaningful data are available between 0 and blurred_width |
michael@0 | 62 | @param blurred_width The width of the final, blurred rectangle |
michael@0 | 63 | @param sharp_width The width of the original, unblurred rectangle. |
michael@0 | 64 | */ |
michael@0 | 65 | static uint8_t ProfileLookup(const uint8_t* profile, int loc, int blurred_width, int sharp_width); |
michael@0 | 66 | |
michael@0 | 67 | /** Allocate memory for and populate the profile of a 1D blurred halfplane. The caller |
michael@0 | 68 | must free the memory. The amount of memory allocated will be exactly 6*sigma bytes. |
michael@0 | 69 | @param sigma The standard deviation of the gaussian blur kernel |
michael@0 | 70 | @param profile_out The location to store the allocated profile curve |
michael@0 | 71 | */ |
michael@0 | 72 | |
michael@0 | 73 | static void ComputeBlurProfile(SkScalar sigma, uint8_t** profile_out); |
michael@0 | 74 | |
michael@0 | 75 | /** Compute an entire scanline of a blurred step function. This is a 1D helper that |
michael@0 | 76 | will produce both the horizontal and vertical profiles of the blurry rectangle. |
michael@0 | 77 | @param pixels Location to store the resulting pixel data; allocated and managed by caller |
michael@0 | 78 | @param profile Precomputed blur profile computed by ComputeBlurProfile above. |
michael@0 | 79 | @param width Size of the pixels array. |
michael@0 | 80 | @param sigma Standard deviation of the gaussian blur kernel used to compute the profile; |
michael@0 | 81 | this implicitly gives the size of the pixels array. |
michael@0 | 82 | */ |
michael@0 | 83 | |
michael@0 | 84 | static void ComputeBlurredScanline(uint8_t* pixels, const uint8_t* profile, |
michael@0 | 85 | unsigned int width, SkScalar sigma); |
michael@0 | 86 | |
michael@0 | 87 | |
michael@0 | 88 | |
michael@0 | 89 | }; |
michael@0 | 90 | |
michael@0 | 91 | #endif |