Bug 1296658: Attempt to create the correct BackendType buffers for a LayerManager. r=jrmuizel

MozReview-Commit-ID: 14Eg8FC6OpJ
This commit is contained in:
Bas Schouten 2016-09-15 13:53:12 +02:00
Родитель 77e2a32f4a
Коммит 62e1981ac7
4 изменённых файлов: 22 добавлений и 6 удалений

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

@ -137,7 +137,7 @@ BasicPaintedLayer::Validate(LayerManager::DrawPaintedLayerCallback aCallback,
if (!mContentClient) { if (!mContentClient) {
// This client will have a null Forwarder, which means it will not have // This client will have a null Forwarder, which means it will not have
// a ContentHost on the other side. // a ContentHost on the other side.
mContentClient = new ContentClientBasic(); mContentClient = new ContentClientBasic(mBackend);
} }
if (!BasicManager()->IsRetained()) { if (!BasicManager()->IsRetained()) {
@ -229,7 +229,16 @@ already_AddRefed<PaintedLayer>
BasicLayerManager::CreatePaintedLayer() BasicLayerManager::CreatePaintedLayer()
{ {
NS_ASSERTION(InConstruction(), "Only allowed in construction phase"); NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
RefPtr<PaintedLayer> layer = new BasicPaintedLayer(this);
BackendType backend = gfxPlatform::GetPlatform()->GetDefaultContentBackend();
if (mDefaultTarget) {
backend = mDefaultTarget->GetDrawTarget()->GetBackendType();
} else if (mType == BLM_WIDGET) {
backend = gfxPlatform::GetPlatform()->GetContentBackendFor(LayersBackend::LAYERS_BASIC);
}
RefPtr<PaintedLayer> layer = new BasicPaintedLayer(this, backend);
return layer.forget(); return layer.forget();
} }

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

@ -30,9 +30,10 @@ public:
typedef RotatedContentBuffer::PaintState PaintState; typedef RotatedContentBuffer::PaintState PaintState;
typedef RotatedContentBuffer::ContentType ContentType; typedef RotatedContentBuffer::ContentType ContentType;
explicit BasicPaintedLayer(BasicLayerManager* aLayerManager) : explicit BasicPaintedLayer(BasicLayerManager* aLayerManager, gfx::BackendType aBackend) :
PaintedLayer(aLayerManager, static_cast<BasicImplData*>(this)), PaintedLayer(aLayerManager, static_cast<BasicImplData*>(this)),
mContentClient(nullptr) mContentClient(nullptr)
, mBackend(aBackend)
{ {
MOZ_COUNT_CTOR(BasicPaintedLayer); MOZ_COUNT_CTOR(BasicPaintedLayer);
} }
@ -123,6 +124,7 @@ protected:
} }
RefPtr<ContentClientBasic> mContentClient; RefPtr<ContentClientBasic> mContentClient;
gfx::BackendType mBackend;
}; };
} // namespace layers } // namespace layers

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

@ -114,9 +114,10 @@ ContentClient::PrintInfo(std::stringstream& aStream, const char* aPrefix)
// We pass a null pointer for the ContentClient Forwarder argument, which means // We pass a null pointer for the ContentClient Forwarder argument, which means
// this client will not have a ContentHost on the other side. // this client will not have a ContentHost on the other side.
ContentClientBasic::ContentClientBasic() ContentClientBasic::ContentClientBasic(gfx::BackendType aBackend)
: ContentClient(nullptr) : ContentClient(nullptr)
, RotatedContentBuffer(ContainsVisibleBounds) , RotatedContentBuffer(ContainsVisibleBounds)
, mBackend(aBackend)
{} {}
void void
@ -131,7 +132,8 @@ ContentClientBasic::CreateBuffer(ContentType aType,
gfxDevCrash(LogReason::AlphaWithBasicClient) << "Asking basic content client for component alpha"; gfxDevCrash(LogReason::AlphaWithBasicClient) << "Asking basic content client for component alpha";
} }
*aBlackDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( *aBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForBackend(
mBackend,
IntSize(aRect.width, aRect.height), IntSize(aRect.width, aRect.height),
gfxPlatform::GetPlatform()->Optimal2DFormatForContent(aType)); gfxPlatform::GetPlatform()->Optimal2DFormatForContent(aType));
} }

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

@ -126,7 +126,7 @@ class ContentClientBasic final : public ContentClient
, protected RotatedContentBuffer , protected RotatedContentBuffer
{ {
public: public:
ContentClientBasic(); ContentClientBasic(gfx::BackendType aBackend);
typedef RotatedContentBuffer::PaintState PaintState; typedef RotatedContentBuffer::PaintState PaintState;
typedef RotatedContentBuffer::ContentType ContentType; typedef RotatedContentBuffer::ContentType ContentType;
@ -165,6 +165,9 @@ public:
{ {
MOZ_CRASH("GFX: Should not be called on non-remote ContentClient"); MOZ_CRASH("GFX: Should not be called on non-remote ContentClient");
} }
private:
gfx::BackendType mBackend;
}; };
/** /**