mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 567966: Part 1: Properly handle siblings and children. Also fix missing release on container destructor. r=vlad
This commit is contained in:
parent
2409b23285
commit
44402345e3
@ -47,6 +47,18 @@ ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager)
|
||||
mImplData = static_cast<LayerD3D9*>(this);
|
||||
}
|
||||
|
||||
ContainerLayerD3D9::~ContainerLayerD3D9()
|
||||
{
|
||||
while (mFirstChild) {
|
||||
Layer* next = mFirstChild->GetNextSibling();
|
||||
mFirstChild->SetNextSibling(nsnull);
|
||||
mFirstChild->SetPrevSibling(nsnull);
|
||||
mFirstChild->SetParent(nsnull);
|
||||
NS_RELEASE(mFirstChild);
|
||||
mFirstChild = next;
|
||||
}
|
||||
}
|
||||
|
||||
const nsIntRect&
|
||||
ContainerLayerD3D9::GetVisibleRect()
|
||||
{
|
||||
@ -62,21 +74,28 @@ ContainerLayerD3D9::SetVisibleRegion(const nsIntRegion &aRegion)
|
||||
void
|
||||
ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter)
|
||||
{
|
||||
LayerD3D9 *newChild = static_cast<LayerD3D9*>(aChild->ImplData());
|
||||
aChild->SetParent(this);
|
||||
if (!aAfter) {
|
||||
LayerD3D9 *oldFirstChild = GetFirstChildD3D9();
|
||||
mFirstChild = newChild->GetLayer();
|
||||
newChild->SetNextSibling(oldFirstChild);
|
||||
Layer *oldFirstChild = GetFirstChild();
|
||||
mFirstChild = aChild;
|
||||
aChild->SetNextSibling(oldFirstChild);
|
||||
aChild->SetPrevSibling(nsnull);
|
||||
if (oldFirstChild) {
|
||||
oldFirstChild->SetPrevSibling(aChild);
|
||||
}
|
||||
NS_ADDREF(aChild);
|
||||
return;
|
||||
}
|
||||
for (LayerD3D9 *child = GetFirstChildD3D9();
|
||||
child; child = child->GetNextSibling()) {
|
||||
if (aAfter == child->GetLayer()) {
|
||||
LayerD3D9 *oldNextSibling = child->GetNextSibling();
|
||||
child->SetNextSibling(newChild);
|
||||
child->GetNextSibling()->SetNextSibling(oldNextSibling);
|
||||
for (Layer *child = GetFirstChild();
|
||||
child; child = child->GetNextSibling()) {
|
||||
if (aAfter == child) {
|
||||
Layer *oldNextSibling = child->GetNextSibling();
|
||||
child->SetNextSibling(aChild);
|
||||
aChild->SetNextSibling(oldNextSibling);
|
||||
if (oldNextSibling) {
|
||||
oldNextSibling->SetPrevSibling(aChild);
|
||||
}
|
||||
aChild->SetPrevSibling(child);
|
||||
NS_ADDREF(aChild);
|
||||
return;
|
||||
}
|
||||
@ -88,19 +107,26 @@ void
|
||||
ContainerLayerD3D9::RemoveChild(Layer *aChild)
|
||||
{
|
||||
if (GetFirstChild() == aChild) {
|
||||
mFirstChild = GetFirstChildD3D9()->GetNextSibling() ?
|
||||
GetFirstChildD3D9()->GetNextSibling()->GetLayer() : nsnull;
|
||||
mFirstChild = GetFirstChild()->GetNextSibling() ?
|
||||
GetFirstChild()->GetNextSibling() : nsnull;
|
||||
if (mFirstChild) {
|
||||
mFirstChild->SetPrevSibling(nsnull);
|
||||
}
|
||||
NS_RELEASE(aChild);
|
||||
return;
|
||||
}
|
||||
LayerD3D9 *lastChild = NULL;
|
||||
for (LayerD3D9 *child = GetFirstChildD3D9(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->GetLayer() == aChild) {
|
||||
Layer *lastChild = nsnull;
|
||||
for (Layer *child = GetFirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child == aChild) {
|
||||
// We're sure this is not our first child. So lastChild != NULL.
|
||||
lastChild->SetNextSibling(child->GetNextSibling());
|
||||
child->SetNextSibling(NULL);
|
||||
child->GetLayer()->SetParent(NULL);
|
||||
if (child->GetNextSibling()) {
|
||||
child->GetNextSibling()->SetPrevSibling(lastChild);
|
||||
}
|
||||
child->SetNextSibling(nsnull);
|
||||
child->SetPrevSibling(nsnull);
|
||||
child->SetParent(nsnull);
|
||||
NS_RELEASE(aChild);
|
||||
return;
|
||||
}
|
||||
@ -210,7 +236,10 @@ ContainerLayerD3D9::RenderLayer()
|
||||
device()->SetScissorRect(&r);
|
||||
|
||||
layerToRender->RenderLayer();
|
||||
layerToRender = layerToRender->GetNextSibling();
|
||||
Layer *nextSibling = layerToRender->GetLayer()->GetNextSibling();
|
||||
layerToRender = nextSibling ? static_cast<LayerD3D9*>(nextSibling->
|
||||
ImplData())
|
||||
: nsnull;
|
||||
}
|
||||
|
||||
if (useIntermediate) {
|
||||
|
@ -45,10 +45,11 @@ namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class ContainerLayerD3D9 : public ContainerLayer,
|
||||
public LayerD3D9
|
||||
public LayerD3D9
|
||||
{
|
||||
public:
|
||||
ContainerLayerD3D9(LayerManagerD3D9 *aManager);
|
||||
~ContainerLayerD3D9();
|
||||
|
||||
const nsIntRect &GetVisibleRect();
|
||||
|
||||
|
@ -100,6 +100,7 @@ class THEBES_API PlanarYCbCrImageD3D9 : public PlanarYCbCrImage,
|
||||
{
|
||||
public:
|
||||
PlanarYCbCrImageD3D9(LayerManagerD3D9 *aManager);
|
||||
~PlanarYCbCrImageD3D9() {}
|
||||
|
||||
virtual void SetData(const Data &aData);
|
||||
|
||||
|
@ -558,21 +558,8 @@ LayerManagerD3D9::VerifyCaps()
|
||||
|
||||
LayerD3D9::LayerD3D9(LayerManagerD3D9 *aManager)
|
||||
: mD3DManager(aManager)
|
||||
, mNextSibling(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
LayerD3D9*
|
||||
LayerD3D9::GetNextSibling()
|
||||
{
|
||||
return mNextSibling;
|
||||
}
|
||||
|
||||
void
|
||||
LayerD3D9::SetNextSibling(LayerD3D9 *aNextSibling)
|
||||
{
|
||||
mNextSibling = aNextSibling;
|
||||
}
|
||||
|
||||
} /* namespace layers */
|
||||
} /* namespace mozilla */
|
||||
|
@ -217,10 +217,8 @@ public:
|
||||
|
||||
virtual LayerType GetType() = 0;
|
||||
|
||||
LayerD3D9 *GetNextSibling();
|
||||
virtual LayerD3D9 *GetFirstChildD3D9() { return nsnull; }
|
||||
|
||||
void SetNextSibling(LayerD3D9 *aParent);
|
||||
void SetFirstChild(LayerD3D9 *aParent);
|
||||
|
||||
virtual Layer* GetLayer() = 0;
|
||||
@ -230,7 +228,6 @@ public:
|
||||
IDirect3DDevice9 *device() const { return mD3DManager->device(); }
|
||||
protected:
|
||||
LayerManagerD3D9 *mD3DManager;
|
||||
LayerD3D9 *mNextSibling;
|
||||
};
|
||||
|
||||
} /* layers */
|
||||
|
Loading…
Reference in New Issue
Block a user