Bug 648484, part D: Allow PuppetWidgets to create D3D10 layer managers (for the time being). r=roc

This commit is contained in:
Chris Jones 2011-07-06 13:29:27 -04:00
Родитель 154d42025d
Коммит a25954ddcc
3 изменённых файлов: 34 добавлений и 24 удалений

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

@ -716,27 +716,12 @@ RenderFrameParent::ActorDestroy(ActorDestroyReason why)
PLayersParent*
RenderFrameParent::AllocPLayers()
{
LayerManager* lm = GetLayerManager();
switch (lm->GetBackendType()) {
case LayerManager::LAYERS_BASIC: {
BasicShadowLayerManager* bslm = static_cast<BasicShadowLayerManager*>(lm);
return new ShadowLayersParent(bslm);
}
case LayerManager::LAYERS_OPENGL: {
LayerManagerOGL* lmo = static_cast<LayerManagerOGL*>(lm);
return new ShadowLayersParent(lmo);
}
#ifdef MOZ_ENABLE_D3D9_LAYER
case LayerManager::LAYERS_D3D9: {
LayerManagerD3D9* lmd3d9 = static_cast<LayerManagerD3D9*>(lm);
return new ShadowLayersParent(lmd3d9);
}
#endif //MOZ_ENABLE_D3D9_LAYER
default: {
ShadowLayerManager* slm = GetLayerManager()->AsShadowManager();
if (!slm) {
NS_WARNING("shadow layers no sprechen D3D backend yet");
return nsnull;
}
}
return new ShadowLayersParent(slm);
}
bool

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

@ -97,6 +97,10 @@ ifdef MOZ_X11
SHARED_LIBRARY_LIBS += ../shared/x11/$(LIB_PREFIX)widget_shared_x11.$(LIB_SUFFIX)
endif
ifdef MOZ_ENABLE_D3D10_LAYER
DEFINES += -DMOZ_ENABLE_D3D10_LAYER
endif
LOCAL_INCLUDES += \
-I$(srcdir)/../$(MOZ_WIDGET_TOOLKIT) \
-I$(srcdir)/../shared \

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

@ -40,6 +40,9 @@
#include "mozilla/dom/PBrowserChild.h"
#include "BasicLayers.h"
#if defined(MOZ_ENABLE_D3D10_LAYER)
# include "LayerManagerD3D10.h"
#endif
#include "gfxPlatform.h"
#include "PuppetWidget.h"
@ -336,8 +339,21 @@ PuppetWidget::GetLayerManager(PLayersChild* aShadowManager,
bool* aAllowRetaining)
{
if (!mLayerManager) {
mLayerManager = new BasicShadowLayerManager(this);
mLayerManager->AsShadowForwarder()->SetShadowManager(aShadowManager);
// The backend hint is a temporary placeholder until Azure, when
// all content-process layer managers will be BasicLayerManagers.
#if defined(MOZ_ENABLE_D3D10_LAYER)
if (LayerManager::LAYERS_D3D10 == aBackendHint) {
nsRefPtr<LayerManagerD3D10> m = new LayerManagerD3D10(this);
m->AsShadowForwarder()->SetShadowManager(aShadowManager);
if (m->Initialize()) {
mLayerManager = m;
}
}
#endif
if (!mLayerManager) {
mLayerManager = new BasicShadowLayerManager(this);
mLayerManager->AsShadowForwarder()->SetShadowManager(aShadowManager);
}
}
if (aAllowRetaining) {
*aAllowRetaining = true;
@ -532,10 +548,15 @@ PuppetWidget::DispatchPaintEvent()
nsCAutoString("PuppetWidget"), nsnull);
#endif
nsRefPtr<gfxContext> ctx = new gfxContext(mSurface);
AutoLayerManagerSetup setupLayerManager(this, ctx,
BasicLayerManager::BUFFER_NONE);
DispatchEvent(&event, status);
LayerManager* lm = GetLayerManager();
if (LayerManager::LAYERS_D3D10 == mLayerManager->GetBackendType()) {
DispatchEvent(&event, status);
} else {
nsRefPtr<gfxContext> ctx = new gfxContext(mSurface);
AutoLayerManagerSetup setupLayerManager(this, ctx,
BasicLayerManager::BUFFER_NONE);
DispatchEvent(&event, status);
}
}
nsPaintEvent didPaintEvent(PR_TRUE, NS_DID_PAINT, this);