LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/core - SkDeviceProfile.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 32 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             :  */
       7             : 
       8             : 
       9             : #include "SkDeviceProfile.h"
      10             : #include "SkMutex.h"
      11             : 
      12             : #define DEFAULT_GAMMAEXP        2.2f
      13             : #define DEFAULT_CONTRASTSCALE   0.5f
      14             : #define DEFAULT_LCDCONFIG       SkDeviceProfile::kNone_LCDConfig
      15             : #define DEFAULT_FONTHINTLEVEL   SkDeviceProfile::kSlight_FontHintLevel
      16             : 
      17           0 : static float pin(float value, float min, float max) {
      18           0 :     if (value < min) {
      19           0 :         value = min;
      20           0 :     } else if (value > max) {
      21           0 :         value = max;
      22             :     }
      23           0 :     return value;
      24             : }
      25             : 
      26           0 : SkDeviceProfile::SkDeviceProfile(float gammaExp, float contrast,
      27           0 :                                  LCDConfig config, FontHintLevel level) {
      28           0 :     fGammaExponent = pin(gammaExp, 0, 10);
      29           0 :     fContrastScale = pin(contrast, 0, 1);
      30           0 :     fLCDConfig = config;
      31           0 :     fFontHintLevel = level;
      32           0 : }
      33             : 
      34           0 : void SkDeviceProfile::generateTableForLuminanceByte(U8CPU lumByte,
      35             :                                                     uint8_t table[256]) const {
      36           0 : }
      37             : 
      38             : ///////////////////////////////////////////////////////////////////////////////
      39             : 
      40           0 : SkDeviceProfile* SkDeviceProfile::Create(float gammaExp,
      41             :                                          float contrast,
      42             :                                          LCDConfig config,
      43             :                                          FontHintLevel level) {
      44           0 :     return new SkDeviceProfile(gammaExp, contrast, config, level);
      45             : }
      46             : 
      47             : SK_DECLARE_STATIC_MUTEX(gMutex);
      48             : static SkDeviceProfile* gDefaultProfile;
      49             : static SkDeviceProfile* gGlobalProfile;
      50             : 
      51           0 : SkDeviceProfile* SkDeviceProfile::GetDefault() {
      52           0 :     SkAutoMutexAcquire amc(gMutex);
      53             : 
      54           0 :     if (nullptr == gDefaultProfile) {
      55           0 :         gDefaultProfile = SkDeviceProfile::Create(DEFAULT_GAMMAEXP,
      56             :                                                   DEFAULT_CONTRASTSCALE,
      57             :                                                   DEFAULT_LCDCONFIG,
      58             :                                                   DEFAULT_FONTHINTLEVEL);
      59             :     }
      60           0 :     return gDefaultProfile;
      61             : }
      62             : 
      63           0 : SkDeviceProfile* SkDeviceProfile::RefGlobal() {
      64           0 :     SkAutoMutexAcquire amc(gMutex);
      65             : 
      66           0 :     if (nullptr == gGlobalProfile) {
      67           0 :         gGlobalProfile = SkDeviceProfile::GetDefault();
      68             :     }
      69           0 :     gGlobalProfile->ref();
      70           0 :     return gGlobalProfile;
      71             : }
      72             : 
      73           0 : void SkDeviceProfile::SetGlobal(SkDeviceProfile* profile) {
      74           0 :     SkAutoMutexAcquire amc(gMutex);
      75             : 
      76           0 :     SkRefCnt_SafeAssign(gGlobalProfile, profile);
      77           0 : }

Generated by: LCOV version 1.13