Clean up the default gamma settings.
authorbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 10 Apr 2014 22:26:29 +0000 (22:26 +0000)
committerbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 10 Apr 2014 22:26:29 +0000 (22:26 +0000)
This makes it a compile error to specify both SK_GAMMA_EXPONENT
and SK_GAMMA_SRGB. It also ensures that SK_GAMMA_EXPONENT will
be set consistently.

R=djsollen@google.com, reed@google.com

Review URL: https://codereview.chromium.org/233003003

git-svn-id: http://skia.googlecode.com/svn/trunk@14143 2bbb7eff-a529-9590-31e7-b0007b416f81

include/core/SkDeviceProperties.h
include/core/SkPostConfig.h

index fd573f4..80e0177 100644 (file)
@@ -1,15 +1,6 @@
 #ifndef SkDeviceProperties_DEFINED
 #define SkDeviceProperties_DEFINED
 
-#ifndef SK_GAMMA_EXPONENT
-    #define SK_GAMMA_EXPONENT (2.2f)
-#endif
-
-#ifdef SK_GAMMA_SRGB
-    #undef SK_GAMMA_EXPONENT
-    #define SK_GAMMA_EXPONENT (0.0f)
-#endif
-
 //TODO: get everyone to stop using SkFontLCDConfig::SetSubpixel* and remove this import.
 #include "SkFontLCDConfig.h"
 
index 8f62a70..b038a9a 100644 (file)
 #  endif
 #endif
 
+
+//////////////////////////////////////////////////////////////////////
+
+#if defined(SK_GAMMA_EXPONENT) && defined(SK_GAMMA_SRGB)
+#  error "cannot define both SK_GAMMA_EXPONENT and SK_GAMMA_SRGB"
+#elif defined(SK_GAMMA_SRGB)
+#  define SK_GAMMA_EXPONENT (0.0f)
+#elif !defined(SK_GAMMA_EXPONENT)
+#  define SK_GAMMA_EXPONENT (2.2f)
+#endif
+
 #endif // SkPostConfig_DEFINED