Bug 625672. Part 1.5: Make layer managers silently do nothing when ending a transaction with no root layer. r=bas,a=blocker

This commit is contained in:
Robert O'Callahan 2011-02-10 21:58:11 +13:00
Родитель 0348123caf
Коммит fbd3214a6c
5 изменённых файлов: 65 добавлений и 64 удалений

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

@ -348,7 +348,8 @@ public:
/**
* CONSTRUCTION PHASE ONLY
* Set the root layer.
* Set the root layer. The root layer is initially null. If there is
* no root layer, EndTransaction won't draw anything.
*/
virtual void SetRoot(Layer* aLayer) = 0;
/**

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

@ -1271,9 +1271,7 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
mTransactionIncomplete = false;
if (mTarget) {
NS_ASSERTION(mRoot, "Root not set");
if (mTarget && mRoot) {
nsRefPtr<gfxContext> finalTarget = mTarget;
gfxPoint cachedSurfaceOffset;

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

@ -286,16 +286,19 @@ void
LayerManagerD3D10::EndTransaction(DrawThebesLayerCallback aCallback,
void* aCallbackData)
{
mCurrentCallbackInfo.Callback = aCallback;
mCurrentCallbackInfo.CallbackData = aCallbackData;
if (mRoot) {
mCurrentCallbackInfo.Callback = aCallback;
mCurrentCallbackInfo.CallbackData = aCallbackData;
// The results of our drawing always go directly into a pixel buffer,
// so we don't need to pass any global transform here.
mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
// The results of our drawing always go directly into a pixel buffer,
// so we don't need to pass any global transform here.
mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
Render();
mCurrentCallbackInfo.Callback = nsnull;
mCurrentCallbackInfo.CallbackData = nsnull;
}
Render();
mCurrentCallbackInfo.Callback = nsnull;
mCurrentCallbackInfo.CallbackData = nsnull;
mTarget = nsnull;
}
@ -499,9 +502,7 @@ LayerManagerD3D10::VerifyBufferSize()
void
LayerManagerD3D10::Render()
{
if (mRoot) {
static_cast<LayerD3D10*>(mRoot->ImplData())->Validate();
}
static_cast<LayerD3D10*>(mRoot->ImplData())->Validate();
SetupPipeline();
@ -511,23 +512,21 @@ LayerManagerD3D10::Render()
nsIntRect rect;
mWidget->GetClientBounds(rect);
if (mRoot) {
const nsIntRect *clipRect = mRoot->GetClipRect();
D3D10_RECT r;
if (clipRect) {
r.left = (LONG)clipRect->x;
r.top = (LONG)clipRect->y;
r.right = (LONG)(clipRect->x + clipRect->width);
r.bottom = (LONG)(clipRect->y + clipRect->height);
} else {
r.left = r.top = 0;
r.right = rect.width;
r.bottom = rect.height;
}
device()->RSSetScissorRects(1, &r);
static_cast<LayerD3D10*>(mRoot->ImplData())->RenderLayer();
const nsIntRect *clipRect = mRoot->GetClipRect();
D3D10_RECT r;
if (clipRect) {
r.left = (LONG)clipRect->x;
r.top = (LONG)clipRect->y;
r.right = (LONG)(clipRect->x + clipRect->width);
r.bottom = (LONG)(clipRect->y + clipRect->height);
} else {
r.left = r.top = 0;
r.right = rect.width;
r.bottom = rect.height;
}
device()->RSSetScissorRects(1, &r);
static_cast<LayerD3D10*>(mRoot->ImplData())->RenderLayer();
if (mTarget) {
PaintToTarget();

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

@ -173,17 +173,20 @@ LayerManagerD3D9::EndTransaction(DrawThebesLayerCallback aCallback,
{
mDeviceResetCount = mDeviceManager->GetDeviceResetCount();
mCurrentCallbackInfo.Callback = aCallback;
mCurrentCallbackInfo.CallbackData = aCallbackData;
if (mRoot) {
mCurrentCallbackInfo.Callback = aCallback;
mCurrentCallbackInfo.CallbackData = aCallbackData;
// The results of our drawing always go directly into a pixel buffer,
// so we don't need to pass any global transform here.
mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
// The results of our drawing always go directly into a pixel buffer,
// so we don't need to pass any global transform here.
mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
Render();
/* Clean this out for sanity */
mCurrentCallbackInfo.Callback = NULL;
mCurrentCallbackInfo.CallbackData = NULL;
}
Render();
/* Clean this out for sanity */
mCurrentCallbackInfo.Callback = NULL;
mCurrentCallbackInfo.CallbackData = NULL;
// Clear mTarget, next transaction could have no target
mTarget = NULL;
}
@ -270,23 +273,21 @@ LayerManagerD3D9::Render()
device()->BeginScene();
if (mRoot) {
const nsIntRect *clipRect = mRoot->GetClipRect();
RECT r;
if (clipRect) {
r.left = (LONG)clipRect->x;
r.top = (LONG)clipRect->y;
r.right = (LONG)(clipRect->x + clipRect->width);
r.bottom = (LONG)(clipRect->y + clipRect->height);
} else {
r.left = r.top = 0;
r.right = rect.width;
r.bottom = rect.height;
}
device()->SetScissorRect(&r);
static_cast<LayerD3D9*>(mRoot->ImplData())->RenderLayer();
const nsIntRect *clipRect = mRoot->GetClipRect();
RECT r;
if (clipRect) {
r.left = (LONG)clipRect->x;
r.top = (LONG)clipRect->y;
r.right = (LONG)(clipRect->x + clipRect->width);
r.bottom = (LONG)(clipRect->y + clipRect->height);
} else {
r.left = r.top = 0;
r.right = rect.width;
r.bottom = rect.height;
}
device()->SetScissorRect(&r);
static_cast<LayerD3D9*>(mRoot->ImplData())->RenderLayer();
device()->EndScene();

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

@ -416,17 +416,19 @@ LayerManagerOGL::EndTransaction(DrawThebesLayerCallback aCallback,
return;
}
// The results of our drawing always go directly into a pixel buffer,
// so we don't need to pass any global transform here.
mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
if (mRoot) {
// The results of our drawing always go directly into a pixel buffer,
// so we don't need to pass any global transform here.
mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
mThebesLayerCallback = aCallback;
mThebesLayerCallbackData = aCallbackData;
mThebesLayerCallback = aCallback;
mThebesLayerCallbackData = aCallbackData;
Render();
Render();
mThebesLayerCallback = nsnull;
mThebesLayerCallbackData = nsnull;
mThebesLayerCallback = nsnull;
mThebesLayerCallbackData = nsnull;
}
mTarget = NULL;