Bug 656589: Avoid using Direct2D surfaces which are non-functional. r=jimm

This commit is contained in:
Bas Schouten 2011-10-04 03:20:43 +02:00
Родитель 42aa5819d6
Коммит 640ce8a03a
2 изменённых файлов: 32 добавлений и 11 удалений

Просмотреть файл

@ -338,6 +338,15 @@ static WindowsDllInterceptor sUser32Intercept;
// the size of the default window border Windows paints.
static const PRInt32 kGlassMarginAdjustment = 2;
// We should never really try to accelerate windows bigger than this. In some
// cases this might lead to no D3D9 acceleration where we could have had it
// but D3D9 does not reliably report when it supports bigger windows. 8192
// is as safe as we can get, we know at least D3D10 hardware always supports
// this, other hardware we expect to report correctly in D3D9.
#define MAX_ACCELERATED_DIMENSION 8192
/**************************************************************
**************************************************************
**
@ -3230,6 +3239,9 @@ nsWindow::GetLayerManager(PLayersChild* aShadowManager,
}
#endif
RECT windowRect;
::GetClientRect(mWnd, &windowRect);
if (!mLayerManager ||
(!sAllowD3D9 && aPersistence == LAYER_MANAGER_PERSISTENT &&
mLayerManager->GetBackendType() ==
@ -3243,7 +3255,9 @@ nsWindow::GetLayerManager(PLayersChild* aShadowManager,
* transparent windows so don't even try. I'm also not sure if we even
* want to support this case. See bug #593471 */
if (eTransparencyTransparent == mTransparencyMode ||
prefs.mDisableAcceleration)
prefs.mDisableAcceleration ||
windowRect.right - windowRect.left > MAX_ACCELERATED_DIMENSION ||
windowRect.bottom - windowRect.top > MAX_ACCELERATED_DIMENSION)
mUseAcceleratedRendering = false;
else if (prefs.mAccelerateByDefault)
mUseAcceleratedRendering = true;

Просмотреть файл

@ -339,15 +339,6 @@ bool nsWindow::OnPaint(HDC aDC, PRUint32 aNestingLevel)
}
#endif
nsRefPtr<gfxWindowsSurface> targetSurfaceWin;
if (!targetSurface &&
IsRenderMode(gfxWindowsPlatform::RENDER_GDI))
{
PRUint32 flags = (mTransparencyMode == eTransparencyOpaque) ? 0 :
gfxWindowsSurface::FLAG_IS_TRANSPARENT;
targetSurfaceWin = new gfxWindowsSurface(hDC, flags);
targetSurface = targetSurfaceWin;
}
#ifdef CAIRO_HAS_D2D_SURFACE
if (!targetSurface &&
IsRenderMode(gfxWindowsPlatform::RENDER_DIRECT2D))
@ -361,9 +352,25 @@ bool nsWindow::OnPaint(HDC aDC, PRUint32 aNestingLevel)
#endif
mD2DWindowSurface = new gfxD2DSurface(mWnd, content);
}
targetSurface = mD2DWindowSurface;
if (!mD2DWindowSurface->CairoStatus()) {
targetSurface = mD2DWindowSurface;
} else {
mD2DWindowSurface = nsnull;
}
}
#endif
nsRefPtr<gfxWindowsSurface> targetSurfaceWin;
if (!targetSurface &&
(IsRenderMode(gfxWindowsPlatform::RENDER_GDI) ||
IsRenderMode(gfxWindowsPlatform::RENDER_DIRECT2D)))
{
PRUint32 flags = (mTransparencyMode == eTransparencyOpaque) ? 0 :
gfxWindowsSurface::FLAG_IS_TRANSPARENT;
targetSurfaceWin = new gfxWindowsSurface(hDC, flags);
targetSurface = targetSurfaceWin;
}
nsRefPtr<gfxImageSurface> targetSurfaceImage;
if (!targetSurface &&
(IsRenderMode(gfxWindowsPlatform::RENDER_IMAGE_STRETCH32) ||