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 fd573f41e9578f51aba52a5f9afe222382942f7e..80e0177650baea7d114e9bc099dfc76e6db6e1f1 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 8f62a7098771d2ca26234dde008cdaa5b0337898..b038a9ad04b5e118f9d389ce95867347048862ac 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