Bug 939585 - Build gfx/thebes in unified mode. r=ehsan,bjacob
☠☠ backed out by 18eadd057bee ☠ ☠
authorBenoit Girard <b56girard@gmail.com>
Thu, 21 Nov 2013 14:22:45 -0500
changeset 166409 d280a1c64f762159c0f3dcd334f6b8f784ed2d3b
parent 166408 b6a8c9ded5b06211bc86d9b7bee5aff0ab80bde1
child 166410 18eadd057bee5c0b93270b4d3777c7b3caf7a117
push idunknown
push userunknown
push dateunknown
reviewersehsan, bjacob
bugs939585
milestone28.0a1
Bug 939585 - Build gfx/thebes in unified mode. r=ehsan,bjacob
gfx/thebes/gfxCoreTextShaper.cpp
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxGraphiteShaper.cpp
gfx/thebes/gfxHarfBuzzShaper.cpp
gfx/thebes/gfxPlatformFontList.cpp
gfx/thebes/gfxUserFontSet.cpp
gfx/thebes/gfxUtils.cpp
gfx/thebes/moz.build
gfx/thebes/nsSurfaceTexture.cpp
--- a/gfx/thebes/gfxCoreTextShaper.cpp
+++ b/gfx/thebes/gfxCoreTextShaper.cpp
@@ -484,16 +484,18 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxS
 
         glyphStart = glyphEnd;
         charStart = charEnd;
     }
 
     return NS_OK;
 }
 
+#undef SMALL_GLYPH_RUN
+
 // Construct the font attribute descriptor that we'll apply by default when creating a CTFontRef.
 // This will turn off line-edge swashes by default, because we don't know the actual line breaks
 // when doing glyph shaping.
 void
 gfxCoreTextShaper::CreateDefaultFeaturesDescriptor()
 {
     if (sDefaultFeaturesDescriptor != nullptr) {
         return;
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2249,17 +2249,17 @@ struct GlyphBufferAzure {
         }
 
         if (aReverse) {
             Glyph *begin = &mGlyphBuffer[0];
             Glyph *end = &mGlyphBuffer[mNumGlyphs];
             std::reverse(begin, end);
         }
         
-        gfx::GlyphBuffer buf;
+        mozilla::gfx::GlyphBuffer buf;
         buf.mGlyphs = mGlyphBuffer;
         buf.mNumGlyphs = mNumGlyphs;
 
         gfxContext::AzureState state = aThebesContext->CurrentState();
         if ((int(aDrawMode) & (int(DrawMode::GLYPH_STROKE) | int(DrawMode::GLYPH_STROKE_UNDERNEATH))) ==
                               (int(DrawMode::GLYPH_STROKE) | int(DrawMode::GLYPH_STROKE_UNDERNEATH))) {
             FlushStroke(aDT, aContextPaint, aFont, aThebesContext, buf, state);
         }
@@ -2331,17 +2331,17 @@ struct GlyphBufferAzure {
         }
 
         mNumGlyphs = 0;
     }
 
 private:
     void FlushStroke(DrawTarget *aDT, gfxTextContextPaint *aContextPaint,
                      ScaledFont *aFont, gfxContext *aThebesContext,
-                     gfx::GlyphBuffer& aBuf, gfxContext::AzureState& aState)
+                     mozilla::gfx::GlyphBuffer& aBuf, gfxContext::AzureState& aState)
     {
         RefPtr<Path> path = aFont->GetPathForGlyphs(aBuf, aDT);
         if (aContextPaint) {
             nsRefPtr<gfxPattern> strokePattern =
               aContextPaint->GetStrokePattern(aThebesContext->CurrentMatrix());
             if (strokePattern) {
                 aDT->Stroke(path, *strokePattern->GetPattern(aDT), aState.strokeOptions);
             }
--- a/gfx/thebes/gfxGraphiteShaper.cpp
+++ b/gfx/thebes/gfxGraphiteShaper.cpp
@@ -331,16 +331,18 @@ gfxGraphiteShaper::SetGlyphsFromSegment(
             NS_ASSERTION(!g.IsSimpleGlyph(), "overwriting a simple glyph");
             g.SetComplex(g.IsClusterStart(), false, 0);
         }
     }
 
     return NS_OK;
 }
 
