gfx/skia/trunk/include/effects/SkDisplacementMapEffect.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 2013 Google Inc.
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 #ifndef SkDisplacementMapEffect_DEFINED
michael@0 9 #define SkDisplacementMapEffect_DEFINED
michael@0 10
michael@0 11 #include "SkImageFilter.h"
michael@0 12 #include "SkBitmap.h"
michael@0 13
michael@0 14 class SK_API SkDisplacementMapEffect : public SkImageFilter {
michael@0 15 public:
michael@0 16 enum ChannelSelectorType {
michael@0 17 kUnknown_ChannelSelectorType,
michael@0 18 kR_ChannelSelectorType,
michael@0 19 kG_ChannelSelectorType,
michael@0 20 kB_ChannelSelectorType,
michael@0 21 kA_ChannelSelectorType
michael@0 22 };
michael@0 23
michael@0 24 ~SkDisplacementMapEffect();
michael@0 25
michael@0 26 static SkDisplacementMapEffect* Create(ChannelSelectorType xChannelSelector,
michael@0 27 ChannelSelectorType yChannelSelector,
michael@0 28 SkScalar scale, SkImageFilter* displacement,
michael@0 29 SkImageFilter* color = NULL,
michael@0 30 const CropRect* cropRect = NULL) {
michael@0 31 return SkNEW_ARGS(SkDisplacementMapEffect, (xChannelSelector, yChannelSelector, scale,
michael@0 32 displacement, color, cropRect));
michael@0 33 }
michael@0 34
michael@0 35 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDisplacementMapEffect)
michael@0 36
michael@0 37 virtual bool onFilterImage(Proxy* proxy,
michael@0 38 const SkBitmap& src,
michael@0 39 const Context& ctx,
michael@0 40 SkBitmap* dst,
michael@0 41 SkIPoint* offset) const SK_OVERRIDE;
michael@0 42 virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
michael@0 43
michael@0 44 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
michael@0 45 SkIRect* dst) const SK_OVERRIDE;
michael@0 46
michael@0 47 #if SK_SUPPORT_GPU
michael@0 48 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
michael@0 49 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
michael@0 50 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
michael@0 51 #endif
michael@0 52
michael@0 53 protected:
michael@0 54 explicit SkDisplacementMapEffect(SkReadBuffer& buffer);
michael@0 55 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
michael@0 56
michael@0 57 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
michael@0 58 public:
michael@0 59 #endif
michael@0 60 SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
michael@0 61 ChannelSelectorType yChannelSelector,
michael@0 62 SkScalar scale, SkImageFilter* displacement,
michael@0 63 SkImageFilter* color = NULL,
michael@0 64 const CropRect* cropRect = NULL);
michael@0 65
michael@0 66 private:
michael@0 67 ChannelSelectorType fXChannelSelector;
michael@0 68 ChannelSelectorType fYChannelSelector;
michael@0 69 SkScalar fScale;
michael@0 70 typedef SkImageFilter INHERITED;
michael@0 71 const SkImageFilter* getDisplacementInput() const { return getInput(0); }
michael@0 72 const SkImageFilter* getColorInput() const { return getInput(1); }
michael@0 73 };
michael@0 74
michael@0 75 #endif

mercurial