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;
return nsnull;
}
LayerManager* lm = GetLayerManager();
switch (*aBackendType = 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: {
NS_WARNING("shadow layers no sprechen D3D backend yet");
*aBackendType = LayerManager::LAYERS_NONE;
return nsnull;
}
ShadowLayerManager* slm = lm->AsShadowManager();
if (!slm) {
NS_WARNING("shadow layers no sprechen D3D backend yet");
return nsnull;
}
*aBackendType = lm->GetBackendType();
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;
@ -542,10 +558,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);