Bug 758980: Assume DirectWrite is buggy when it returns empty alpha texture bounds. r=jrmuizel
authorBas Schouten <bschouten@mozilla.com>
Wed, 13 Jun 2012 10:42:23 +0200
changeset 96560 d846a824519990b549d0bb404f296fee5fac8864
parent 96559 2ddb6278d1de06de58d9d182e2e0a701cc75747a
child 96561 f195d6de172f3add27cce4b522a42f6d541db5a2
push id10598
push userbschouten@mozilla.com
push dateWed, 13 Jun 2012 08:42:39 +0000
treeherdermozilla-inbound@d846a8245199 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs758980
milestone16.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 758980: Assume DirectWrite is buggy when it returns empty alpha texture bounds. r=jrmuizel
gfx/2d/DrawTargetD2D.cpp
--- a/gfx/2d/DrawTargetD2D.cpp
+++ b/gfx/2d/DrawTargetD2D.cpp
@@ -1798,16 +1798,22 @@ DrawTargetD2D::FillGlyphsManual(ScaledFo
                                                   renderMode, measureMode, 0, 0, byRef(analysis));
 
   if (FAILED(hr)) {
     return false;
   }
 
   RECT bounds;
   hr = analysis->GetAlphaTextureBounds(DWRITE_TEXTURE_CLEARTYPE_3x1, &bounds);
+
+  if (bounds.bottom <= bounds.top || bounds.right <= bounds.left) {
+    // DWrite seems to do this sometimes. I'm not 100% sure why. See bug 758980.
+    gfxDebug() << "Empty alpha texture bounds! Falling back to regular drawing.";
+    return false;
+  }
   IntRect rectBounds(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top);
   IntRect surfBounds(IntPoint(0, 0), mSize);
 
   rectBounds.IntersectRect(rectBounds, surfBounds);
 
   if (rectBounds.IsEmpty()) {
     // Nothing to do.
     return true;