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