Bug 595842. When GetHDCWithClip fails, fall through to the fallback rendering path. r=vlad,a=blocking-beta7
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 29 Oct 2010 16:08:07 +1300
changeset 56679 dcbc93b3364a494b05f7567b31f83ea7277d25c8
parent 56678 ee85c8d2975b3447f35d1c3b3c74ef3147338ba2
child 56680 ce1801c6ba9510561eecf8b4c40c6179fc4e6c82
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad, blocking-beta7
bugs595842
milestone2.0b8pre
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 595842. When GetHDCWithClip fails, fall through to the fallback rendering path. r=vlad,a=blocking-beta7
gfx/thebes/gfxWindowsNativeDrawing.cpp
layout/reftests/native-theme/border-radius-ref.html
layout/reftests/native-theme/border-radius.html
layout/reftests/native-theme/reftest.list
--- a/gfx/thebes/gfxWindowsNativeDrawing.cpp
+++ b/gfx/thebes/gfxWindowsNativeDrawing.cpp
@@ -85,35 +85,39 @@ gfxWindowsNativeDrawing::BeginNativeDraw
         // redirect rendering to our own HDC; in some cases,
         // we may be able to use the HDC from the surface directly.
         if ((surf->GetType() == gfxASurface::SurfaceTypeWin32 ||
              surf->GetType() == gfxASurface::SurfaceTypeWin32Printing) &&
             (surf->GetContentType() == gfxASurface::CONTENT_COLOR ||
              (surf->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA &&
               (mNativeDrawFlags & CAN_DRAW_TO_COLOR_ALPHA))))
         {
-            if (mTransformType == TRANSLATION_ONLY) {
-                mRenderState = RENDER_STATE_NATIVE_DRAWING;
+            // grab the DC. This can fail if there is a complex clipping path,
+            // in which case we'll have to fall back.
+            mWinSurface = static_cast<gfxWindowsSurface*>(static_cast<gfxASurface*>(surf.get()));
+            mDC = mWinSurface->GetDCWithClip(mContext);
 
-                mTranslation = m.GetTranslation();
+            if (mDC) {
+                if (mTransformType == TRANSLATION_ONLY) {
+                    mRenderState = RENDER_STATE_NATIVE_DRAWING;
 
-                mWinSurface = static_cast<gfxWindowsSurface*>(static_cast<gfxASurface*>(surf.get()));
-            } else if (((mTransformType == AXIS_ALIGNED_SCALE)
-                        && (mNativeDrawFlags & CAN_AXIS_ALIGNED_SCALE)) ||
-                       (mNativeDrawFlags & CAN_COMPLEX_TRANSFORM))
-            {
-                mWorldTransform.eM11 = (FLOAT) m.xx;
-                mWorldTransform.eM12 = (FLOAT) m.yx;
-                mWorldTransform.eM21 = (FLOAT) m.xy;
-                mWorldTransform.eM22 = (FLOAT) m.yy;
-                mWorldTransform.eDx  = (FLOAT) m.x0;
-                mWorldTransform.eDy  = (FLOAT) m.y0;
+                    mTranslation = m.GetTranslation();
+                } else if (((mTransformType == AXIS_ALIGNED_SCALE)
+                            && (mNativeDrawFlags & CAN_AXIS_ALIGNED_SCALE)) ||
+                           (mNativeDrawFlags & CAN_COMPLEX_TRANSFORM))
+                {
+                    mWorldTransform.eM11 = (FLOAT) m.xx;
+                    mWorldTransform.eM12 = (FLOAT) m.yx;
+                    mWorldTransform.eM21 = (FLOAT) m.xy;
+                    mWorldTransform.eM22 = (FLOAT) m.yy;
+                    mWorldTransform.eDx  = (FLOAT) m.x0;
+                    mWorldTransform.eDy  = (FLOAT) m.y0;
 
-                mRenderState = RENDER_STATE_NATIVE_DRAWING;
-                mWinSurface = static_cast<gfxWindowsSurface*>(static_cast<gfxASurface*>(surf.get()));
+                    mRenderState = RENDER_STATE_NATIVE_DRAWING;
+                }
             }
         }
 
         // If we couldn't do native drawing, then we have to do two-buffer drawing
         // and do alpha recovery
         if (mRenderState == RENDER_STATE_INIT) {
             mRenderState = RENDER_STATE_ALPHA_RECOVERY_BLACK;
 
@@ -151,19 +155,16 @@ gfxWindowsNativeDrawing::BeginNativeDraw
                 mTempSurfaceSize.height = (PRInt32) NS_ceil(mNativeRect.size.height * mScale.height + 1);
             }
         }
     }
 
     if (mRenderState == RENDER_STATE_NATIVE_DRAWING) {
         // we can just do native drawing directly to the context's surface
 
-        // grab the DC
-        mDC = mWinSurface->GetDCWithClip(mContext);
-
         // do we need to use SetWorldTransform?
         if (mTransformType != TRANSLATION_ONLY) {
             SetGraphicsMode(mDC, GM_ADVANCED);
             GetWorldTransform(mDC, &mOldWorldTransform);
             SetWorldTransform(mDC, &mWorldTransform);
         }
 
 #ifdef WINCE
new file mode 100644
--- /dev/null
+++ b/layout/reftests/native-theme/border-radius-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<div style="padding:50px; border-radius:50px; width:400px; height:400px; border:1px solid black;">
+  <input type="radio">
+  <input type="checkbox">
+</div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/native-theme/border-radius.html
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<div style="padding:50px; border-radius:50px; width:400px; height:400px; border:1px solid black; overflow:hidden;">
+  <input type="radio">
+  <input type="checkbox">
+</div>
+</body>
+</html>
--- a/layout/reftests/native-theme/reftest.list
+++ b/layout/reftests/native-theme/reftest.list
@@ -56,9 +56,11 @@ random-if(d2d) == resizer-bottomend.xul 
 != resizer-bottomend.xul resizer-bottomend-rtl.xul
 skip-if(gtk2Widget) != resizer-bottomend-rtl.xul blank-window.xul
 skip-if(gtk2Widget) random-if(d2d) == resizer-bottomend-rtl.xul resizer-bottomend-flipped.xul # bug 581086
 
 # Windows-only, depends on native scrollbar metrics
 skip-if(!winWidget) == scroll-thumb-minimum-size-notheme.html scroll-thumb-minimum-size-notheme-ref.html
 # skip-if(!winWidget) == scroll-thumb-minimum-size-theme.html scroll-thumb-minimum-size-theme-ref.html # Bug 512206
 
+== border-radius.html border-radius-ref.html
+
 == checkbox-dynamic-1.html checkbox-dynamic-1-ref.html