gfx/skia/trunk/include/effects/SkAvoidXfermode.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 2006 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 #ifndef SkAvoidXfermode_DEFINED
michael@0 9 #define SkAvoidXfermode_DEFINED
michael@0 10
michael@0 11 #include "SkXfermode.h"
michael@0 12
michael@0 13 /** \class SkAvoidXfermode
michael@0 14
michael@0 15 This xfermode will draw the src everywhere except on top of the specified
michael@0 16 color.
michael@0 17 */
michael@0 18 class SK_API SkAvoidXfermode : public SkXfermode {
michael@0 19 public:
michael@0 20 enum Mode {
michael@0 21 kAvoidColor_Mode, //!< draw everywhere except on the opColor
michael@0 22 kTargetColor_Mode //!< draw only on top of the opColor
michael@0 23 };
michael@0 24
michael@0 25 /** This xfermode draws, or doesn't draw, based on the destination's
michael@0 26 distance from an op-color.
michael@0 27
michael@0 28 There are two modes, and each mode interprets a tolerance value.
michael@0 29
michael@0 30 Avoid: In this mode, drawing is allowed only on destination pixels that
michael@0 31 are different from the op-color.
michael@0 32 Tolerance near 0: avoid any colors even remotely similar to the op-color
michael@0 33 Tolerance near 255: avoid only colors nearly identical to the op-color
michael@0 34
michael@0 35 Target: In this mode, drawing only occurs on destination pixels that
michael@0 36 are similar to the op-color
michael@0 37 Tolerance near 0: draw only on colors that are nearly identical to the op-color
michael@0 38 Tolerance near 255: draw on any colors even remotely similar to the op-color
michael@0 39 */
michael@0 40 static SkAvoidXfermode* Create(SkColor opColor, U8CPU tolerance, Mode mode) {
michael@0 41 return SkNEW_ARGS(SkAvoidXfermode, (opColor, tolerance, mode));
michael@0 42 }
michael@0 43
michael@0 44 // overrides from SkXfermode
michael@0 45 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
michael@0 46 const SkAlpha aa[]) const SK_OVERRIDE;
michael@0 47 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
michael@0 48 const SkAlpha aa[]) const SK_OVERRIDE;
michael@0 49 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
michael@0 50 const SkAlpha aa[]) const SK_OVERRIDE;
michael@0 51
michael@0 52 SK_TO_STRING_OVERRIDE()
michael@0 53 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAvoidXfermode)
michael@0 54
michael@0 55 protected:
michael@0 56 SkAvoidXfermode(SkReadBuffer&);
michael@0 57 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
michael@0 58
michael@0 59 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
michael@0 60 public:
michael@0 61 #endif
michael@0 62 SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode);
michael@0 63
michael@0 64 private:
michael@0 65 SkColor fOpColor;
michael@0 66 uint32_t fDistMul; // x.14
michael@0 67 Mode fMode;
michael@0 68
michael@0 69 typedef SkXfermode INHERITED;
michael@0 70 };
michael@0 71
michael@0 72 #endif

mercurial