gfx/skia/trunk/include/utils/SkUnitMappers.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.

     2 /*
     3  * Copyright 2008 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 SkUnitMappers_DEFINED
    11 #define SkUnitMappers_DEFINED
    13 #include "SkUnitMapper.h"
    15 /** This discretizes the range [0...1) into N discret values.
    16 */
    17 class SkDiscreteMapper : public SkUnitMapper {
    18 public:
    19     SkDiscreteMapper(int segments);
    20     // override from SkUnitMapper
    21     virtual uint16_t mapUnit16(uint16_t x);
    23     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscreteMapper)
    25 protected:
    26     SkDiscreteMapper(SkReadBuffer& );
    27     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
    29 private:
    30     int     fSegments;
    31     int32_t fScale;    // computed from fSegments
    33     typedef SkUnitMapper INHERITED;
    34 };
    36 /** This returns cos(x), to simulate lighting a sphere, where 0 maps to the
    37     center of the sphere, and 1 maps to the edge.
    38 */
    39 class SkCosineMapper : public SkUnitMapper {
    40 public:
    41     SkCosineMapper() {}
    42     // override from SkUnitMapper
    43     virtual uint16_t mapUnit16(uint16_t x);
    45     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCosineMapper)
    47 protected:
    48     SkCosineMapper(SkReadBuffer&);
    50 private:
    52     typedef SkUnitMapper INHERITED;
    53 };
    55 #endif

mercurial