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.

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

mercurial