gfx/skia/trunk/include/effects/SkBlurDrawLooper.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.

     1 /*
     2  * Copyright 2008 The Android Open Source Project
     3  *
     4  * Use of this source code is governed by a BSD-style license that can be
     5  * found in the LICENSE file.
     6  */
     9 #ifndef SkBlurDrawLooper_DEFINED
    10 #define SkBlurDrawLooper_DEFINED
    12 #include "SkDrawLooper.h"
    13 #include "SkColor.h"
    15 class SkMaskFilter;
    16 class SkColorFilter;
    18 /** \class SkBlurDrawLooper
    19     This class draws a shadow of the object (possibly offset), and then draws
    20     the original object in its original position.
    21     should there be an option to just draw the shadow/blur layer? webkit?
    22 */
    23 class SK_API SkBlurDrawLooper : public SkDrawLooper {
    24 public:
    25     enum BlurFlags {
    26         kNone_BlurFlag = 0x00,
    27         /**
    28             The blur layer's dx/dy/radius aren't affected by the canvas
    29             transform.
    30         */
    31         kIgnoreTransform_BlurFlag   = 0x01,
    32         kOverrideColor_BlurFlag     = 0x02,
    33         kHighQuality_BlurFlag       = 0x04,
    34         /** mask for all blur flags */
    35         kAll_BlurFlag               = 0x07
    36     };
    38     SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy,
    39                      uint32_t flags = kNone_BlurFlag);
    41 //    SK_ATTR_DEPRECATED("use sigma version")
    42     SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color,
    43                      uint32_t flags = kNone_BlurFlag);
    44     virtual ~SkBlurDrawLooper();
    46     virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVERRIDE;
    48     virtual size_t contextSize() const SK_OVERRIDE { return sizeof(BlurDrawLooperContext); }
    50     SK_TO_STRING_OVERRIDE()
    51     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper)
    53 protected:
    54     SkBlurDrawLooper(SkReadBuffer&);
    55     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
    57 private:
    58     SkMaskFilter*   fBlur;
    59     SkColorFilter*  fColorFilter;
    60     SkScalar        fDx, fDy;
    61     SkColor         fBlurColor;
    62     uint32_t        fBlurFlags;
    64     enum State {
    65         kBeforeEdge,
    66         kAfterEdge,
    67         kDone
    68     };
    70     class BlurDrawLooperContext : public SkDrawLooper::Context {
    71     public:
    72         explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper);
    74         virtual bool next(SkCanvas* canvas, SkPaint* paint) SK_OVERRIDE;
    76     private:
    77         const SkBlurDrawLooper* fLooper;
    78         State fState;
    79     };
    81     void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags);
    83     typedef SkDrawLooper INHERITED;
    84 };
    86 #endif

mercurial