Bug 1400407 - Part 3: Remove IsMirror concept, as it is no longer used by WebVR,r=jgilbert

- This patch is the same as one from Bug 1382104 (Remove IsMirror concept
  in favor of checking forwarder).
- It is safe to uplift this patch without the rest of Bug 1382104 as long
  as the remaining Bug 1381084 is also uplifted.

MozReview-Commit-ID: 21YZObeSUa3

--HG--
extra : rebase_source : 8d543fe69f4ac9df5ccdc42d3ce47bb37eea4396
This commit is contained in:
Kearwood "Kip" Gilbert 2017-08-28 14:50:14 -07:00
Родитель 7f6e715fdf
Коммит 6f85ed3a79
7 изменённых файлов: 10 добавлений и 32 удалений

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

@ -114,7 +114,6 @@ WebGLContext::WebGLContext()
, mBufferFetchingHasPerVertex(false)
, mMaxFetchedVertices(0)
, mMaxFetchedInstances(0)
, mLayerIsMirror(false)
, mBypassShaderValidation(false)
, mEmptyTFO(0)
, mContextLossHandler(this)
@ -1278,7 +1277,6 @@ WebGLContext::UpdateLastUseIndex()
}
static uint8_t gWebGLLayerUserData;
static uint8_t gWebGLMirrorLayerUserData;
class WebGLContextUserData : public LayerUserData
{
@ -1314,11 +1312,11 @@ private:
already_AddRefed<layers::Layer>
WebGLContext::GetCanvasLayer(nsDisplayListBuilder* builder,
Layer* oldLayer,
LayerManager* manager,
bool aMirror /*= false*/)
LayerManager* manager)
{
if (!mResetLayer && oldLayer &&
oldLayer->HasUserData(aMirror ? &gWebGLMirrorLayerUserData : &gWebGLLayerUserData)) {
oldLayer->HasUserData(&gWebGLLayerUserData))
{
RefPtr<layers::Layer> ret = oldLayer;
return ret.forget();
}
@ -1330,38 +1328,33 @@ WebGLContext::GetCanvasLayer(nsDisplayListBuilder* builder,
}
WebGLContextUserData* userData = nullptr;
if (builder->IsPaintingToWindow() && mCanvasElement && !aMirror) {
if (builder->IsPaintingToWindow() && mCanvasElement) {
userData = new WebGLContextUserData(mCanvasElement);
}
canvasLayer->SetUserData(aMirror ? &gWebGLMirrorLayerUserData : &gWebGLLayerUserData, userData);
canvasLayer->SetUserData(&gWebGLLayerUserData, userData);
CanvasRenderer* canvasRenderer = canvasLayer->CreateOrGetCanvasRenderer();
if (!InitializeCanvasRenderer(builder, canvasRenderer, aMirror))
if (!InitializeCanvasRenderer(builder, canvasRenderer))
return nullptr;
uint32_t flags = gl->Caps().alpha ? 0 : Layer::CONTENT_OPAQUE;
canvasLayer->SetContentFlags(flags);
mResetLayer = false;
// We only wish to update mLayerIsMirror when a new layer is returned.
// If a cached layer is returned above, aMirror is not changing since
// the last cached layer was created and mLayerIsMirror is still valid.
mLayerIsMirror = aMirror;
return canvasLayer.forget();
}
bool
WebGLContext::InitializeCanvasRenderer(nsDisplayListBuilder* aBuilder,
CanvasRenderer* aRenderer,
bool aMirror)
CanvasRenderer* aRenderer)
{
if (IsContextLost())
return false;
CanvasInitializeData data;
if (aBuilder->IsPaintingToWindow() && mCanvasElement && !aMirror) {
if (aBuilder->IsPaintingToWindow() && mCanvasElement) {
// Make the layer tell us whenever a transaction finishes (including
// the current transaction), so we can clear our invalidation state and
// start invalidating again. We need to do this for the layer that is
@ -1384,7 +1377,6 @@ WebGLContext::InitializeCanvasRenderer(nsDisplayListBuilder* aBuilder,
data.mSize = nsIntSize(mWidth, mHeight);
data.mHasAlpha = gl->Caps().alpha;
data.mIsGLAlphaPremult = IsPremultAlpha() || !data.mHasAlpha;
data.mIsMirror = aMirror;
aRenderer->Initialize(data);
aRenderer->SetDirty();
@ -2351,7 +2343,7 @@ WebGLContext::GetVRFrame()
return nullptr;
}
return sharedSurface.forget();
return sharedSurface.forget();
}
////////////////////////////////////////////////////////////////////////////////

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

@ -1435,7 +1435,6 @@ protected:
bool mInvalidated;
bool mCapturedFrameInvalidated;
bool mResetLayer;
bool mLayerIsMirror;
bool mOptionsFrozen;
bool mDisableExtensions;
bool mIsMesa;

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

@ -41,7 +41,6 @@ struct CanvasInitializeData {
, mSize(0,0)
, mHasAlpha(false)
, mIsGLAlphaPremult(true)
, mIsMirror(false)
{ }
// One of these three must be specified for Canvas2D, but never more than one
@ -66,10 +65,6 @@ struct CanvasInitializeData {
// Whether mGLContext contains data that is alpha-premultiplied.
bool mIsGLAlphaPremult;
// Whether the canvas front buffer is already being rendered somewhere else.
// When true, do not swap buffers or Morph() to another factory on mGLContext
bool mIsMirror;
};
// Based class which used for canvas rendering. There are many derived classes for

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

@ -39,7 +39,6 @@ CopyableCanvasRenderer::CopyableCanvasRenderer()
, mAsyncRenderer(nullptr)
, mIsAlphaPremultiplied(true)
, mOriginPos(gl::OriginPos::TopLeft)
, mIsMirror(false)
, mOpaque(true)
, mCachedTempSurface(nullptr)
{
@ -61,7 +60,6 @@ CopyableCanvasRenderer::Initialize(const CanvasInitializeData& aData)
mGLContext = aData.mGLContext;
mIsAlphaPremultiplied = aData.mIsGLAlphaPremult;
mOriginPos = gl::OriginPos::BottomLeft;
mIsMirror = aData.mIsMirror;
MOZ_ASSERT(mGLContext->IsOffscreen(), "canvas gl context isn't offscreen");

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

@ -62,7 +62,6 @@ protected:
bool mIsAlphaPremultiplied;
gl::OriginPos mOriginPos;
bool mIsMirror;
bool mOpaque;

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

@ -62,7 +62,7 @@ ShareableCanvasRenderer::Initialize(const CanvasInitializeData& aData)
UniquePtr<gl::SurfaceFactory> factory =
gl::GLScreenBuffer::CreateFactory(mGLContext, caps, forwarder, mFlags);
if (mGLFrontbuffer || aData.mIsMirror) {
if (mGLFrontbuffer) {
// We're using a source other than the one in the default screen.
// (SkiaGL)
mFactory = Move(factory);

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

@ -410,11 +410,6 @@ CanvasClientSharedSurface::UpdateRenderer(gfx::IntSize aSize, Renderer& aRendere
gfxCriticalError() << "Invalid canvas front buffer";
return;
}
} else if (canvasRenderer && canvasRenderer->mIsMirror) {
mShSurfClient = CloneSurface(gl->Screen()->Front()->Surf(), canvasRenderer->mFactory.get());
if (!mShSurfClient) {
return;
}
} else {
mShSurfClient = gl->Screen()->Front();
if (mShSurfClient && mShSurfClient->GetAllocator() &&