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.

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

mercurial