Bug 843830 - Consolidate the enums in one place, so that bad things don't happen if the qcms enums ever change. r=bgirard
authorMilan Sreckovic <msreckovic@mozilla.com>
Thu, 21 Feb 2013 17:38:10 -0500
changeset 123381 2aec67f21b7393ce7d009e2e85123d2c08c3ec66
parent 123380 5f4904d3191fae6745123f7e79470a7a036cfbf9
child 123382 fb572a342efa33511154a6d72511bf7259d36aec
push id24380
push userryanvm@gmail.com
push dateFri, 01 Mar 2013 03:27:49 +0000
treeherdermozilla-central@993d7aff3109 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgirard
bugs843830
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 843830 - Consolidate the enums in one place, so that bad things don't happen if the qcms enums ever change. r=bgirard
gfx/qcms/qcms.h
gfx/thebes/gfxPlatform.cpp
--- a/gfx/qcms/qcms.h
+++ b/gfx/qcms/qcms.h
@@ -82,21 +82,27 @@ typedef int qcms_bool;
 struct _qcms_transform;
 typedef struct _qcms_transform qcms_transform;
 
 struct _qcms_profile;
 typedef struct _qcms_profile qcms_profile;
 
 /* these values match the Rendering Intent values from the ICC spec */
 typedef enum {
-	QCMS_INTENT_DEFAULT = 0,
+	QCMS_INTENT_MIN = 0,
 	QCMS_INTENT_PERCEPTUAL = 0,
 	QCMS_INTENT_RELATIVE_COLORIMETRIC = 1,
 	QCMS_INTENT_SATURATION = 2,
-	QCMS_INTENT_ABSOLUTE_COLORIMETRIC = 3
+	QCMS_INTENT_ABSOLUTE_COLORIMETRIC = 3,
+	QCMS_INTENT_MAX = 3,
+
+	/* Chris Murphy (CM consultant) suggests this as a default in the event that we
+	 * cannot reproduce relative + Black Point Compensation.  BPC brings an
+	 * unacceptable performance overhead, so we go with perceptual. */
+	QCMS_INTENT_DEFAULT = QCMS_INTENT_PERCEPTUAL,
 } qcms_intent;
 
 //XXX: I don't really like the _DATA_ prefix
 typedef enum {
 	QCMS_DATA_RGB_8,
 	QCMS_DATA_RGBA_8,
 	QCMS_DATA_GRAY_8,
 	QCMS_DATA_GRAYA_8
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1328,43 +1328,36 @@ gfxPlatform::GetCMSMode()
         rv = Preferences::GetBool("gfx.color_management.enablev4", &enableV4);
         if (NS_SUCCEEDED(rv) && enableV4) {
             qcms_enable_iccv4();
         }
     }
     return gCMSMode;
 }
 
-/* Chris Murphy (CM consultant) suggests this as a default in the event that we
-cannot reproduce relative + Black Point Compensation.  BPC brings an
-unacceptable performance overhead, so we go with perceptual. */
-#define INTENT_DEFAULT QCMS_INTENT_PERCEPTUAL
-#define INTENT_MIN 0
-#define INTENT_MAX 3
-
 int
 gfxPlatform::GetRenderingIntent()
 {
     if (gCMSIntent == -2) {
 
         /* Try to query the pref system for a rendering intent. */
         int32_t pIntent;
         if (NS_SUCCEEDED(Preferences::GetInt("gfx.color_management.rendering_intent", &pIntent))) {
             /* If the pref is within range, use it as an override. */
-            if ((pIntent >= INTENT_MIN) && (pIntent <= INTENT_MAX)) {
+            if ((pIntent >= QCMS_INTENT_MIN) && (pIntent <= QCMS_INTENT_MAX)) {
                 gCMSIntent = pIntent;
             }
             /* If the pref is out of range, use embedded profile. */
             else {
                 gCMSIntent = -1;
             }
         }
         /* If we didn't get a valid intent from prefs, use the default. */
         else {
-            gCMSIntent = INTENT_DEFAULT;
+            gCMSIntent = QCMS_INTENT_DEFAULT;
         }
     }
     return gCMSIntent;
 }
 
 void
 gfxPlatform::TransformPixel(const gfxRGBA& in, gfxRGBA& out, qcms_transform *transform)
 {