Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: src/core/SkDeviceProfile.cpp

Issue 19540018: Update static SkMutex to remove static initializer on Linux. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "SkDeviceProfile.h" 9 #include "SkDeviceProfile.h"
10 #include "SkThread.h"
10 11
11 SK_DEFINE_INST_COUNT(SkDeviceProfile) 12 SK_DEFINE_INST_COUNT(SkDeviceProfile)
12 13
13 #define DEFAULT_GAMMAEXP 2.2f 14 #define DEFAULT_GAMMAEXP 2.2f
14 #define DEFAULT_CONTRASTSCALE 0.5f 15 #define DEFAULT_CONTRASTSCALE 0.5f
15 #define DEFAULT_LCDCONFIG SkDeviceProfile::kNone_LCDConfig 16 #define DEFAULT_LCDCONFIG SkDeviceProfile::kNone_LCDConfig
16 #define DEFAULT_FONTHINTLEVEL SkDeviceProfile::kSlight_FontHintLevel 17 #define DEFAULT_FONTHINTLEVEL SkDeviceProfile::kSlight_FontHintLevel
17 18
18 static float pin(float value, float min, float max) { 19 static float pin(float value, float min, float max) {
19 if (value < min) { 20 if (value < min) {
(...skipping 18 matching lines...) Expand all
38 39
39 /////////////////////////////////////////////////////////////////////////////// 40 ///////////////////////////////////////////////////////////////////////////////
40 41
41 SkDeviceProfile* SkDeviceProfile::Create(float gammaExp, 42 SkDeviceProfile* SkDeviceProfile::Create(float gammaExp,
42 float contrast, 43 float contrast,
43 LCDConfig config, 44 LCDConfig config,
44 FontHintLevel level) { 45 FontHintLevel level) {
45 return SkNEW_ARGS(SkDeviceProfile, (gammaExp, contrast, config, level)); 46 return SkNEW_ARGS(SkDeviceProfile, (gammaExp, contrast, config, level));
46 } 47 }
47 48
48 static SkMutex gMutex; 49 SK_DECLARE_STATIC_MUTEX(gMutex);
49 static SkDeviceProfile* gDefaultProfile; 50 static SkDeviceProfile* gDefaultProfile;
50 static SkDeviceProfile* gGlobalProfile; 51 static SkDeviceProfile* gGlobalProfile;
51 52
52 SkDeviceProfile* SkDeviceProfile::GetDefault() { 53 SkDeviceProfile* SkDeviceProfile::GetDefault() {
53 SkAutoMutexAcquire amc(gMutex); 54 SkAutoMutexAcquire amc(gMutex);
54 55
55 if (NULL == gDefaultProfile) { 56 if (NULL == gDefaultProfile) {
56 gDefaultProfile = SkDeviceProfile::Create(DEFAULT_GAMMAEXP, 57 gDefaultProfile = SkDeviceProfile::Create(DEFAULT_GAMMAEXP,
57 DEFAULT_CONTRASTSCALE, 58 DEFAULT_CONTRASTSCALE,
58 DEFAULT_LCDCONFIG, 59 DEFAULT_LCDCONFIG,
(...skipping 10 matching lines...) Expand all
69 } 70 }
70 gGlobalProfile->ref(); 71 gGlobalProfile->ref();
71 return gGlobalProfile; 72 return gGlobalProfile;
72 } 73 }
73 74
74 void SkDeviceProfile::SetGlobal(SkDeviceProfile* profile) { 75 void SkDeviceProfile::SetGlobal(SkDeviceProfile* profile) {
75 SkAutoMutexAcquire amc(gMutex); 76 SkAutoMutexAcquire amc(gMutex);
76 77
77 SkRefCnt_SafeAssign(gGlobalProfile, profile); 78 SkRefCnt_SafeAssign(gGlobalProfile, profile);
78 } 79 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698