+#undef SMALL_GLYPH_RUN
+
 // for language tag validation - include list of tags from the IANA registry
 #include "gfxLanguageTagList.cpp"
 
 nsTHashtable<nsUint32HashKey> *gfxGraphiteShaper::sLanguageTags;
 
 /*static*/ uint32_t
 gfxGraphiteShaper::GetGraphiteTagForLang(const nsCString& aLang)
 {
--- a/gfx/thebes/gfxHarfBuzzShaper.cpp
+++ b/gfx/thebes/gfxHarfBuzzShaper.cpp
@@ -774,17 +774,17 @@ HBUnicodeDecompose(hb_unicode_funcs_t *u
                    hb_codepoint_t     *a,
                    hb_codepoint_t     *b,
                    void               *user_data)
 {
     return nsUnicodeNormalizer::DecomposeNonRecursively(ab, a, b);
 }
 
 static PLDHashOperator
-AddFeature(const uint32_t& aTag, uint32_t& aValue, void *aUserArg)
+AddHartBuzzFeature(const uint32_t& aTag, uint32_t& aValue, void *aUserArg)
 {
     nsTArray<hb_feature_t>* features = static_cast<nsTArray<hb_feature_t>*> (aUserArg);
 
     hb_feature_t feat = { 0, 0, 0, UINT_MAX };
     feat.tag = aTag;
     feat.value = aValue;
     features->AppendElement(feat);
     return PL_DHASH_NEXT;
@@ -927,17 +927,17 @@ gfxHarfBuzzShaper::ShapeText(gfxContext 
 
     if (MergeFontFeatures(style,
                           entry->mFeatureSettings,
                           aShapedText->DisableLigatures(),
                           entry->FamilyName(),
                           mergedFeatures))
     {
         // enumerate result and insert into hb_feature array
-        mergedFeatures.Enumerate(AddFeature, &features);
+        mergedFeatures.Enumerate(AddHartBuzzFeature, &features);
     }
 
     bool isRightToLeft = aShapedText->IsRightToLeft();
     hb_buffer_t *buffer = hb_buffer_create();
     hb_buffer_set_unicode_funcs(buffer, sHBUnicodeFuncs);
     hb_buffer_set_direction(buffer, isRightToLeft ? HB_DIRECTION_RTL :
                                                     HB_DIRECTION_LTR);
     // For unresolved "common" or "inherited" runs, default to Latin for now.
@@ -1235,8 +1235,11 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxC
         }
 
         glyphStart = glyphEnd;
         charStart = charEnd;
     }
 
     return NS_OK;
 }
+
+#undef SMALL_GLYPH_RUN
+
--- a/gfx/thebes/gfxPlatformFontList.cpp
+++ b/gfx/thebes/gfxPlatformFontList.cpp
@@ -388,40 +388,38 @@ gfxPlatformFontList::SystemFindFontForCh
         if (fontEntry && fontEntry->TestCharacterMap(aCh)) {
             return fontEntry;
         }
     }
 
     TimeStamp start = TimeStamp::Now();
 
     // search commonly available fonts
-    bool common = true;
     gfxFontFamily *fallbackFamily = nullptr;
     fontEntry = CommonFontFallback(aCh, aRunScript, aStyle, &fallbackFamily);
  
     // if didn't find a font, do system-wide fallback (except for specials)
     uint32_t cmapCount = 0;
     if (!fontEntry) {
-        common = false;
         fontEntry = GlobalFontFallback(aCh, aRunScript, aStyle, cmapCount,
                                        &fallbackFamily);
     }
     TimeDuration elapsed = TimeStamp::Now() - start;
 
 #ifdef PR_LOGGING
     PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textrun);
 
     if (MOZ_UNLIKELY(log)) {
         uint32_t unicodeRange = FindCharUnicodeRange(aCh);
         int32_t script = mozilla::unicode::GetScriptCode(aCh);
         PR_LOG(log, PR_LOG_WARNING,\
                ("(textrun-systemfallback-%s) char: u+%6.6x "
                  "unicode-range: %d script: %d match: [%s]"
                 " time: %dus cmaps: %d\n",
-                (common ? "common" : "global"), aCh,
+                (fontEntry ? "common" : "global"), aCh,
                  unicodeRange, script,
                 (fontEntry ? NS_ConvertUTF16toUTF8(fontEntry->Name()).get() :
                     "<none>"),
                 int32_t(elapsed.ToMicroseconds()),
                 cmapCount));
     }
 #endif
 
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -30,18 +30,18 @@ gfxUserFontSet::GetUserFontsLog()
 {
     static PRLogModuleInfo *sLog;
     if (!sLog)
         sLog = PR_NewLogModule("userfonts");
     return sLog;
 }
 #endif /* PR_LOGGING */
 
