2010-07-21 14:17:33 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 04:12:37 -07: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 14:17:33 -07:00
|
|
|
|
2013-04-24 11:42:40 -07:00
|
|
|
#include "LayerTransactionParent.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include <vector> // for vector
|
|
|
|
#include "CompositableHost.h" // for CompositableParent, Get, etc
|
|
|
|
#include "ImageLayers.h" // for ImageLayer
|
|
|
|
#include "Layers.h" // for Layer, ContainerLayer, etc
|
|
|
|
#include "ShadowLayerParent.h" // for ShadowLayerParent
|
|
|
|
#include "gfx3DMatrix.h" // for gfx3DMatrix
|
|
|
|
#include "gfxPoint3D.h" // for gfxPoint3D
|
|
|
|
#include "CompositableTransactionParent.h" // for EditReplyVector
|
|
|
|
#include "ShadowLayersManager.h" // for ShadowLayersManager
|
|
|
|
#include "mozilla/gfx/BasePoint3D.h" // for BasePoint3D
|
|
|
|
#include "mozilla/layers/CanvasLayerComposite.h"
|
2013-04-25 15:25:33 -07:00
|
|
|
#include "mozilla/layers/ColorLayerComposite.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/layers/Compositor.h" // for Compositor
|
2013-04-25 15:25:33 -07:00
|
|
|
#include "mozilla/layers/ContainerLayerComposite.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/layers/ImageLayerComposite.h"
|
|
|
|
#include "mozilla/layers/LayerManagerComposite.h"
|
2013-09-06 08:41:00 -07:00
|
|
|
#include "mozilla/layers/LayersMessages.h" // for EditReply, etc
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for PGrallocBufferParent
|
|
|
|
#include "mozilla/layers/LayersTypes.h" // for MOZ_LAYERS_LOG
|
|
|
|
#include "mozilla/layers/PCompositableParent.h"
|
|
|
|
#include "mozilla/layers/PLayerParent.h" // for PLayerParent
|
|
|
|
#include "mozilla/layers/ThebesLayerComposite.h"
|
|
|
|
#include "mozilla/mozalloc.h" // for operator delete, etc
|
|
|
|
#include "nsCoord.h" // for NSAppUnitsToFloatPixels
|
|
|
|
#include "nsDebug.h" // for NS_RUNTIMEABORT
|
2014-03-09 21:47:12 -07:00
|
|
|
#include "nsDeviceContext.h" // for AppUnitsPerCSSPixel
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "nsISupportsImpl.h" // for Layer::Release, etc
|
|
|
|
#include "nsLayoutUtils.h" // for nsLayoutUtils
|
|
|
|
#include "nsMathUtils.h" // for NS_round
|
|
|
|
#include "nsPoint.h" // for nsPoint
|
|
|
|
#include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc
|
2013-09-10 12:56:49 -07:00
|
|
|
#include "GeckoProfiler.h"
|
2013-12-11 17:44:44 -08:00
|
|
|
#include "mozilla/layers/TextureHost.h"
|
2014-02-10 20:01:20 -08:00
|
|
|
#include "mozilla/layers/AsyncCompositionManager.h"
|
2014-04-17 04:54:25 -07:00
|
|
|
#include "mozilla/layers/AsyncPanZoomController.h"
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
using mozilla::layout::RenderFrameParent;
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class PGrallocBufferParent;
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
//--------------------------------------------------
|
|
|
|
// Convenience accessors
|
|
|
|
static ShadowLayerParent*
|
|
|
|
cast(const PLayerParent* in)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
{
|
2010-07-21 14:17:33 -07:00
|
|
|
return const_cast<ShadowLayerParent*>(
|
|
|
|
static_cast<const ShadowLayerParent*>(in));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class OpCreateT>
|
|
|
|
static ShadowLayerParent*
|
2013-04-25 15:25:33 -07:00
|
|
|
AsLayerComposite(const OpCreateT& op)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
|
|
|
return cast(op.layerParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
2013-04-25 15:25:33 -07:00
|
|
|
AsLayerComposite(const OpSetRoot& op)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
|
|
|
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*
|
2014-02-24 06:41:55 -08:00
|
|
|
ShadowContainer(const OpPrependChild& op)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
2014-02-24 06:41:55 -08:00
|
|
|
ShadowChild(const OpPrependChild& op)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpRemoveChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpRemoveChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
|
2012-08-29 03:52:55 -07:00
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpRepositionChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpRepositionChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowAfter(const OpRepositionChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.afterParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpRaiseToTopChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpRaiseToTopChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
//--------------------------------------------------
|
2013-04-24 11:42:40 -07:00
|
|
|
// LayerTransactionParent
|
2013-04-25 15:25:33 -07:00
|
|
|
LayerTransactionParent::LayerTransactionParent(LayerManagerComposite* aManager,
|
2013-04-24 11:42:40 -07:00
|
|
|
ShadowLayersManager* aLayersManager,
|
|
|
|
uint64_t aId)
|
2012-07-17 16:59:45 -07:00
|
|
|
: mLayerManager(aManager)
|
|
|
|
, mShadowLayersManager(aLayersManager)
|
|
|
|
, mId(aId)
|
|
|
|
, mDestroyed(false)
|
2013-11-27 07:18:38 -08:00
|
|
|
, mIPCOpen(false)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
2013-04-24 11:42:40 -07:00
|
|
|
MOZ_COUNT_CTOR(LayerTransactionParent);
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2013-04-24 11:42:40 -07:00
|
|
|
LayerTransactionParent::~LayerTransactionParent()
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
2013-04-24 11:42:40 -07:00
|
|
|
MOZ_COUNT_DTOR(LayerTransactionParent);
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2011-01-05 20:54:47 -08:00
|
|
|
void
|
2013-04-24 11:42:40 -07:00
|
|
|
LayerTransactionParent::Destroy()
|
2011-01-05 20:54:47 -08:00
|
|
|
{
|
2011-01-12 12:13:41 -08:00
|
|
|
mDestroyed = true;
|
2011-01-05 20:54:47 -08:00
|
|
|
for (size_t i = 0; i < ManagedPLayerParent().Length(); ++i) {
|
|
|
|
ShadowLayerParent* slp =
|
|
|
|
static_cast<ShadowLayerParent*>(ManagedPLayerParent()[i]);
|
|
|
|
slp->Destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-07 13:34:04 -08:00
|
|
|
LayersBackend
|
|
|
|
LayerTransactionParent::GetCompositorBackendType() const
|
|
|
|
{
|
|
|
|
return mLayerManager->GetBackendType();
|
|
|
|
}
|
|
|
|
|
2012-05-01 12:23:39 -07:00
|
|
|
/* virtual */
|
|
|
|
bool
|
2013-04-24 11:42:40 -07:00
|
|
|
LayerTransactionParent::RecvUpdateNoSwap(const InfallibleTArray<Edit>& cset,
|
|
|
|
const TargetConfig& targetConfig,
|
2013-12-15 21:38:42 -08:00
|
|
|
const bool& isFirstPaint,
|
|
|
|
const bool& scheduleComposite)
|
2012-05-01 12:23:39 -07:00
|
|
|
{
|
2013-12-15 21:38:42 -08:00
|
|
|
return RecvUpdate(cset, targetConfig, isFirstPaint, scheduleComposite, nullptr);
|
2012-05-01 12:23:39 -07:00
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
bool
|
2013-04-24 11:42:40 -07:00
|
|
|
LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
|
|
|
const TargetConfig& targetConfig,
|
|
|
|
const bool& isFirstPaint,
|
2013-12-15 21:38:42 -08:00
|
|
|
const bool& scheduleComposite,
|
2013-04-24 11:42:40 -07:00
|
|
|
InfallibleTArray<EditReply>* reply)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
2013-09-27 09:08:45 -07:00
|
|
|
profiler_tracing("Paint", "Composite", TRACING_INTERVAL_START);
|
2013-09-10 12:56:49 -07:00
|
|
|
PROFILER_LABEL("LayerTransactionParent", "RecvUpdate");
|
2012-02-10 15:06:17 -08:00
|
|
|
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
|
|
|
TimeStamp updateStart = TimeStamp::Now();
|
|
|
|
#endif
|
|
|
|
|
2011-05-31 09:14:54 -07:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] received txn with %d edits", cset.Length()));
|
2010-07-21 14:17:33 -07:00
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
|
2010-12-27 06:48:00 -08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-11 15:19:01 -07:00
|
|
|
if (mLayerManager && mLayerManager->GetCompositor() &&
|
|
|
|
!targetConfig.naturalBounds().IsEmpty()) {
|
|
|
|
mLayerManager->GetCompositor()->SetScreenRotation(targetConfig.rotation());
|
|
|
|
}
|
|
|
|
|
2014-02-24 20:23:41 -08:00
|
|
|
// Clear fence handles used in previsou transaction.
|
|
|
|
ClearPrevFenceHandles();
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
EditReplyVector replyv;
|
|
|
|
|
2014-02-10 20:01:20 -08:00
|
|
|
{
|
2014-02-24 14:45:40 -08:00
|
|
|
AutoResolveRefLayers resolve(mShadowLayersManager->GetCompositionManager(this));
|
2014-02-10 20:01:20 -08:00
|
|
|
layer_manager()->BeginTransaction();
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
|
|
|
|
const Edit& edit = cset[i];
|
|
|
|
|
|
|
|
switch (edit.type()) {
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
// Create* ops
|
2010-07-21 14:17:33 -07:00
|
|
|
case Edit::TOpCreateThebesLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateThebesLayer"));
|
|
|
|
|
2013-04-25 15:25:33 -07:00
|
|
|
nsRefPtr<ThebesLayerComposite> layer =
|
|
|
|
layer_manager()->CreateThebesLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateThebesLayer())->Bind(layer);
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateContainerLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateContainerLayer"));
|
|
|
|
|
2013-04-25 15:25:33 -07:00
|
|
|
nsRefPtr<ContainerLayer> layer = layer_manager()->CreateContainerLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateContainerLayer())->Bind(layer);
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateImageLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateImageLayer"));
|
|
|
|
|
2013-04-25 15:25:33 -07:00
|
|
|
nsRefPtr<ImageLayerComposite> layer =
|
|
|
|
layer_manager()->CreateImageLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateImageLayer())->Bind(layer);
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateColorLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateColorLayer"));
|
|
|
|
|
2013-04-25 15:25:33 -07:00
|
|
|
nsRefPtr<ColorLayerComposite> layer = layer_manager()->CreateColorLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateColorLayer())->Bind(layer);
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateCanvasLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateCanvasLayer"));
|
|
|
|
|
2013-04-25 15:25:33 -07:00
|
|
|
nsRefPtr<CanvasLayerComposite> layer =
|
|
|
|
layer_manager()->CreateCanvasLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateCanvasLayer())->Bind(layer);
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
2012-07-17 16:59:45 -07:00
|
|
|
case Edit::TOpCreateRefLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateRefLayer"));
|
|
|
|
|
2013-04-25 15:25:33 -07:00
|
|
|
nsRefPtr<RefLayerComposite> layer =
|
|
|
|
layer_manager()->CreateRefLayerComposite();
|
|
|
|
AsLayerComposite(edit.get_OpCreateRefLayer())->Bind(layer);
|
2012-07-17 16:59:45 -07:00
|
|
|
break;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2013-03-21 10:08:01 -07:00
|
|
|
// Attributes
|
2010-07-21 14:17:33 -07:00
|
|
|
case Edit::TOpSetLayerAttributes: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] SetLayerAttributes"));
|
|
|
|
|
|
|
|
const OpSetLayerAttributes& osla = edit.get_OpSetLayerAttributes();
|
2014-02-20 08:40:55 -08:00
|
|
|
ShadowLayerParent* layerParent = AsLayerComposite(osla);
|
|
|
|
Layer* layer = layerParent->AsLayer();
|
2014-02-21 13:50:25 -08:00
|
|
|
if (!layer) {
|
|
|
|
return false;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
const LayerAttributes& attrs = osla.attrs();
|
|
|
|
|
|
|
|
const CommonLayerAttributes& common = attrs.common();
|
|
|
|
layer->SetVisibleRegion(common.visibleRegion());
|
2013-12-16 02:47:06 -08:00
|
|
|
layer->SetEventRegions(common.eventRegions());
|
2010-09-02 02:18:40 -07:00
|
|
|
layer->SetContentFlags(common.contentFlags());
|
2012-08-20 06:35:41 -07:00
|
|
|
layer->SetOpacity(common.opacity());
|
2013-07-20 01:48:55 -07:00
|
|
|
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : nullptr);
|
2012-07-31 10:28:20 -07:00
|
|
|
layer->SetBaseTransform(common.transform().value());
|
2012-08-03 14:29:22 -07:00
|
|
|
layer->SetPostScale(common.postXScale(), common.postYScale());
|
2012-12-23 07:47:16 -08:00
|
|
|
layer->SetIsFixedPosition(common.isFixedPosition());
|
|
|
|
layer->SetFixedPositionAnchor(common.fixedPositionAnchor());
|
2013-03-07 02:17:33 -08:00
|
|
|
layer->SetFixedPositionMargins(common.fixedPositionMargin());
|
2013-09-11 21:17:58 -07:00
|
|
|
if (common.isStickyPosition()) {
|
|
|
|
layer->SetStickyPositionData(common.stickyScrollContainerId(),
|
|
|
|
common.stickyScrollRangeOuter(),
|
|
|
|
common.stickyScrollRangeInner());
|
|
|
|
}
|
2013-12-12 10:34:50 -08:00
|
|
|
layer->SetScrollbarData(common.scrollbarTargetContainerId(),
|
|
|
|
static_cast<Layer::ScrollDirection>(common.scrollbarDirection()));
|
2012-03-18 16:02:38 -07:00
|
|
|
if (PLayerParent* maskLayer = common.maskLayerParent()) {
|
|
|
|
layer->SetMaskLayer(cast(maskLayer)->AsLayer());
|
|
|
|
} else {
|
2013-07-20 01:48:55 -07:00
|
|
|
layer->SetMaskLayer(nullptr);
|
2012-03-18 16:02:38 -07:00
|
|
|
}
|
2012-07-31 10:28:20 -07:00
|
|
|
layer->SetAnimations(common.animations());
|
2013-11-21 11:25:16 -08:00
|
|
|
layer->SetInvalidRegion(common.invalidRegion());
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
typedef SpecificLayerAttributes Specific;
|
|
|
|
const SpecificLayerAttributes& specific = attrs.specific();
|
|
|
|
switch (specific.type()) {
|
|
|
|
case Specific::Tnull_t:
|
|
|
|
break;
|
|
|
|
|
2010-09-03 13:10:46 -07:00
|
|
|
case Specific::TThebesLayerAttributes: {
|
2010-07-21 14:17:33 -07:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] thebes layer"));
|
|
|
|
|
2014-02-20 08:40:55 -08:00
|
|
|
ThebesLayerComposite* thebesLayer = layerParent->AsThebesLayerComposite();
|
|
|
|
if (!thebesLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
2010-09-03 13:10:46 -07:00
|
|
|
const ThebesLayerAttributes& attrs =
|
|
|
|
specific.get_ThebesLayerAttributes();
|
|
|
|
|
|
|
|
thebesLayer->SetValidRegion(attrs.validRegion());
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2010-09-03 13:10:46 -07:00
|
|
|
break;
|
|
|
|
}
|
2012-08-03 14:29:22 -07:00
|
|
|
case Specific::TContainerLayerAttributes: {
|
2010-09-03 13:10:45 -07:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] container layer"));
|
|
|
|
|
2014-02-20 08:40:55 -08:00
|
|
|
ContainerLayerComposite* containerLayer = layerParent->AsContainerLayerComposite();
|
|
|
|
if (!containerLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
2012-08-03 14:29:22 -07:00
|
|
|
const ContainerLayerAttributes& attrs =
|
|
|
|
specific.get_ContainerLayerAttributes();
|
|
|
|
containerLayer->SetFrameMetrics(attrs.metrics());
|
2014-04-11 16:39:21 -07:00
|
|
|
containerLayer->SetScrollHandoffParentId(attrs.scrollParentId());
|
2012-08-03 14:29:22 -07:00
|
|
|
containerLayer->SetPreScale(attrs.preXScale(), attrs.preYScale());
|
2013-01-08 01:39:12 -08:00
|
|
|
containerLayer->SetInheritedScale(attrs.inheritedXScale(), attrs.inheritedYScale());
|
2010-09-03 13:10:45 -07:00
|
|
|
break;
|
2012-08-03 14:29:22 -07:00
|
|
|
}
|
2014-02-20 08:40:55 -08:00
|
|
|
case Specific::TColorLayerAttributes: {
|
2010-07-21 14:17:33 -07:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] color layer"));
|
|
|
|
|
2014-02-20 08:40:55 -08:00
|
|
|
ColorLayerComposite* colorLayer = layerParent->AsColorLayerComposite();
|
|
|
|
if (!colorLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
colorLayer->SetColor(specific.get_ColorLayerAttributes().color().value());
|
|
|
|
colorLayer->SetBounds(specific.get_ColorLayerAttributes().bounds());
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
2014-02-20 08:40:55 -08:00
|
|
|
}
|
|
|
|
case Specific::TCanvasLayerAttributes: {
|
2010-07-21 14:17:33 -07:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] canvas layer"));
|
|
|
|
|
2014-02-20 08:40:55 -08:00
|
|
|
CanvasLayerComposite* canvasLayer = layerParent->AsCanvasLayerComposite();
|
|
|
|
if (!canvasLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
canvasLayer->SetFilter(specific.get_CanvasLayerAttributes().filter());
|
|
|
|
canvasLayer->SetBounds(specific.get_CanvasLayerAttributes().bounds());
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
2014-02-20 08:40:55 -08:00
|
|
|
}
|
|
|
|
case Specific::TRefLayerAttributes: {
|
2012-07-17 16:59:45 -07:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] ref layer"));
|
|
|
|
|
2014-02-20 08:40:55 -08:00
|
|
|
RefLayerComposite* refLayer = layerParent->AsRefLayerComposite();
|
|
|
|
if (!refLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
refLayer->SetReferentId(specific.get_RefLayerAttributes().id());
|
2012-07-17 16:59:45 -07:00
|
|
|
break;
|
2014-02-20 08:40:55 -08:00
|
|
|
}
|
2012-05-22 16:14:03 -07:00
|
|
|
case Specific::TImageLayerAttributes: {
|
2010-07-21 14:17:33 -07:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] image layer"));
|
|
|
|
|
2014-02-20 08:40:55 -08:00
|
|
|
ImageLayerComposite* imageLayer = layerParent->AsImageLayerComposite();
|
|
|
|
if (!imageLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
2012-05-22 16:14:03 -07:00
|
|
|
const ImageLayerAttributes& attrs = specific.get_ImageLayerAttributes();
|
|
|
|
imageLayer->SetFilter(attrs.filter());
|
2013-05-09 14:02:50 -07:00
|
|
|
imageLayer->SetScaleToSize(attrs.scaleToSize(), attrs.scaleMode());
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
2012-05-22 16:14:03 -07:00
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
default:
|
|
|
|
NS_RUNTIMEABORT("not reached");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2013-08-02 15:50:17 -07:00
|
|
|
case Edit::TOpSetDiagnosticTypes: {
|
|
|
|
mLayerManager->GetCompositor()->SetDiagnosticTypes(
|
|
|
|
edit.get_OpSetDiagnosticTypes().diagnostics());
|
2013-03-21 10:08:01 -07:00
|
|
|
break;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
// Tree ops
|
2010-07-21 14:17:33 -07:00
|
|
|
case Edit::TOpSetRoot: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] SetRoot"));
|
|
|
|
|
2014-02-20 12:05:08 -08:00
|
|
|
Layer* newRoot = AsLayerComposite(edit.get_OpSetRoot())->AsLayer();
|
2014-02-26 13:23:51 -08:00
|
|
|
if (!newRoot) {
|
|
|
|
return false;
|
|
|
|
}
|
2014-02-20 12:05:08 -08:00
|
|
|
if (newRoot->GetParent()) {
|
2014-02-26 13:23:51 -08:00
|
|
|
// newRoot is not a root!
|
2014-02-20 12:05:08 -08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
mRoot = newRoot;
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpInsertAfter: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] InsertAfter"));
|
|
|
|
|
|
|
|
const OpInsertAfter& oia = edit.get_OpInsertAfter();
|
2014-02-21 13:50:25 -08:00
|
|
|
Layer* child = ShadowChild(oia)->AsLayer();
|
|
|
|
if (!child) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayerComposite* container = ShadowContainer(oia)->AsContainerLayerComposite();
|
2014-02-21 13:50:25 -08:00
|
|
|
if (!container ||
|
|
|
|
!container->InsertAfter(child, ShadowAfter(oia)->AsLayer()))
|
|
|
|
{
|
2014-02-21 13:50:25 -08:00
|
|
|
return false;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
2014-02-24 06:41:55 -08:00
|
|
|
case Edit::TOpPrependChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] PrependChild"));
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2014-02-24 06:41:55 -08:00
|
|
|
const OpPrependChild& oac = edit.get_OpPrependChild();
|
2014-02-21 13:50:25 -08:00
|
|
|
Layer* child = ShadowChild(oac)->AsLayer();
|
|
|
|
if (!child) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayerComposite* container = ShadowContainer(oac)->AsContainerLayerComposite();
|
2014-02-21 13:50:25 -08:00
|
|
|
if (!container ||
|
|
|
|
!container->InsertAfter(child, nullptr))
|
|
|
|
{
|
2014-02-21 13:50:25 -08:00
|
|
|
return false;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpRemoveChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] RemoveChild"));
|
|
|
|
|
|
|
|
const OpRemoveChild& orc = edit.get_OpRemoveChild();
|
|
|
|
Layer* childLayer = ShadowChild(orc)->AsLayer();
|
2014-02-21 13:50:25 -08:00
|
|
|
if (!childLayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayerComposite* container = ShadowContainer(orc)->AsContainerLayerComposite();
|
2014-02-21 13:50:25 -08:00
|
|
|
if (!container ||
|
|
|
|
!container->RemoveChild(childLayer))
|
|
|
|
{
|
2014-02-21 13:50:25 -08:00
|
|
|
return false;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
2012-08-29 03:52:55 -07:00
|
|
|
case Edit::TOpRepositionChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] RepositionChild"));
|
|
|
|
|
|
|
|
const OpRepositionChild& orc = edit.get_OpRepositionChild();
|
2014-02-21 13:50:25 -08:00
|
|
|
Layer* child = ShadowChild(orc)->AsLayer();
|
|
|
|
if (!child) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayerComposite* container = ShadowContainer(orc)->AsContainerLayerComposite();
|
2014-02-21 13:50:25 -08:00
|
|
|
if (!container ||
|
|
|
|
!container->RepositionChild(child, ShadowAfter(orc)->AsLayer()))
|
|
|
|
{
|
2014-02-21 13:50:25 -08:00
|
|
|
return false;
|
|
|
|
}
|
2012-08-29 03:52:55 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpRaiseToTopChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] RaiseToTopChild"));
|
|
|
|
|
|
|
|
const OpRaiseToTopChild& rtc = edit.get_OpRaiseToTopChild();
|
2014-02-21 13:50:25 -08:00
|
|
|
Layer* child = ShadowChild(rtc)->AsLayer();
|
|
|
|
if (!child) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayerComposite* container = ShadowContainer(rtc)->AsContainerLayerComposite();
|
2014-02-21 13:50:25 -08:00
|
|
|
if (!container ||
|
|
|
|
!container->RepositionChild(child, nullptr))
|
|
|
|
{
|
2014-02-21 13:50:25 -08:00
|
|
|
return false;
|
|
|
|
}
|
2012-08-29 03:52:55 -07:00
|
|
|
break;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
case Edit::TCompositableOperation: {
|
2014-03-10 15:12:49 -07:00
|
|
|
if (!ReceiveCompositableUpdate(edit.get_CompositableOperation(),
|
|
|
|
replyv)) {
|
|
|
|
return false;
|
|
|
|
}
|
2012-04-13 08:17:39 -07:00
|
|
|
break;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
case Edit::TOpAttachCompositable: {
|
|
|
|
const OpAttachCompositable& op = edit.get_OpAttachCompositable();
|
2014-04-25 08:15:58 -07:00
|
|
|
CompositableHost* host = CompositableHost::FromIPDLActor(op.compositableParent());
|
|
|
|
if (!Attach(cast(op.layerParent()), host, false)) {
|
2014-02-21 13:50:25 -08:00
|
|
|
return false;
|
|
|
|
}
|
2014-04-25 08:15:58 -07:00
|
|
|
host->SetCompositorID(mLayerManager->GetCompositor()->GetCompositorID());
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
case Edit::TOpAttachAsyncCompositable: {
|
|
|
|
const OpAttachAsyncCompositable& op = edit.get_OpAttachAsyncCompositable();
|
2014-04-25 08:15:58 -07:00
|
|
|
PCompositableParent* compositableParent = CompositableMap::Get(op.containerID());
|
2014-04-23 07:46:50 -07:00
|
|
|
if (!compositableParent) {
|
|
|
|
NS_ERROR("CompositableParent not found in the map");
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-25 08:15:58 -07:00
|
|
|
CompositableHost* host = CompositableHost::FromIPDLActor(compositableParent);
|
|
|
|
if (!Attach(cast(op.layerParent()), host, true)) {
|
2014-02-21 13:50:25 -08:00
|
|
|
return false;
|
|
|
|
}
|
2014-04-25 08:15:58 -07:00
|
|
|
|
|
|
|
host->SetCompositorID(mLayerManager->GetCompositor()->GetCompositorID());
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
NS_RUNTIMEABORT("not reached");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-10 20:01:20 -08:00
|
|
|
{
|
2014-02-24 14:45:40 -08:00
|
|
|
AutoResolveRefLayers resolve(mShadowLayersManager->GetCompositionManager(this));
|
2014-02-10 20:01:20 -08:00
|
|
|
layer_manager()->EndTransaction(nullptr, nullptr, LayerManager::END_NO_IMMEDIATE_REDRAW);
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2013-03-22 12:22:20 -07:00
|
|
|
if (reply) {
|
|
|
|
reply->SetCapacity(replyv.size());
|
|
|
|
if (replyv.size() > 0) {
|
|
|
|
reply->AppendElements(&replyv.front(), replyv.size());
|
|
|
|
}
|
2010-07-21 16:13:24 -07:00
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
// Ensure that any pending operations involving back and front
|
|
|
|
// buffers have completed, so that neither process stomps on the
|
|
|
|
// other's buffer contents.
|
2013-04-25 15:25:33 -07:00
|
|
|
LayerManagerComposite::PlatformSyncBeforeReplyUpdate();
|
2010-09-13 22:23:08 -07:00
|
|
|
|
2013-12-15 21:38:42 -08:00
|
|
|
mShadowLayersManager->ShadowLayersUpdated(this, targetConfig, isFirstPaint, scheduleComposite);
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2012-02-10 15:06:17 -08:00
|
|
|
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
2012-03-19 04:55:37 -07: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 15:06:17 -08:00
|
|
|
#endif
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
return true;
|
2014-03-21 14:59:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvSetTestSampleTime(const TimeStamp& aTime)
|
|
|
|
{
|
|
|
|
return mShadowLayersManager->SetTestSampleTime(this, aTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvLeaveTestMode()
|
|
|
|
{
|
|
|
|
mShadowLayersManager->LeaveTestMode(this);
|
|
|
|
return true;
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2013-05-29 17:38:27 -07:00
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvGetOpacity(PLayerParent* aParent,
|
|
|
|
float* aOpacity)
|
|
|
|
{
|
|
|
|
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-21 13:50:25 -08:00
|
|
|
Layer* layer = cast(aParent)->AsLayer();
|
|
|
|
if (!layer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aOpacity = layer->GetLocalOpacity();
|
2013-05-29 17:38:27 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-03-09 21:47:12 -07:00
|
|
|
LayerTransactionParent::RecvGetAnimationTransform(PLayerParent* aParent,
|
|
|
|
MaybeTransform* aTransform)
|
2013-05-29 17:38:27 -07:00
|
|
|
{
|
|
|
|
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-05-30 17:45:17 -07:00
|
|
|
Layer* layer = cast(aParent)->AsLayer();
|
2014-02-21 13:50:25 -08:00
|
|
|
if (!layer) {
|
|
|
|
return false;
|
|
|
|
}
|
2014-03-09 21:47:12 -07:00
|
|
|
|
|
|
|
// This method is specific to transforms applied by animation.
|
|
|
|
// This is because this method uses the information stored with an animation
|
|
|
|
// such as the origin of the reference frame corresponding to the layer, to
|
|
|
|
// recover the untranslated transform from the shadow transform. For
|
|
|
|
// transforms that are not set by animation we don't have this information
|
|
|
|
// available.
|
|
|
|
if (!layer->AsLayerComposite()->GetShadowTransformSetByAnimation()) {
|
|
|
|
*aTransform = mozilla::void_t();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The following code recovers the untranslated transform
|
|
|
|
// from the shadow transform by undoing the translations in
|
|
|
|
// AsyncCompositionManager::SampleValue.
|
|
|
|
|
|
|
|
gfx3DMatrix transform;
|
|
|
|
gfx::To3DMatrix(layer->AsLayerComposite()->GetShadowTransform(), transform);
|
2013-05-31 11:06:57 -07:00
|
|
|
if (ContainerLayer* c = layer->AsContainerLayer()) {
|
2014-03-09 21:47:12 -07:00
|
|
|
// Undo the scale transform applied by AsyncCompositionManager::SampleValue
|
2014-03-09 21:47:12 -07:00
|
|
|
transform.ScalePost(1.0f/c->GetInheritedXScale(),
|
|
|
|
1.0f/c->GetInheritedYScale(),
|
|
|
|
1.0f);
|
2013-05-31 11:06:57 -07:00
|
|
|
}
|
2013-05-30 17:45:17 -07:00
|
|
|
float scale = 1;
|
|
|
|
gfxPoint3D scaledOrigin;
|
2013-10-24 05:46:00 -07:00
|
|
|
gfxPoint3D transformOrigin;
|
2013-05-30 17:45:17 -07:00
|
|
|
for (uint32_t i=0; i < layer->GetAnimations().Length(); i++) {
|
|
|
|
if (layer->GetAnimations()[i].data().type() == AnimationData::TTransformData) {
|
|
|
|
const TransformData& data = layer->GetAnimations()[i].data().get_TransformData();
|
|
|
|
scale = data.appUnitsPerDevPixel();
|
|
|
|
scaledOrigin =
|
|
|
|
gfxPoint3D(NS_round(NSAppUnitsToFloatPixels(data.origin().x, scale)),
|
|
|
|
NS_round(NSAppUnitsToFloatPixels(data.origin().y, scale)),
|
|
|
|
0.0f);
|
2014-03-09 21:47:12 -07:00
|
|
|
double cssPerDev =
|
|
|
|
double(nsDeviceContext::AppUnitsPerCSSPixel()) / double(scale);
|
|
|
|
transformOrigin = data.transformOrigin() * cssPerDev;
|
2013-05-30 17:45:17 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-09 21:47:12 -07:00
|
|
|
// Undo the translation to the origin of the reference frame applied by
|
|
|
|
// AsyncCompositionManager::SampleValue
|
2014-03-09 21:47:12 -07:00
|
|
|
transform.Translate(-scaledOrigin);
|
2014-03-09 21:47:12 -07:00
|
|
|
|
|
|
|
// Undo the rebasing applied by
|
|
|
|
// nsDisplayTransform::GetResultingTransformMatrixInternal
|
2014-03-09 21:47:12 -07:00
|
|
|
transform = nsLayoutUtils::ChangeMatrixBasis(-scaledOrigin - transformOrigin,
|
|
|
|
transform);
|
2014-03-09 21:47:12 -07:00
|
|
|
|
|
|
|
// Convert to CSS pixels (this undoes the operations performed by
|
|
|
|
// nsStyleTransformMatrix::ProcessTranslatePart which is called from
|
|
|
|
// nsDisplayTransform::GetResultingTransformMatrix)
|
|
|
|
double devPerCss =
|
|
|
|
double(scale) / double(nsDeviceContext::AppUnitsPerCSSPixel());
|
2014-03-09 21:47:12 -07:00
|
|
|
transform._41 *= devPerCss;
|
|
|
|
transform._42 *= devPerCss;
|
|
|
|
transform._43 *= devPerCss;
|
2014-03-09 21:47:12 -07:00
|
|
|
|
2014-03-09 21:47:12 -07:00
|
|
|
*aTransform = transform;
|
2013-05-29 17:38:27 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-02-14 00:59:23 -08:00
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvSetAsyncScrollOffset(PLayerParent* aLayer,
|
|
|
|
const int32_t& aX, const int32_t& aY)
|
|
|
|
{
|
|
|
|
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-04-23 07:42:40 -07:00
|
|
|
Layer* layer = cast(aLayer)->AsLayer();
|
2014-02-14 00:59:23 -08:00
|
|
|
if (!layer) {
|
2014-04-23 07:42:40 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ContainerLayer* containerLayer = layer->AsContainerLayer();
|
|
|
|
if (!containerLayer) {
|
|
|
|
return false;
|
2014-02-14 00:59:23 -08:00
|
|
|
}
|
2014-04-23 07:42:40 -07:00
|
|
|
AsyncPanZoomController* controller = containerLayer->GetAsyncPanZoomController();
|
2014-02-14 00:59:23 -08:00
|
|
|
if (!controller) {
|
2014-04-23 07:42:40 -07:00
|
|
|
return false;
|
2014-02-14 00:59:23 -08:00
|
|
|
}
|
|
|
|
controller->SetTestAsyncScrollOffset(CSSPoint(aX, aY));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-02-21 13:50:25 -08:00
|
|
|
bool
|
2013-08-20 18:28:53 -07:00
|
|
|
LayerTransactionParent::Attach(ShadowLayerParent* aLayerParent,
|
2014-04-25 08:15:58 -07:00
|
|
|
CompositableHost* aCompositable,
|
|
|
|
bool aIsAsync)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
{
|
2014-04-25 08:15:58 -07:00
|
|
|
if (!aCompositable) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-21 13:50:25 -08:00
|
|
|
Layer* baselayer = aLayerParent->AsLayer();
|
|
|
|
if (!baselayer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
LayerComposite* layer = baselayer->AsLayerComposite();
|
|
|
|
if (!layer) {
|
|
|
|
return false;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
Compositor* compositor
|
|
|
|
= static_cast<LayerManagerComposite*>(aLayerParent->AsLayer()->Manager())->GetCompositor();
|
|
|
|
|
2014-04-25 08:15:58 -07:00
|
|
|
if (!layer->SetCompositableHost(aCompositable)) {
|
2014-02-20 05:05:30 -08:00
|
|
|
// not all layer types accept a compositable, see bug 967824
|
2014-02-21 13:50:25 -08:00
|
|
|
return false;
|
2014-02-20 05:05:30 -08:00
|
|
|
}
|
2014-04-25 08:15:58 -07:00
|
|
|
aCompositable->Attach(aLayerParent->AsLayer(),
|
|
|
|
compositor,
|
|
|
|
aIsAsync
|
|
|
|
? CompositableHost::ALLOW_REATTACH
|
|
|
|
| CompositableHost::KEEP_ATTACHED
|
|
|
|
: CompositableHost::NO_FLAGS);
|
2014-02-21 13:50:25 -08:00
|
|
|
return true;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
2012-11-07 19:51:55 -08:00
|
|
|
bool
|
2013-04-24 11:42:40 -07:00
|
|
|
LayerTransactionParent::RecvClearCachedResources()
|
2012-11-07 19:51:55 -08:00
|
|
|
{
|
|
|
|
if (mRoot) {
|
|
|
|
// NB: |mRoot| here is the *child* context's root. In this parent
|
|
|
|
// context, it's just a subtree root. We need to scope the clear
|
|
|
|
// of resources to exactly that subtree, so we specify it here.
|
|
|
|
mLayerManager->ClearCachedResources(mRoot);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-02 16:59:58 -08:00
|
|
|
bool
|
|
|
|
LayerTransactionParent::RecvForceComposite()
|
|
|
|
{
|
|
|
|
mShadowLayersManager->ForceComposite(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-04-25 09:51:11 -07:00
|
|
|
|
|
|
|
PGrallocBufferParent*
|
|
|
|
LayerTransactionParent::AllocPGrallocBufferParent(const IntSize& aSize,
|
|
|
|
const uint32_t& aFormat,
|
|
|
|
const uint32_t& aUsage,
|
|
|
|
MaybeMagicGrallocBufferHandle* aOutHandle)
|
|
|
|
{
|
|
|
|
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
|
|
|
return GrallocBufferActor::Create(aSize, aFormat, aUsage, aOutHandle);
|
|
|
|
#else
|
|
|
|
NS_RUNTIMEABORT("No gralloc buffers for you");
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
LayerTransactionParent::DeallocPGrallocBufferParent(PGrallocBufferParent* actor)
|
|
|
|
{
|
|
|
|
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
|
|
|
delete actor;
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
NS_RUNTIMEABORT("Um, how did we get here?");
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
PLayerParent*
|
2013-07-08 08:48:39 -07:00
|
|
|
LayerTransactionParent::AllocPLayerParent()
|
2010-08-20 16:24:41 -07:00
|
|
|
{
|
|
|
|
return new ShadowLayerParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 08:48:39 -07:00
|
|
|
LayerTransactionParent::DeallocPLayerParent(PLayerParent* actor)
|
2010-08-20 16:24:41 -07:00
|
|
|
{
|
|
|
|
delete actor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
PCompositableParent*
|
2013-07-08 08:48:39 -07:00
|
|
|
LayerTransactionParent::AllocPCompositableParent(const TextureInfo& aInfo)
|
2011-09-27 15:19:26 -07:00
|
|
|
{
|
2014-04-25 08:15:58 -07:00
|
|
|
return CompositableHost::CreateIPDLActor(this, aInfo, 0);
|
2011-09-27 15:19:26 -07:00
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
bool
|
2014-04-25 08:15:58 -07:00
|
|
|
LayerTransactionParent::DeallocPCompositableParent(PCompositableParent* aActor)
|
2011-09-27 15:19:26 -07:00
|
|
|
{
|
2014-04-25 08:15:58 -07:00
|
|
|
return CompositableHost::DestroyIPDLActor(aActor);
|
2011-09-27 15:19:26 -07:00
|
|
|
}
|
|
|
|
|
2013-12-11 17:44:44 -08:00
|
|
|
PTextureParent*
|
2014-01-21 14:06:18 -08:00
|
|
|
LayerTransactionParent::AllocPTextureParent(const SurfaceDescriptor& aSharedData,
|
|
|
|
const TextureFlags& aFlags)
|
2013-12-11 17:44:44 -08:00
|
|
|
{
|
2014-01-21 14:06:18 -08:00
|
|
|
return TextureHost::CreateIPDLActor(this, aSharedData, aFlags);
|
2013-12-11 17:44:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
LayerTransactionParent::DeallocPTextureParent(PTextureParent* actor)
|
|
|
|
{
|
|
|
|
return TextureHost::DestroyIPDLActor(actor);
|
|
|
|
}
|
|
|
|
|
2014-02-25 05:12:49 -08:00
|
|
|
bool LayerTransactionParent::IsSameProcess() const
|
|
|
|
{
|
|
|
|
return OtherProcess() == ipc::kInvalidProcessHandle;
|
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|