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-13 22:43:43 -07:00
Родитель f2ff0bef7d
Коммит b7f2296045
3 изменённых файлов: 37 добавлений и 27 удалений

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

@ -721,29 +721,14 @@ RenderFrameParent::AllocPLayers(LayerManager::LayersBackend* aBackendType)
*aBackendType = LayerManager::LAYERS_NONE; *aBackendType = LayerManager::LAYERS_NONE;
return nsnull; return nsnull;
} }
LayerManager* lm = GetLayerManager(); LayerManager* lm = GetLayerManager();
switch (*aBackendType = lm->GetBackendType()) { ShadowLayerManager* slm = lm->AsShadowManager();
case LayerManager::LAYERS_BASIC: { if (!slm) {
BasicShadowLayerManager* bslm = static_cast<BasicShadowLayerManager*>(lm); NS_WARNING("shadow layers no sprechen D3D backend yet");
return new ShadowLayersParent(bslm); return nsnull;
}
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: {
NS_WARNING("shadow layers no sprechen D3D backend yet");
*aBackendType = LayerManager::LAYERS_NONE;
return nsnull;
}
} }
*aBackendType = lm->GetBackendType();
return new ShadowLayersParent(slm);
} }
bool bool

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

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

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

@ -40,6 +40,9 @@
#include "mozilla/dom/PBrowserChild.h" #include "mozilla/dom/PBrowserChild.h"
#include "BasicLayers.h" #include "BasicLayers.h"
#if defined(MOZ_ENABLE_D3D10_LAYER)
# include "LayerManagerD3D10.h"
#endif
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "PuppetWidget.h" #include "PuppetWidget.h"
@ -336,8 +339,21 @@ PuppetWidget::GetLayerManager(PLayersChild* aShadowManager,
bool* aAllowRetaining) bool* aAllowRetaining)
{ {
if (!mLayerManager) { if (!mLayerManager) {
mLayerManager = new BasicShadowLayerManager(this); // The backend hint is a temporary placeholder until Azure, when
mLayerManager->AsShadowForwarder()->SetShadowManager(aShadowManager); // 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) { if (aAllowRetaining) {
*aAllowRetaining = true; *aAllowRetaining = true;
@ -542,10 +558,15 @@ PuppetWidget::DispatchPaintEvent()
nsCAutoString("PuppetWidget"), nsnull); nsCAutoString("PuppetWidget"), nsnull);
#endif #endif
nsRefPtr<gfxContext> ctx = new gfxContext(mSurface); LayerManager* lm = GetLayerManager();
AutoLayerManagerSetup setupLayerManager(this, ctx, if (LayerManager::LAYERS_D3D10 == mLayerManager->GetBackendType()) {
BasicLayerManager::BUFFER_NONE); DispatchEvent(&event, status);
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); nsPaintEvent didPaintEvent(PR_TRUE, NS_DID_PAINT, this);