aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-07-11 14:56:22 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-11 20:31:18 +0000
commit97c6a0ee41bb1af9cc81695590e2bb97ec85fecf (patch)
tree9e6de14afba4ecbfa913196c92ae4f078da10be7 /src
parent4eebd9eed06039d265f06edb759765731f963271 (diff)
Remove interal use of SkRefCnt_SafeAssign.
It turns out that SkDeviceProfile is no longer used and can just be deleted. The ResourceCacheTest and DebugGLTestContext are changed to use smart pointers where possible. This also clarifies the squirrelly part of the test. DebugGLTestContext is going away soon anyway. Change-Id: I95ef24afa58aa4d356429b93d4dec0d72e3fd827 Reviewed-on: https://skia-review.googlesource.com/140577 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkDeviceProfile.cpp77
-rw-r--r--src/core/SkDeviceProfile.h98
2 files changed, 0 insertions, 175 deletions
diff --git a/src/core/SkDeviceProfile.cpp b/src/core/SkDeviceProfile.cpp
deleted file mode 100644
index e1c10c87d7..0000000000
--- a/src/core/SkDeviceProfile.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#include "SkDeviceProfile.h"
-#include "SkMutex.h"
-
-#define DEFAULT_GAMMAEXP 2.2f
-#define DEFAULT_CONTRASTSCALE 0.5f
-#define DEFAULT_LCDCONFIG SkDeviceProfile::kNone_LCDConfig
-#define DEFAULT_FONTHINTLEVEL SkDeviceProfile::kSlight_FontHintLevel
-
-static float pin(float value, float min, float max) {
- if (value < min) {
- value = min;
- } else if (value > max) {
- value = max;
- }
- return value;
-}
-
-SkDeviceProfile::SkDeviceProfile(float gammaExp, float contrast,
- LCDConfig config, FontHintLevel level) {
- fGammaExponent = pin(gammaExp, 0, 10);
- fContrastScale = pin(contrast, 0, 1);
- fLCDConfig = config;
- fFontHintLevel = level;
-}
-
-void SkDeviceProfile::generateTableForLuminanceByte(U8CPU lumByte,
- uint8_t table[256]) const {
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-SkDeviceProfile* SkDeviceProfile::Create(float gammaExp,
- float contrast,
- LCDConfig config,
- FontHintLevel level) {
- return new SkDeviceProfile(gammaExp, contrast, config, level);
-}
-
-SK_DECLARE_STATIC_MUTEX(gMutex);
-static SkDeviceProfile* gDefaultProfile;
-static SkDeviceProfile* gGlobalProfile;
-
-SkDeviceProfile* SkDeviceProfile::GetDefault() {
- SkAutoMutexAcquire amc(gMutex);
-
- if (nullptr == gDefaultProfile) {
- gDefaultProfile = SkDeviceProfile::Create(DEFAULT_GAMMAEXP,
- DEFAULT_CONTRASTSCALE,
- DEFAULT_LCDCONFIG,
- DEFAULT_FONTHINTLEVEL);
- }
- return gDefaultProfile;
-}
-
-SkDeviceProfile* SkDeviceProfile::RefGlobal() {
- SkAutoMutexAcquire amc(gMutex);
-
- if (nullptr == gGlobalProfile) {
- gGlobalProfile = SkDeviceProfile::GetDefault();
- }
- gGlobalProfile->ref();
- return gGlobalProfile;
-}
-
-void SkDeviceProfile::SetGlobal(SkDeviceProfile* profile) {
- SkAutoMutexAcquire amc(gMutex);
-
- SkRefCnt_SafeAssign(gGlobalProfile, profile);
-}
diff --git a/src/core/SkDeviceProfile.h b/src/core/SkDeviceProfile.h
deleted file mode 100644
index ed533f8329..0000000000
--- a/src/core/SkDeviceProfile.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkDeviceProfile_DEFINED
-#define SkDeviceProfile_DEFINED
-
-#include "SkRefCnt.h"
-
-class SkDeviceProfile : public SkRefCnt {
-public:
-
-
- enum LCDConfig {
- kNone_LCDConfig, // disables LCD text rendering, uses A8 instead
- kRGB_Horizontal_LCDConfig,
- kBGR_Horizontal_LCDConfig,
- kRGB_Vertical_LCDConfig,
- kBGR_Vertical_LCDConfig
- };
-
- enum FontHintLevel {
- kNone_FontHintLevel,
- kSlight_FontHintLevel,
- kNormal_FontHintLevel,
- kFull_FontHintLevel,
- kAuto_FontHintLevel
- };
-
- /**
- * gammaExp is typically between 1.0 and 2.2. For no gamma adjustment,
- * specify 1.0
- *
- * contrastScale will be pinned between 0.0 and 1.0. For no contrast
- * adjustment, specify 0.0
- *
- * @param config Describes the LCD layout for this device. If this is set
- * to kNone, then all requests for LCD text will be
- * devolved to A8 antialiasing.
- *
- * @param level The hinting level to be used, IF the paint specifies
- * "default". Otherwise the paint's hinting level will be
- * respected.
- */
- static SkDeviceProfile* Create(float gammaExp,
- float contrastScale,
- LCDConfig,
- FontHintLevel);
-
- /**
- * Returns the global default profile, that is used if no global profile is
- * specified with SetGlobal(), or if nullptr is specified to SetGlobal().
- * The references count is *not* incremented, and the caller should not
- * call unref().
- */
- static SkDeviceProfile* GetDefault();
-
- /**
- * Return the current global profile (or the default if no global had yet
- * been set) and increment its reference count. The call *must* call unref()
- * when it is done using it.
- */
- static SkDeviceProfile* RefGlobal();
-
- /**
- * Make the specified profile be the global value for all subsequently
- * instantiated devices. Does not affect any existing devices.
- * Increments the reference count on the profile.
- * Specify nullptr for the "identity" profile (where there is no gamma or
- * contrast correction).
- */
- static void SetGlobal(SkDeviceProfile*);
-
- float getFontGammaExponent() const { return fGammaExponent; }
- float getFontContrastScale() const { return fContrastScale; }
-
- /**
- * Given a luminance byte (0 for black, 0xFF for white), generate a table
- * that applies the gamma/contrast settings to linear coverage values.
- */
- void generateTableForLuminanceByte(U8CPU lumByte, uint8_t table[256]) const;
-
-private:
- SkDeviceProfile(float gammaExp, float contrastScale, LCDConfig,
- FontHintLevel);
-
- float fGammaExponent;
- float fContrastScale;
- LCDConfig fLCDConfig;
- FontHintLevel fFontHintLevel;
-
- typedef SkRefCnt INHERITED;
-};
-
-#endif