зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
0348123caf
Коммит
fbd3214a6c
|
@ -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;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче