Backed out changeset 96379f178485 (bug 947781)

This commit is contained in:
Ed Morley
2014-07-30 14:54:01 +01:00
parent 88d1088a98
commit 1be21e1760
8 changed files with 9 additions and 140 deletions

View File

@@ -15,8 +15,6 @@
#include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE
#include "nsRegion.h" // for nsIntRegion
#include "nsTArray.h" // for nsAutoTArray
#include "ReadbackProcessor.h"
#include "ClientThebesLayer.h"
namespace mozilla {
namespace layers {
@@ -57,20 +55,13 @@ public:
nsAutoTArray<Layer*, 12> children;
SortChildrenBy3DZOrder(children);
ReadbackProcessor readback;
readback.BuildUpdates(this);
for (uint32_t i = 0; i < children.Length(); i++) {
Layer* child = children.ElementAt(i);
if (child->GetEffectiveVisibleRegion().IsEmpty()) {
continue;
}
if (child->GetType() != TYPE_THEBES) {
ToClientLayer(child)->RenderLayer();
} else {
static_cast<ClientThebesLayer*>(child)->RenderLayer(&readback);
}
ToClientLayer(child)->RenderLayer();
if (!ClientManager()->GetRepeatTransaction() &&
!child->GetInvalidRegion().IsEmpty()) {

View File

@@ -21,7 +21,6 @@
#include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/TextureClientPool.h" // for TextureClientPool
#include "mozilla/layers/SimpleTextureClientPool.h" // for SimpleTextureClientPool
#include "ClientReadbackLayer.h" // for ClientReadbackLayer
#include "nsAString.h"
#include "nsIWidget.h" // for nsIWidget
#include "nsIWidgetListener.h"
@@ -117,13 +116,6 @@ ClientLayerManager::Mutated(Layer* aLayer)
mForwarder->Mutated(Hold(aLayer));
}
already_AddRefed<ReadbackLayer>
ClientLayerManager::CreateReadbackLayer()
{
nsRefPtr<ReadbackLayer> layer = new ClientReadbackLayer(this);
return layer.forget();
}
void
ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
{

View File

@@ -88,7 +88,6 @@ public:
virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
virtual already_AddRefed<ImageLayer> CreateImageLayer();
virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
virtual already_AddRefed<ColorLayer> CreateColorLayer();
virtual already_AddRefed<RefLayer> CreateRefLayer();

View File

@@ -1,33 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GFX_CLIENTREADBACKLAYER_H
#define GFX_CLIENTREADBACKLAYER_H
#include "ClientLayerManager.h"
#include "ReadbackLayer.h"
namespace mozilla {
namespace layers {
class ClientReadbackLayer :
public ReadbackLayer,
public ClientLayer
{
public:
ClientReadbackLayer(ClientLayerManager *aManager)
: ReadbackLayer(aManager, nullptr)
{
mImplData = static_cast<ClientLayer*>(this);
}
virtual Layer* AsLayer() { return this; }
virtual void RenderLayer() {}
};
} /* layers */
} /* mozilla */
#endif /* GFX_CLIENTREADBACKLAYER_H */

View File

@@ -24,7 +24,6 @@
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsRect.h" // for nsIntRect
#include "gfx2DGlue.h"
#include "ReadbackProcessor.h"
namespace mozilla {
namespace layers {
@@ -105,7 +104,7 @@ ClientThebesLayer::PaintThebes()
}
void
ClientThebesLayer::RenderLayer(ReadbackProcessor *aReadback)
ClientThebesLayer::RenderLayer()
{
if (GetMaskLayer()) {
ToClientLayer(GetMaskLayer())->RenderLayer();
@@ -121,16 +120,9 @@ ClientThebesLayer::RenderLayer(ReadbackProcessor *aReadback)
MOZ_ASSERT(mContentClient->GetForwarder());
}
nsTArray<ReadbackProcessor::Update> readbackUpdates;
nsIntRegion readbackRegion;
if (aReadback && UsedForReadback()) {
aReadback->GetThebesLayerUpdates(this, &readbackUpdates);
}
IntPoint origin(mVisibleRegion.GetBounds().x, mVisibleRegion.GetBounds().y);
mContentClient->BeginPaint();
PaintThebes();
mContentClient->EndPaint(&readbackUpdates);
mContentClient->EndPaint();
}
bool

View File

@@ -69,9 +69,7 @@ public:
mValidRegion.Sub(mValidRegion, mInvalidRegion);
}
virtual void RenderLayer() { RenderLayer(nullptr); }
virtual void RenderLayer(ReadbackProcessor *aReadback);
virtual void RenderLayer();
virtual void ClearCachedResources()
{

View File

@@ -37,10 +37,6 @@
#endif
#include "gfx2DGlue.h"
#include <vector>
using namespace std;
namespace mozilla {
using namespace gfx;
@@ -105,7 +101,7 @@ ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
}
void
ContentClient::EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates)
ContentClient::EndPaint()
{
// It is very important that this is called after any overridden EndPaint behaviour,
// because destroying textures is a three stage process:
@@ -161,64 +157,6 @@ ContentClientRemoteBuffer::DestroyBuffers()
DestroyFrontBuffer();
}
class RemoteBufferReadbackProcessor : public TextureReadbackSink
{
public:
RemoteBufferReadbackProcessor(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates,
const nsIntRect& aBufferRect, const nsIntPoint& aBufferRotation)
: mReadbackUpdates(*aReadbackUpdates)
, mBufferRect(aBufferRect)
, mBufferRotation(aBufferRotation)
{
for (uint32_t i = 0; i < mReadbackUpdates.Length(); ++i) {
mLayerRefs.push_back(mReadbackUpdates[i].mLayer);
}
}
virtual void ProcessReadback(gfx::DataSourceSurface *aSourceSurface)
{
SourceRotatedBuffer rotBuffer(aSourceSurface, nullptr, mBufferRect, mBufferRotation);
for (uint32_t i = 0; i < mReadbackUpdates.Length(); ++i) {
ReadbackProcessor::Update& update = mReadbackUpdates[i];
nsIntPoint offset = update.mLayer->GetBackgroundLayerOffset();
ReadbackSink* sink = update.mLayer->GetSink();
if (!sink) {
continue;
}
if (!aSourceSurface) {
sink->SetUnknown(update.mSequenceCounter);
continue;
}
nsRefPtr<gfxContext> ctx =
sink->BeginUpdate(update.mUpdateRect + offset, update.mSequenceCounter);
if (!ctx) {
continue;
}
DrawTarget* dt = ctx->GetDrawTarget();
dt->SetTransform(Matrix::Translation(offset.x, offset.y));
rotBuffer.DrawBufferWithRotation(dt, RotatedBuffer::BUFFER_BLACK);
update.mLayer->GetSink()->EndUpdate(ctx, update.mUpdateRect + offset);
}
}
private:
nsTArray<ReadbackProcessor::Update> mReadbackUpdates;
// This array is used to keep the layers alive until the callback.
vector<RefPtr<Layer>> mLayerRefs;
nsIntRect mBufferRect;
nsIntPoint mBufferRotation;
};
void
ContentClientRemoteBuffer::BeginPaint()
{
@@ -235,10 +173,8 @@ ContentClientRemoteBuffer::BeginPaint()
}
void
ContentClientRemoteBuffer::EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates)
ContentClientRemoteBuffer::EndPaint()
{
MOZ_ASSERT(!mTextureClientOnWhite || !aReadbackUpdates || aReadbackUpdates->Length() == 0);
// XXX: We might still not have a texture client if PaintThebes
// decided we didn't need one yet because the region to draw was empty.
SetBufferProvider(nullptr);
@@ -251,18 +187,12 @@ ContentClientRemoteBuffer::EndPaint(nsTArray<ReadbackProcessor::Update>* aReadba
mOldTextures.Clear();
if (mTextureClient && mTextureClient->IsLocked()) {
if (aReadbackUpdates->Length() > 0) {
RefPtr<TextureReadbackSink> readbackSink = new RemoteBufferReadbackProcessor(aReadbackUpdates, mBufferRect, mBufferRotation);
mTextureClient->SetReadbackSink(readbackSink);
}
mTextureClient->Unlock();
}
if (mTextureClientOnWhite && mTextureClientOnWhite->IsLocked()) {
mTextureClientOnWhite->Unlock();
}
ContentClientRemote::EndPaint(aReadbackUpdates);
ContentClientRemote::EndPaint();
}
void

View File

@@ -103,7 +103,7 @@ public:
// call before and after painting into this content client
virtual void BeginPaint() {}
virtual void EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates = nullptr);
virtual void EndPaint();
};
/**
@@ -231,7 +231,7 @@ public:
* are affected by mapping/unmapping.
*/
virtual void BeginPaint() MOZ_OVERRIDE;
virtual void EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates = nullptr) MOZ_OVERRIDE;
virtual void EndPaint() MOZ_OVERRIDE;
virtual void Updated(const nsIntRegion& aRegionToDraw,
const nsIntRegion& aVisibleRegion,