gfx/skia/trunk/src/core/SkDeviceProfile.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 2012 Google Inc.
     3  *
     4  * Use of this source code is governed by a BSD-style license that can be
     5  * found in the LICENSE file.
     6  */
     8 #ifndef SkDeviceProfile_DEFINED
     9 #define SkDeviceProfile_DEFINED
    11 #include "SkRefCnt.h"
    13 class SkDeviceProfile : public SkRefCnt {
    14 public:
    15     SK_DECLARE_INST_COUNT(SkDeviceProfile)
    17     enum LCDConfig {
    18         kNone_LCDConfig,   // disables LCD text rendering, uses A8 instead
    19         kRGB_Horizontal_LCDConfig,
    20         kBGR_Horizontal_LCDConfig,
    21         kRGB_Vertical_LCDConfig,
    22         kBGR_Vertical_LCDConfig
    23     };
    25     enum FontHintLevel {
    26         kNone_FontHintLevel,
    27         kSlight_FontHintLevel,
    28         kNormal_FontHintLevel,
    29         kFull_FontHintLevel,
    30         kAuto_FontHintLevel
    31     };
    33     /**
    34      *  gammaExp is typically between 1.0 and 2.2. For no gamma adjustment,
    35      *  specify 1.0
    36      *
    37      *  contrastScale will be pinned between 0.0 and 1.0. For no contrast
    38      *  adjustment, specify 0.0
    39      *
    40      *  @param config   Describes the LCD layout for this device. If this is set
    41      *                  to kNone, then all requests for LCD text will be
    42      *                  devolved to A8 antialiasing.
    43      *
    44      *  @param level    The hinting level to be used, IF the paint specifies
    45      *                  "default". Otherwise the paint's hinting level will be
    46      *                  respected.
    47      */
    48     static SkDeviceProfile* Create(float gammaExp,
    49                                    float contrastScale,
    50                                    LCDConfig,
    51                                    FontHintLevel);
    53     /**
    54      *  Returns the global default profile, that is used if no global profile is
    55      *  specified with SetGlobal(), or if NULL is specified to SetGlobal().
    56      *  The references count is *not* incremented, and the caller should not
    57      *  call unref().
    58      */
    59     static SkDeviceProfile* GetDefault();
    61     /**
    62      *  Return the current global profile (or the default if no global had yet
    63      *  been set) and increment its reference count. The call *must* call unref()
    64      *  when it is done using it.
    65      */
    66     static SkDeviceProfile* RefGlobal();
    68     /**
    69      *  Make the specified profile be the global value for all subsequently
    70      *  instantiated devices. Does not affect any existing devices.
    71      *  Increments the reference count on the profile.
    72      *  Specify NULL for the "identity" profile (where there is no gamma or
    73      *  contrast correction).
    74      */
    75     static void SetGlobal(SkDeviceProfile*);
    77     float getFontGammaExponent() const { return fGammaExponent; }
    78     float getFontContrastScale() const { return fContrastScale; }
    80     /**
    81      *  Given a luminance byte (0 for black, 0xFF for white), generate a table
    82      *  that applies the gamma/contrast settings to linear coverage values.
    83      */
    84     void generateTableForLuminanceByte(U8CPU lumByte, uint8_t table[256]) const;
    86 private:
    87     SkDeviceProfile(float gammaExp, float contrastScale, LCDConfig,
    88                     FontHintLevel);
    90     float           fGammaExponent;
    91     float           fContrastScale;
    92     LCDConfig       fLCDConfig;
    93     FontHintLevel   fFontHintLevel;
    95     typedef SkRefCnt INHERITED;
    96 };
    98 #endif

mercurial