Bug 648484, part B: Implement shadowable layer goop for D3D10, just enough to allow sending a window buffer to the compositor. r=Bas

This commit is contained in:
Chris Jones 2011-08-09 12:38:26 -07:00
Родитель 02a198c215
Коммит f4ee161e4c
2 изменённых файлов: 80 добавлений и 2 удалений

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

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -51,6 +51,7 @@
#include "CanvasLayerD3D10.h"
#include "ReadbackLayerD3D10.h"
#include "ImageLayerD3D10.h"
#include "mozilla/layers/PLayerChild.h"
#include "../d3d9/Nv3DVUtils.h"
@ -771,5 +772,42 @@ LayerD3D10::LayerD3D10(LayerManagerD3D10 *aManager)
{
}
WindowLayer::WindowLayer(LayerManagerD3D10* aManager)
: ThebesLayer(aManager, nsnull)
{
}
WindowLayer::~WindowLayer()
{
PLayerChild::Send__delete__(GetShadow());
}
DummyRoot::DummyRoot(LayerManagerD3D10* aManager)
: ContainerLayer(aManager, nsnull)
{
}
DummyRoot::~DummyRoot()
{
RemoveChild(nsnull);
PLayerChild::Send__delete__(GetShadow());
}
void
DummyRoot::InsertAfter(Layer* aLayer, Layer* aNull)
{
NS_ABORT_IF_FALSE(!mFirstChild && !aNull,
"Expect to append one child, once");
mFirstChild = nsRefPtr<Layer>(aLayer).forget().get();
}
void
DummyRoot::RemoveChild(Layer* aNull)
{
NS_ABORT_IF_FALSE(!aNull, "Unused argument should be null");
NS_IF_RELEASE(mFirstChild);
}
}
}

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

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -38,6 +38,7 @@
#ifndef GFX_LAYERMANAGERD3D10_H
#define GFX_LAYERMANAGERD3D10_H
#include "mozilla/layers/PLayers.h"
#include "mozilla/layers/ShadowLayers.h"
#include "Layers.h"
@ -52,6 +53,7 @@
namespace mozilla {
namespace layers {
class DummyRoot;
class Nv3DVUtils;
/**
@ -295,6 +297,44 @@ protected:
LayerManagerD3D10 *mD3DManager;
};
/**
* WindowLayer is a simple, special kinds of shadowable layer into
* which layer trees are rendered. It represents something like an OS
* window. It exists only to allow sharing textures with the
* compositor while reusing existing shadow-layer machinery.
*
* WindowLayer being implemented as a thebes layer isn't an important
* detail; other layer types could have been used.
*/
class WindowLayer : public ThebesLayer, public ShadowableLayer {
public:
WindowLayer(LayerManagerD3D10* aManager);
virtual ~WindowLayer();
void InvalidateRegion(const nsIntRegion&) {}
Layer* AsLayer() { return this; }
void SetShadow(PLayerChild* aChild) { mShadow = aChild; }
};
/**
* DummyRoot is the root of the shadowable layer tree created by
* remote content. It exists only to contain WindowLayers. It always
* has exactly one child WindowLayer.
*/
class DummyRoot : public ContainerLayer, public ShadowableLayer {
public:
DummyRoot(LayerManagerD3D10* aManager);
virtual ~DummyRoot();
void ComputeEffectiveTransforms(const gfx3DMatrix&) {}
void InsertAfter(Layer*, Layer*);
void RemoveChild(Layer*);
Layer* AsLayer() { return this; }
void SetShadow(PLayerChild* aChild) { mShadow = aChild; }
};
} /* layers */
} /* mozilla */