2010-07-21 21:17:33 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2010-07-21 21:17:33 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "ShadowLayersParent.h"
|
|
|
|
#include "ShadowLayerParent.h"
|
|
|
|
#include "ShadowLayers.h"
|
2012-02-17 22:05:03 +00:00
|
|
|
#include "RenderTrace.h"
|
2010-07-21 21:17:33 +00:00
|
|
|
|
|
|
|
#include "mozilla/unused.h"
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
#include "mozilla/layout/RenderFrameParent.h"
|
2011-12-19 18:17:29 +00:00
|
|
|
#include "CompositorParent.h"
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
#include "gfxSharedImageSurface.h"
|
|
|
|
|
2012-04-13 15:17:39 +00:00
|
|
|
#include "TiledLayerBuffer.h"
|
2010-07-21 21:17:33 +00:00
|
|
|
#include "ImageLayers.h"
|
|
|
|
|
|
|
|
typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
using mozilla::layout::RenderFrameParent;
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
//--------------------------------------------------
|
|
|
|
// Convenience accessors
|
|
|
|
static ShadowLayerParent*
|
|
|
|
cast(const PLayerParent* in)
|
|
|
|
{
|
|
|
|
return const_cast<ShadowLayerParent*>(
|
|
|
|
static_cast<const ShadowLayerParent*>(in));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class OpCreateT>
|
|
|
|
static ShadowLayerParent*
|
|
|
|
AsShadowLayer(const OpCreateT& op)
|
|
|
|
{
|
|
|
|
return cast(op.layerParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
AsShadowLayer(const OpSetRoot& op)
|
|
|
|
{
|
|
|
|
return cast(op.rootParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpInsertAfter& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpInsertAfter& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowAfter(const OpInsertAfter& op)
|
|
|
|
{
|
|
|
|
return cast(op.afterParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpAppendChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpAppendChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpRemoveChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpRemoveChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------
|
|
|
|
// ShadowLayersParent
|
2012-01-06 22:52:32 +00:00
|
|
|
ShadowLayersParent::ShadowLayersParent(ShadowLayerManager* aManager,
|
|
|
|
ShadowLayersManager* aLayersManager)
|
|
|
|
: mLayerManager(aManager), mShadowLayersManager(aLayersManager), mDestroyed(false)
|
2010-07-21 21:17:33 +00:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ShadowLayersParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
ShadowLayersParent::~ShadowLayersParent()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(ShadowLayersParent);
|
|
|
|
}
|
|
|
|
|
2011-01-06 04:54:47 +00:00
|
|
|
void
|
|
|
|
ShadowLayersParent::Destroy()
|
|
|
|
{
|
2011-01-12 20:13:41 +00:00
|
|
|
mDestroyed = true;
|
2011-01-06 04:54:47 +00:00
|
|
|
for (size_t i = 0; i < ManagedPLayerParent().Length(); ++i) {
|
|
|
|
ShadowLayerParent* slp =
|
|
|
|
static_cast<ShadowLayerParent*>(ManagedPLayerParent()[i]);
|
|
|
|
slp->Destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-01 19:23:39 +00:00
|
|
|
/* virtual */
|
|
|
|
bool
|
|
|
|
ShadowLayersParent::RecvUpdateNoSwap(const InfallibleTArray<Edit>& cset,
|
|
|
|
const bool& isFirstPaint)
|
|
|
|
{
|
|
|
|
InfallibleTArray<EditReply> noReplies;
|
|
|
|
bool success = RecvUpdate(cset, isFirstPaint, &noReplies);
|
|
|
|
NS_ABORT_IF_FALSE(noReplies.Length() == 0, "RecvUpdateNoSwap requires a sync Update to carry Edits");
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
bool
|
2010-11-09 02:49:00 +00:00
|
|
|
ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
2012-03-12 15:50:07 +00:00
|
|
|
const bool& isFirstPaint,
|
2010-11-09 02:49:00 +00:00
|
|
|
InfallibleTArray<EditReply>* reply)
|
2010-07-21 21:17:33 +00:00
|
|
|
{
|
2012-02-10 23:06:17 +00:00
|
|
|
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
|
|
|
TimeStamp updateStart = TimeStamp::Now();
|
|
|
|
#endif
|
|
|
|
|
2011-05-31 16:14:54 +00:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] received txn with %d edits", cset.Length()));
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2011-01-12 20:13:41 +00:00
|
|
|
if (mDestroyed || layer_manager()->IsDestroyed()) {
|
2010-12-27 14:48:00 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
EditReplyVector replyv;
|
|
|
|
|
|
|
|
layer_manager()->BeginTransactionWithTarget(NULL);
|
|
|
|
|
|
|
|
for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
|
|
|
|
const Edit& edit = cset[i];
|
|
|
|
|
|
|
|
switch (edit.type()) {
|
|
|
|
// Create* ops
|
|
|
|
case Edit::TOpCreateThebesLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateThebesLayer"));
|
|
|
|
|
2010-09-24 22:41:31 +00:00
|
|
|
nsRefPtr<ShadowThebesLayer> layer =
|
|
|
|
layer_manager()->CreateShadowThebesLayer();
|
2010-10-13 22:55:45 +00:00
|
|
|
layer->SetAllocator(this);
|
2010-07-21 21:17:33 +00:00
|
|
|
AsShadowLayer(edit.get_OpCreateThebesLayer())->Bind(layer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateContainerLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateContainerLayer"));
|
|
|
|
|
2010-10-13 22:55:45 +00:00
|
|
|
nsRefPtr<ContainerLayer> layer = layer_manager()->CreateShadowContainerLayer();
|
2010-07-21 21:17:33 +00:00
|
|
|
AsShadowLayer(edit.get_OpCreateContainerLayer())->Bind(layer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateImageLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateImageLayer"));
|
|
|
|
|
2010-09-24 22:41:31 +00:00
|
|
|
nsRefPtr<ShadowImageLayer> layer =
|
|
|
|
layer_manager()->CreateShadowImageLayer();
|
|
|
|
AsShadowLayer(edit.get_OpCreateImageLayer())->Bind(layer);
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateColorLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateColorLayer"));
|
|
|
|
|
2010-10-13 22:55:45 +00:00
|
|
|
nsRefPtr<ShadowColorLayer> layer = layer_manager()->CreateShadowColorLayer();
|
2010-07-21 21:17:33 +00:00
|
|
|
AsShadowLayer(edit.get_OpCreateColorLayer())->Bind(layer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateCanvasLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateCanvasLayer"));
|
|
|
|
|
2010-09-24 22:41:31 +00:00
|
|
|
nsRefPtr<ShadowCanvasLayer> layer =
|
|
|
|
layer_manager()->CreateShadowCanvasLayer();
|
2010-10-13 22:55:45 +00:00
|
|
|
layer->SetAllocator(this);
|
2010-07-21 21:17:33 +00:00
|
|
|
AsShadowLayer(edit.get_OpCreateCanvasLayer())->Bind(layer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Attributes
|
|
|
|
case Edit::TOpSetLayerAttributes: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] SetLayerAttributes"));
|
|
|
|
|
|
|
|
const OpSetLayerAttributes& osla = edit.get_OpSetLayerAttributes();
|
|
|
|
Layer* layer = AsShadowLayer(osla)->AsLayer();
|
|
|
|
const LayerAttributes& attrs = osla.attrs();
|
|
|
|
|
|
|
|
const CommonLayerAttributes& common = attrs.common();
|
|
|
|
layer->SetVisibleRegion(common.visibleRegion());
|
2010-09-02 09:18:40 +00:00
|
|
|
layer->SetContentFlags(common.contentFlags());
|
2010-07-21 21:17:33 +00:00
|
|
|
layer->SetOpacity(common.opacity());
|
|
|
|
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
|
|
|
|
layer->SetTransform(common.transform());
|
2011-05-12 16:49:33 +00:00
|
|
|
static bool fixedPositionLayersEnabled = getenv("MOZ_ENABLE_FIXED_POSITION_LAYERS") != 0;
|
|
|
|
if (fixedPositionLayersEnabled) {
|
|
|
|
layer->SetIsFixedPosition(common.isFixedPosition());
|
2012-06-27 15:43:57 +00:00
|
|
|
layer->SetFixedPositionAnchor(common.fixedPositionAnchor());
|
2011-05-12 16:49:33 +00:00
|
|
|
}
|
2012-03-18 23:02:38 +00:00
|
|
|
if (PLayerParent* maskLayer = common.maskLayerParent()) {
|
|
|
|
layer->SetMaskLayer(cast(maskLayer)->AsLayer());
|
|
|
|
} else {
|
|
|
|
layer->SetMaskLayer(NULL);
|
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
|
|
|
|
typedef SpecificLayerAttributes Specific;
|
|
|
|
const SpecificLayerAttributes& specific = attrs.specific();
|
|
|
|
switch (specific.type()) {
|
|
|
|
case Specific::Tnull_t:
|
|
|
|
break;
|
|
|
|
|
2010-09-03 20:10:46 +00:00
|
|
|
case Specific::TThebesLayerAttributes: {
|
2010-07-21 21:17:33 +00:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] thebes layer"));
|
|
|
|
|
2010-09-03 20:10:46 +00:00
|
|
|
ShadowThebesLayer* thebesLayer =
|
|
|
|
static_cast<ShadowThebesLayer*>(layer);
|
|
|
|
const ThebesLayerAttributes& attrs =
|
|
|
|
specific.get_ThebesLayerAttributes();
|
|
|
|
|
|
|
|
thebesLayer->SetValidRegion(attrs.validRegion());
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2010-09-03 20:10:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-09-03 20:10:45 +00:00
|
|
|
case Specific::TContainerLayerAttributes:
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] container layer"));
|
|
|
|
|
|
|
|
static_cast<ContainerLayer*>(layer)->SetFrameMetrics(
|
|
|
|
specific.get_ContainerLayerAttributes().metrics());
|
|
|
|
break;
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
case Specific::TColorLayerAttributes:
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] color layer"));
|
|
|
|
|
|
|
|
static_cast<ColorLayer*>(layer)->SetColor(
|
|
|
|
specific.get_ColorLayerAttributes().color());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Specific::TCanvasLayerAttributes:
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] canvas layer"));
|
|
|
|
|
|
|
|
static_cast<CanvasLayer*>(layer)->SetFilter(
|
|
|
|
specific.get_CanvasLayerAttributes().filter());
|
|
|
|
break;
|
|
|
|
|
2012-05-22 23:14:03 +00:00
|
|
|
case Specific::TImageLayerAttributes: {
|
2010-07-21 21:17:33 +00:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] image layer"));
|
|
|
|
|
2012-05-22 23:14:03 +00:00
|
|
|
ImageLayer* imageLayer = static_cast<ImageLayer*>(layer);
|
|
|
|
const ImageLayerAttributes& attrs = specific.get_ImageLayerAttributes();
|
|
|
|
imageLayer->SetFilter(attrs.filter());
|
|
|
|
imageLayer->SetForceSingleTile(attrs.forceSingleTile());
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
2012-05-22 23:14:03 +00:00
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
default:
|
|
|
|
NS_RUNTIMEABORT("not reached");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tree ops
|
|
|
|
case Edit::TOpSetRoot: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] SetRoot"));
|
|
|
|
|
2010-09-03 20:10:45 +00:00
|
|
|
mRoot = AsShadowLayer(edit.get_OpSetRoot())->AsContainer();
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpInsertAfter: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] InsertAfter"));
|
|
|
|
|
|
|
|
const OpInsertAfter& oia = edit.get_OpInsertAfter();
|
|
|
|
ShadowContainer(oia)->AsContainer()->InsertAfter(
|
|
|
|
ShadowChild(oia)->AsLayer(), ShadowAfter(oia)->AsLayer());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpAppendChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] AppendChild"));
|
|
|
|
|
|
|
|
const OpAppendChild& oac = edit.get_OpAppendChild();
|
|
|
|
ShadowContainer(oac)->AsContainer()->InsertAfter(
|
|
|
|
ShadowChild(oac)->AsLayer(), NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpRemoveChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] RemoveChild"));
|
|
|
|
|
|
|
|
const OpRemoveChild& orc = edit.get_OpRemoveChild();
|
|
|
|
Layer* childLayer = ShadowChild(orc)->AsLayer();
|
|
|
|
ShadowContainer(orc)->AsContainer()->RemoveChild(childLayer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-04-13 15:17:39 +00:00
|
|
|
case Edit::TOpPaintTiledLayerBuffer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint TiledLayerBuffer"));
|
|
|
|
const OpPaintTiledLayerBuffer& op = edit.get_OpPaintTiledLayerBuffer();
|
|
|
|
ShadowLayerParent* shadow = AsShadowLayer(op);
|
|
|
|
|
|
|
|
ShadowThebesLayer* shadowLayer = static_cast<ShadowThebesLayer*>(shadow->AsLayer());
|
|
|
|
TiledLayerComposer* tileComposer = shadowLayer->AsTiledLayerComposer();
|
|
|
|
|
|
|
|
NS_ASSERTION(tileComposer, "shadowLayer is not a tile composer");
|
|
|
|
|
|
|
|
BasicTiledLayerBuffer* p = (BasicTiledLayerBuffer*)op.tiledLayerBuffer();
|
|
|
|
tileComposer->PaintedTiledLayerBuffer(p);
|
|
|
|
break;
|
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
case Edit::TOpPaintThebesBuffer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint ThebesLayer"));
|
|
|
|
|
|
|
|
const OpPaintThebesBuffer& op = edit.get_OpPaintThebesBuffer();
|
|
|
|
ShadowLayerParent* shadow = AsShadowLayer(op);
|
|
|
|
ShadowThebesLayer* thebes =
|
|
|
|
static_cast<ShadowThebesLayer*>(shadow->AsLayer());
|
|
|
|
const ThebesBuffer& newFront = op.newFrontBuffer();
|
|
|
|
|
2012-02-24 16:35:04 +00:00
|
|
|
RenderTraceInvalidateStart(thebes, "FF00FF", op.updatedRegion().GetBounds());
|
2012-02-17 22:05:03 +00:00
|
|
|
|
2011-10-10 16:47:27 +00:00
|
|
|
OptionalThebesBuffer newBack;
|
2010-09-14 05:23:08 +00:00
|
|
|
nsIntRegion newValidRegion;
|
2010-11-05 07:17:07 +00:00
|
|
|
OptionalThebesBuffer readonlyFront;
|
|
|
|
nsIntRegion frontUpdatedRegion;
|
2010-09-14 05:23:08 +00:00
|
|
|
thebes->Swap(newFront, op.updatedRegion(),
|
2011-06-22 12:11:28 +00:00
|
|
|
&newBack, &newValidRegion,
|
2010-11-05 07:17:07 +00:00
|
|
|
&readonlyFront, &frontUpdatedRegion);
|
2010-09-14 05:23:08 +00:00
|
|
|
replyv.push_back(
|
|
|
|
OpThebesBufferSwap(
|
|
|
|
shadow, NULL,
|
2011-06-22 12:11:28 +00:00
|
|
|
newBack, newValidRegion,
|
2010-11-05 07:17:07 +00:00
|
|
|
readonlyFront, frontUpdatedRegion));
|
2012-02-17 22:05:03 +00:00
|
|
|
|
2012-02-24 16:35:04 +00:00
|
|
|
RenderTraceInvalidateEnd(thebes, "FF00FF");
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpPaintCanvas: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint CanvasLayer"));
|
|
|
|
|
|
|
|
const OpPaintCanvas& op = edit.get_OpPaintCanvas();
|
|
|
|
ShadowLayerParent* shadow = AsShadowLayer(op);
|
|
|
|
ShadowCanvasLayer* canvas =
|
|
|
|
static_cast<ShadowCanvasLayer*>(shadow->AsLayer());
|
|
|
|
|
2012-02-24 16:35:04 +00:00
|
|
|
RenderTraceInvalidateStart(canvas, "FF00FF", canvas->GetVisibleRegion().GetBounds());
|
2012-02-17 22:05:03 +00:00
|
|
|
|
2011-09-27 22:19:28 +00:00
|
|
|
canvas->SetAllocator(this);
|
|
|
|
CanvasSurface newBack;
|
|
|
|
canvas->Swap(op.newFrontBuffer(), op.needYFlip(), &newBack);
|
2011-03-27 23:59:46 +00:00
|
|
|
canvas->Updated();
|
2010-07-21 21:17:33 +00:00
|
|
|
replyv.push_back(OpBufferSwap(shadow, NULL,
|
2011-04-20 21:45:57 +00:00
|
|
|
newBack));
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2012-02-24 16:35:04 +00:00
|
|
|
RenderTraceInvalidateEnd(canvas, "FF00FF");
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpPaintImage: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint ImageLayer"));
|
|
|
|
|
|
|
|
const OpPaintImage& op = edit.get_OpPaintImage();
|
|
|
|
ShadowLayerParent* shadow = AsShadowLayer(op);
|
|
|
|
ShadowImageLayer* image =
|
|
|
|
static_cast<ShadowImageLayer*>(shadow->AsLayer());
|
|
|
|
|
2012-02-24 16:35:04 +00:00
|
|
|
RenderTraceInvalidateStart(image, "FF00FF", image->GetVisibleRegion().GetBounds());
|
|
|
|
|
2011-09-27 22:19:26 +00:00
|
|
|
image->SetAllocator(this);
|
2011-04-20 23:21:56 +00:00
|
|
|
SharedImage newBack;
|
2011-04-20 21:45:57 +00:00
|
|
|
image->Swap(op.newFrontBuffer(), &newBack);
|
2011-04-21 04:38:39 +00:00
|
|
|
replyv.push_back(OpImageSwap(shadow, NULL,
|
|
|
|
newBack));
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2012-02-24 16:35:04 +00:00
|
|
|
RenderTraceInvalidateEnd(image, "FF00FF");
|
2010-07-21 21:17:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
NS_RUNTIMEABORT("not reached");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-26 13:20:42 +00:00
|
|
|
layer_manager()->EndTransaction(NULL, NULL, LayerManager::END_NO_IMMEDIATE_REDRAW);
|
2010-07-21 21:17:33 +00:00
|
|
|
|
|
|
|
reply->SetCapacity(replyv.size());
|
2010-07-21 23:13:24 +00:00
|
|
|
if (replyv.size() > 0) {
|
|
|
|
reply->AppendElements(&replyv.front(), replyv.size());
|
|
|
|
}
|
2010-07-21 21:17:33 +00:00
|
|
|
|
2010-09-14 05:23:08 +00:00
|
|
|
// Ensure that any pending operations involving back and front
|
|
|
|
// buffers have completed, so that neither process stomps on the
|
|
|
|
// other's buffer contents.
|
|
|
|
ShadowLayerManager::PlatformSyncBeforeReplyUpdate();
|
|
|
|
|
2012-03-12 15:50:15 +00:00
|
|
|
mShadowLayersManager->ShadowLayersUpdated(isFirstPaint);
|
2010-08-20 23:24:41 +00:00
|
|
|
|
2012-02-10 23:06:17 +00:00
|
|
|
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
2012-03-19 11:55:37 +00:00
|
|
|
int compositeTime = (int)(mozilla::TimeStamp::Now() - updateStart).ToMilliseconds();
|
|
|
|
if (compositeTime > 15) {
|
|
|
|
printf_stderr("Compositor: Layers update took %i ms (blocking gecko).\n", compositeTime);
|
|
|
|
}
|
2012-02-10 23:06:17 +00:00
|
|
|
#endif
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-06-01 12:42:34 +00:00
|
|
|
bool
|
|
|
|
ShadowLayersParent::RecvDrawToSurface(const SurfaceDescriptor& surfaceIn,
|
|
|
|
SurfaceDescriptor* surfaceOut)
|
|
|
|
{
|
|
|
|
*surfaceOut = surfaceIn;
|
2012-06-01 12:42:36 +00:00
|
|
|
if (mDestroyed || layer_manager()->IsDestroyed()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRefPtr<gfxASurface> sharedSurface = ShadowLayerForwarder::OpenDescriptor(surfaceIn);
|
|
|
|
|
|
|
|
nsRefPtr<gfxASurface> localSurface =
|
|
|
|
gfxPlatform::GetPlatform()->CreateOffscreenSurface(sharedSurface->GetSize(),
|
|
|
|
sharedSurface->GetContentType());
|
|
|
|
nsRefPtr<gfxContext> context = new gfxContext(localSurface);
|
|
|
|
|
|
|
|
layer_manager()->BeginTransactionWithTarget(context);
|
|
|
|
layer_manager()->EndTransaction(NULL, NULL);
|
|
|
|
nsRefPtr<gfxContext> contextForCopy = new gfxContext(sharedSurface);
|
|
|
|
contextForCopy->SetOperator(gfxContext::OPERATOR_SOURCE);
|
|
|
|
contextForCopy->DrawSurface(localSurface, localSurface->GetSize());
|
2012-06-01 12:42:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-08-20 23:24:41 +00:00
|
|
|
PLayerParent*
|
|
|
|
ShadowLayersParent::AllocPLayer()
|
|
|
|
{
|
|
|
|
return new ShadowLayerParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ShadowLayersParent::DeallocPLayer(PLayerParent* actor)
|
|
|
|
{
|
|
|
|
delete actor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-09-27 22:19:26 +00:00
|
|
|
void
|
|
|
|
ShadowLayersParent::DestroySharedSurface(gfxSharedImageSurface* aSurface)
|
|
|
|
{
|
|
|
|
layer_manager()->DestroySharedSurface(aSurface, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayersParent::DestroySharedSurface(SurfaceDescriptor* aSurface)
|
|
|
|
{
|
|
|
|
layer_manager()->DestroySharedSurface(aSurface, this);
|
|
|
|
}
|
|
|
|
|
2010-07-21 21:17:33 +00:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|