Bug 839621 - qcms_transform_create can return null, so indirect callers need to be ready for it as well. r=jmuizelaar, a=lsblakk
authorMilan Sreckovic <msreckovic@mozilla.com>
Fri, 08 Feb 2013 15:46:26 -0500
changeset 127558 07a8701aa96a5b6b66ae69680eaf0e6841e2957f
parent 127553 66ffb2e23ffe18761021061e21b56d8c5d4e725c
child 127559 b3e46a3bea04491cb0f16144b71f5c0e7ea7b0ee
push id2157
push userryanvm@gmail.com
push dateWed, 20 Feb 2013 14:38:37 +0000
treeherdermozilla-beta@8e2fb84b665d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar, lsblakk
bugs839621
milestone20.0
Bug 839621 - qcms_transform_create can return null, so indirect callers need to be ready for it as well. r=jmuizelaar, a=lsblakk
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxPattern.cpp
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -1259,33 +1259,37 @@ gfxContext::ClipContainsRect(const gfxRe
 
 void
 gfxContext::SetColor(const gfxRGBA& c)
 {
   if (mCairo) {
     if (gfxPlatform::GetCMSMode() == eCMSMode_All) {
 
         gfxRGBA cms;
-        gfxPlatform::TransformPixel(c, cms, gfxPlatform::GetCMSRGBTransform());
+        qcms_transform *transform = gfxPlatform::GetCMSRGBTransform();
+        if (transform)
+          gfxPlatform::TransformPixel(c, cms, transform);
 
         // Use the original alpha to avoid unnecessary float->byte->float
         // conversion errors
         cairo_set_source_rgba(mCairo, cms.r, cms.g, cms.b, c.a);
     }
     else
         cairo_set_source_rgba(mCairo, c.r, c.g, c.b, c.a);
   } else {
     CurrentState().pattern = NULL;
     CurrentState().sourceSurfCairo = NULL;
     CurrentState().sourceSurface = NULL;
 
     if (gfxPlatform::GetCMSMode() == eCMSMode_All) {
 
         gfxRGBA cms;
-        gfxPlatform::TransformPixel(c, cms, gfxPlatform::GetCMSRGBTransform());
+        qcms_transform *transform = gfxPlatform::GetCMSRGBTransform();
+        if (transform)
+          gfxPlatform::TransformPixel(c, cms, transform);
 
         // Use the original alpha to avoid unnecessary float->byte->float
         // conversion errors
         CurrentState().color = ToColor(cms);
     }
     else
         CurrentState().color = ToColor(c);
   }
--- a/gfx/thebes/gfxPattern.cpp
+++ b/gfx/thebes/gfxPattern.cpp
@@ -75,17 +75,19 @@ gfxPattern::CairoPattern()
 
 void
 gfxPattern::AddColorStop(gfxFloat offset, const gfxRGBA& c)
 {
   if (mPattern) {
     mStops = NULL;
     if (gfxPlatform::GetCMSMode() == eCMSMode_All) {
         gfxRGBA cms;
-        gfxPlatform::TransformPixel(c, cms, gfxPlatform::GetCMSRGBTransform());
+        qcms_transform *transform = gfxPlatform::GetCMSRGBTransform();
+        if (transform)
+          gfxPlatform::TransformPixel(c, cms, transform);
 
         // Use the original alpha to avoid unnecessary float->byte->float
         // conversion errors
         cairo_pattern_add_color_stop_rgba(mPattern, offset,
                                           cms.r, cms.g, cms.b, c.a);
     }
     else
         cairo_pattern_add_color_stop_rgba(mPattern, offset, c.r, c.g, c.b, c.a);
@@ -426,9 +428,9 @@ gfxPattern::AdjustTransformForPattern(Ma
   mat.Invert();
   // mat maps from device space to current user space
 
   // First, transform from pattern space to original user space. Then transform
   // from original user space to device space. Then transform from
   // device space to current user space.
   aPatternTransform = aPatternTransform * *aOriginalTransform * mat;
   aPatternTransform.NudgeToIntegers();
-}
\ No newline at end of file
+}