-#define LOG(args) PR_LOG(GetUserFontsLog(), PR_LOG_DEBUG, args)
-#define LOG_ENABLED() PR_LOG_TEST(GetUserFontsLog(), PR_LOG_DEBUG)
+#define FONTSET_LOG(args) PR_LOG(GetUserFontsLog(), PR_LOG_DEBUG, args)
+#define FONTSET_LOG_ENABLED() PR_LOG_TEST(GetUserFontsLog(), PR_LOG_DEBUG)
 
 static uint64_t sFontSetGeneration = 0;
 
 // TODO: support for unicode ranges not yet implemented
 
 gfxProxyFontEntry::gfxProxyFontEntry(const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
              uint32_t aWeight,
              int32_t aStretch,
@@ -172,18 +172,18 @@ gfxUserFontSet::AddFontFace(const nsAStr
     gfxProxyFontEntry *proxyEntry =
         new gfxProxyFontEntry(aFontFaceSrcList, aWeight, aStretch,
                               aItalicStyle,
                               aFeatureSettings,
                               languageOverride,
                               aUnicodeRanges);
     family->AddFontEntry(proxyEntry);
 #ifdef PR_LOGGING
-    if (LOG_ENABLED()) {
-        LOG(("userfonts (%p) added (%s) with style: %s weight: %d stretch: %d",
+    if (FONTSET_LOG_ENABLED()) {
+        FONTSET_LOG(("userfonts (%p) added (%s) with style: %s weight: %d stretch: %d",
              this, NS_ConvertUTF16toUTF8(aFamilyName).get(),
              (aItalicStyle & NS_FONT_STYLE_ITALIC ? "italic" :
                  (aItalicStyle & NS_FONT_STYLE_OBLIQUE ? "oblique" : "normal")),
              aWeight, aStretch));
     }
 #endif
 
     return proxyEntry;
@@ -526,31 +526,31 @@ gfxUserFontSet::LoadNext(gfxMixedFontFam
 
         // src local ==> lookup and load immediately
 
         if (currSrc.mIsLocal) {
             gfxFontEntry *fe =
                 gfxPlatform::GetPlatform()->LookupLocalFont(aProxyEntry,
                                                             currSrc.mLocalName);
             if (fe) {
-                LOG(("userfonts (%p) [src %d] loaded local: (%s) for (%s) gen: %8.8x\n",
+                FONTSET_LOG(("userfonts (%p) [src %d] loaded local: (%s) for (%s) gen: %8.8x\n",
                      this, aProxyEntry->mSrcIndex,
                      NS_ConvertUTF16toUTF8(currSrc.mLocalName).get(),
                      NS_ConvertUTF16toUTF8(aFamily->Name()).get(),
                      uint32_t(mGeneration)));
                 fe->mFeatureSettings.AppendElements(aProxyEntry->mFeatureSettings);
                 fe->mLanguageOverride = aProxyEntry->mLanguageOverride;
                 // For src:local(), we don't care whether the request is from
                 // a private window as there's no issue of caching resources;
                 // local fonts are just available all the time.
                 StoreUserFontData(fe, aProxyEntry, false, nsString(), nullptr, 0);
                 ReplaceFontEntry(aFamily, aProxyEntry, fe);
                 return STATUS_LOADED;
             } else {
-                LOG(("userfonts (%p) [src %d] failed local: (%s) for (%s)\n",
+                FONTSET_LOG(("userfonts (%p) [src %d] failed local: (%s) for (%s)\n",
                      this, aProxyEntry->mSrcIndex,
                      NS_ConvertUTF16toUTF8(currSrc.mLocalName).get(),
                      NS_ConvertUTF16toUTF8(aFamily->Name()).get()));
             }
         }
 
         // src url ==> start the load process
         else {
@@ -598,20 +598,20 @@ gfxUserFontSet::LoadNext(gfxMixedFontFam
                                        "font load failed",
                                        nsIScriptError::errorFlag, rv);
                         }
                     } else {
                         // otherwise load font async
                         rv = StartLoad(aFamily, aProxyEntry, &currSrc);
                         if (NS_SUCCEEDED(rv)) {
 #ifdef PR_LOGGING
-                            if (LOG_ENABLED()) {
+                            if (FONTSET_LOG_ENABLED()) {
                                 nsAutoCString fontURI;
                                 currSrc.mURI->GetSpec(fontURI);
-                                LOG(("userfonts (%p) [src %d] loading uri: (%s) for (%s)\n",
+                                FONTSET_LOG(("userfonts (%p) [src %d] loading uri: (%s) for (%s)\n",
                                      this, aProxyEntry->mSrcIndex, fontURI.get(),
                                      NS_ConvertUTF16toUTF8(aFamily->Name()).get()));
                             }
 #endif
                             return STATUS_LOADING;
                         } else {
                             LogMessage(aFamily, aProxyEntry,
                                        "download failed",
@@ -633,17 +633,17 @@ gfxUserFontSet::LoadNext(gfxMixedFontFam
     }
 
     if (aProxyEntry->mUnsupportedFormat) {
         LogMessage(aFamily, aProxyEntry, "no supported format found",
                    nsIScriptError::warningFlag);
     }
 
     // all src's failed; mark this entry as unusable (so fallback will occur)
-    LOG(("userfonts (%p) failed all src for (%s)\n",
+    FONTSET_LOG(("userfonts (%p) failed all src for (%s)\n",
         this, NS_ConvertUTF16toUTF8(aFamily->Name()).get()));
     aProxyEntry->mLoadingState = gfxProxyFontEntry::LOADING_FAILED;
 
     return STATUS_END_OF_LIST;
 }
 
 void
 gfxUserFontSet::IncrementGeneration()
@@ -712,33 +712,33 @@ gfxUserFontSet::LoadFont(gfxMixedFontFam
 
         // copy OpenType feature/language settings from the proxy to the
         // newly-created font entry
         fe->mFeatureSettings.AppendElements(aProxy->mFeatureSettings);
         fe->mLanguageOverride = aProxy->mLanguageOverride;
         StoreUserFontData(fe, aProxy, GetPrivateBrowsing(),
                           originalFullName, &metadata, metaOrigLen);
 #ifdef PR_LOGGING
-        if (LOG_ENABLED()) {
+        if (FONTSET_LOG_ENABLED()) {
             nsAutoCString fontURI;
             aProxy->mSrcList[aProxy->mSrcIndex].mURI->GetSpec(fontURI);
-            LOG(("userfonts (%p) [src %d] loaded uri: (%s) for (%s) gen: %8.8x\n",
+            FONTSET_LOG(("userfonts (%p) [src %d] loaded uri: (%s) for (%s) gen: %8.8x\n",
                  this, aProxy->mSrcIndex, fontURI.get(),
                  NS_ConvertUTF16toUTF8(aFamily->Name()).get(),
                  uint32_t(mGeneration)));
         }
 #endif
         ReplaceFontEntry(aFamily, aProxy, fe);
         UserFontCache::CacheFont(fe);
     } else {
 #ifdef PR_LOGGING
-        if (LOG_ENABLED()) {
+        if (FONTSET_LOG_ENABLED()) {
             nsAutoCString fontURI;
             aProxy->mSrcList[aProxy->mSrcIndex].mURI->GetSpec(fontURI);
-            LOG(("userfonts (%p) [src %d] failed uri: (%s) for (%s)"
+            FONTSET_LOG(("userfonts (%p) [src %d] failed uri: (%s) for (%s)"
                  " error making platform font\n",
                  this, aProxy->mSrcIndex, fontURI.get(),
                  NS_ConvertUTF16toUTF8(aFamily->Name()).get()));
         }
 #endif
     }
 
     // The downloaded data can now be discarded; the font entry is using the
--- a/gfx/thebes/gfxUtils.cpp
+++ b/gfx/thebes/gfxUtils.cpp
@@ -520,17 +520,17 @@ static void
 ClipToRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion,
                      bool aSnap)
 {
   PathFromRegionInternal(aContext, aRegion, aSnap);
   aContext->Clip();
 }
 
 static TemporaryRef<Path>
-PathFromRegionInternal(gfx::DrawTarget* aTarget, const nsIntRegion& aRegion,
+PathFromRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion,
                        bool aSnap)
 {
   Matrix mat = aTarget->GetTransform();
   const gfxFloat epsilon = 0.000001;
 #define WITHIN_E(a,b) (fabs((a)-(b)) < epsilon)
   // We're essentially duplicating the logic in UserToDevicePixelSnapped here.
   bool shouldNotSnap = !aSnap || (WITHIN_E(mat._11,1.0) &&
                                   WITHIN_E(mat._22,1.0) &&
@@ -562,17 +562,17 @@ PathFromRegionInternal(gfx::DrawTarget* 
       pb->Close();
     }
   }
   RefPtr<Path> path = pb->Finish();
   return path;
 }
 
 static void
-ClipToRegionInternal(gfx::DrawTarget* aTarget, const nsIntRegion& aRegion,
+ClipToRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion,
                      bool aSnap)
 {
   RefPtr<Path> path = PathFromRegionInternal(aTarget, aRegion, aSnap);
   aTarget->PushClip(path);
 }
 
 /*static*/ void
 gfxUtils::ClipToRegion(gfxContext* aContext, const nsIntRegion& aRegion)
@@ -685,39 +685,39 @@ gfxUtils::GfxRectToIntRect(const gfxRect
   return gfxRect(aOut->x, aOut->y, aOut->width, aOut->height).IsEqualEdges(aIn);
 }
 
 void
 gfxUtils::GetYCbCrToRGBDestFormatAndSize(const PlanarYCbCrData& aData,
                                          gfxImageFormat& aSuggestedFormat,
                                          gfxIntSize& aSuggestedSize)
 {
-  gfx::YUVType yuvtype =
-    gfx::TypeFromSize(aData.mYSize.width,
+  YUVType yuvtype =
+    TypeFromSize(aData.mYSize.width,
                       aData.mYSize.height,
                       aData.mCbCrSize.width,
                       aData.mCbCrSize.height);
 
   // 'prescale' is true if the scaling is to be done as part of the
   // YCbCr to RGB conversion rather than on the RGB data when rendered.
   bool prescale = aSuggestedSize.width > 0 && aSuggestedSize.height > 0 &&
                     aSuggestedSize != aData.mPicSize;
 
   if (aSuggestedFormat == gfxImageFormatRGB16_565) {
 #if defined(HAVE_YCBCR_TO_RGB565)
     if (prescale &&
-        !gfx::IsScaleYCbCrToRGB565Fast(aData.mPicX,
+        !IsScaleYCbCrToRGB565Fast(aData.mPicX,
                                        aData.mPicY,
                                        aData.mPicSize.width,
                                        aData.mPicSize.height,
                                        aSuggestedSize.width,
                                        aSuggestedSize.height,
                                        yuvtype,
-                                       gfx::FILTER_BILINEAR) &&
-        gfx::IsConvertYCbCrToRGB565Fast(aData.mPicX,
+                                       FILTER_BILINEAR) &&
+        IsConvertYCbCrToRGB565Fast(aData.mPicX,
                                         aData.mPicY,
                                         aData.mPicSize.width,
                                         aData.mPicSize.height,
                                         yuvtype)) {
       prescale = false;
     }
 #else
     // yuv2rgb16 function not available
@@ -726,17 +726,17 @@ gfxUtils::GetYCbCrToRGBDestFormatAndSize
   }
   else if (aSuggestedFormat != gfxImageFormatRGB24) {
     // No other formats are currently supported.
     aSuggestedFormat = gfxImageFormatRGB24;
   }
   if (aSuggestedFormat == gfxImageFormatRGB24) {
     /* ScaleYCbCrToRGB32 does not support a picture offset, nor 4:4:4 data.
        See bugs 639415 and 640073. */
-    if (aData.mPicX != 0 || aData.mPicY != 0 || yuvtype == gfx::YV24)
+    if (aData.mPicX != 0 || aData.mPicY != 0 || yuvtype == YV24)
       prescale = false;
   }
   if (!prescale) {
     aSuggestedSize = aData.mPicSize;
   }
 }
 
 void
@@ -747,75 +747,75 @@ gfxUtils::ConvertYCbCrToRGB(const Planar
                             int32_t aStride)
 {
   // ConvertYCbCrToRGB et al. assume the chroma planes are rounded up if the
   // luma plane is odd sized.
   MOZ_ASSERT((aData.mCbCrSize.width == aData.mYSize.width ||
               aData.mCbCrSize.width == (aData.mYSize.width + 1) >> 1) &&
              (aData.mCbCrSize.height == aData.mYSize.height ||
               aData.mCbCrSize.height == (aData.mYSize.height + 1) >> 1));
-  gfx::YUVType yuvtype =
-    gfx::TypeFromSize(aData.mYSize.width,
+  YUVType yuvtype =
+    TypeFromSize(aData.mYSize.width,
                       aData.mYSize.height,
                       aData.mCbCrSize.width,
                       aData.mCbCrSize.height);
 
   // Convert from YCbCr to RGB now, scaling the image if needed.
   if (aDestSize != aData.mPicSize) {
 #if defined(HAVE_YCBCR_TO_RGB565)
     if (aDestFormat == gfxImageFormatRGB16_565) {
-      gfx::ScaleYCbCrToRGB565(aData.mYChannel,
+      ScaleYCbCrToRGB565(aData.mYChannel,
                               aData.mCbChannel,
                               aData.mCrChannel,
                               aDestBuffer,
                               aData.mPicX,
                               aData.mPicY,
                               aData.mPicSize.width,
                               aData.mPicSize.height,
                               aDestSize.width,
                               aDestSize.height,
                               aData.mYStride,
                               aData.mCbCrStride,
                               aStride,
                               yuvtype,
-                              gfx::FILTER_BILINEAR);
+                              FILTER_BILINEAR);
     } else
 #endif
-      gfx::ScaleYCbCrToRGB32(aData.mYChannel,
+      ScaleYCbCrToRGB32(aData.mYChannel,
                              aData.mCbChannel,
                              aData.mCrChannel,
                              aDestBuffer,
                              aData.mPicSize.width,
                              aData.mPicSize.height,
                              aDestSize.width,
                              aDestSize.height,
                              aData.mYStride,
                              aData.mCbCrStride,
                              aStride,
                              yuvtype,
-                             gfx::ROTATE_0,
-                             gfx::FILTER_BILINEAR);
+                             ROTATE_0,
+                             FILTER_BILINEAR);
   } else { // no prescale
 #if defined(HAVE_YCBCR_TO_RGB565)
     if (aDestFormat == gfxImageFormatRGB16_565) {
-      gfx::ConvertYCbCrToRGB565(aData.mYChannel,
+      ConvertYCbCrToRGB565(aData.mYChannel,
                                 aData.mCbChannel,
                                 aData.mCrChannel,
                                 aDestBuffer,
                                 aData.mPicX,
                                 aData.mPicY,
                                 aData.mPicSize.width,
                                 aData.mPicSize.height,
                                 aData.mYStride,
                                 aData.mCbCrStride,
                                 aStride,
                                 yuvtype);
     } else // aDestFormat != gfxImageFormatRGB16_565
 #endif
-      gfx::ConvertYCbCrToRGB32(aData.mYChannel,
+      ConvertYCbCrToRGB32(aData.mYChannel,
                                aData.mCbChannel,
                                aData.mCrChannel,
                                aDestBuffer,
                                aData.mPicX,
                                aData.mPicY,
                                aData.mPicSize.width,
                                aData.mPicSize.height,
                                aData.mYStride,
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -226,37 +226,47 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wi
 
 # Are we targeting x86 or x64?  If so, build gfxAlphaRecoverySSE2.cpp.
 if CONFIG['INTEL_ARCHITECTURE']:
     SOURCES += [
         'gfxAlphaRecoverySSE2.cpp',
     ]
 
 SOURCES += [
+    # Includes mac system header conflicting with point/size,
+    # and includes glxXlibSurface.h which drags in Xrender.h
+    'gfxASurface.cpp', 
+    # on X11, gfxDrawable.cpp includes X headers for an old workaround which
+    # we could consider removing soon (affects Ubuntus older than 10.04 LTS)
+    # which currently prevent it from joining UNIFIED_SOURCES.
+    'gfxDrawable.cpp',
+    # Uses FORCE_PR_LOG
+    'gfxFontUtils.cpp',
+    # Includes mac system header conflicting with point/size
+    'gfxPlatform.cpp',
+]
+
+UNIFIED_SOURCES += [
     'gfx3DMatrix.cpp',
     'gfxAlphaRecovery.cpp',
-    'gfxASurface.cpp',
     'gfxBaseSharedMemorySurface.cpp',
     'gfxBlur.cpp',
     'gfxCachedTempSurface.cpp',
     'gfxContext.cpp',
-    'gfxDrawable.cpp',
     'gfxFont.cpp',
     'gfxFontFeatures.cpp',
     'gfxFontMissingGlyphs.cpp',
     'gfxFontTest.cpp',
-    'gfxFontUtils.cpp',
     'gfxGradientCache.cpp',
     'gfxGraphiteShaper.cpp',
     'gfxHarfBuzzShaper.cpp',
     'gfxImageSurface.cpp',
     'gfxMatrix.cpp',
     'gfxPath.cpp',
     'gfxPattern.cpp',
-    'gfxPlatform.cpp',
     'gfxPlatformFontList.cpp',
     'gfxRect.cpp',
     'gfxReusableImageSurfaceWrapper.cpp',
     'gfxReusableSharedImageSurfaceWrapper.cpp',
     'gfxScriptItemizer.cpp',
     'gfxSkipChars.cpp',
     'gfxSVGGlyphs.cpp',
     'gfxTeeSurface.cpp',
--- a/gfx/thebes/nsSurfaceTexture.cpp
+++ b/gfx/thebes/nsSurfaceTexture.cpp
@@ -11,18 +11,16 @@
 #include <android/log.h>
 #include "nsSurfaceTexture.h"
 #include "gfxImageSurface.h"
 #include "AndroidBridge.h"
 #include "nsThreadUtils.h"
 
 using namespace mozilla;
 
-#define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "nsSurfaceTexture" , ## args)
-
 // UGH
 static std::map<int, nsSurfaceTexture*> sInstances;
 static int sNextID = 0;
 
 static class JNIFunctions {
 public:
 
   JNIFunctions() : mInitialized(false)
@@ -136,17 +134,17 @@ nsSurfaceTexture::Create(GLuint aTexture
 {
   // Right now we only support creating this on the main thread because
   // of the JNIEnv assumptions in JNIHelper and elsewhere
   if (!NS_IsMainThread())
     return nullptr;
 
   nsSurfaceTexture* st = new nsSurfaceTexture();
   if (!st->Init(aTexture)) {
-    LOG("Failed to initialize nsSurfaceTexture");
+    printf_stderr("Failed to initialize nsSurfaceTexture");
     delete st;
     st = nullptr;
   }
 
   return st;
 }
 
 nsSurfaceTexture*
@@ -256,9 +254,9 @@ nsSurfaceTexture::NotifyFrameAvailable()
       nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(this, &nsSurfaceTexture::NotifyFrameAvailable);
       NS_DispatchToCurrentThread(event);
     } else {
       mFrameAvailableCallback->Run();
     }
   }
 }
 
-#endif // MOZ_WIDGET_ANDROID
\ No newline at end of file
+#endif // MOZ_WIDGET_ANDROID