зеркало из https://github.com/mozilla/gecko-dev.git
Make shadow layer transformations work.
This commit is contained in:
Родитель
c82eb64f48
Коммит
5e62d4fd13
|
@ -137,6 +137,7 @@ EXPORTS_mozilla/layers = \
|
||||||
ShadowLayers.h \
|
ShadowLayers.h \
|
||||||
ShadowLayersChild.h \
|
ShadowLayersChild.h \
|
||||||
ShadowLayersParent.h \
|
ShadowLayersParent.h \
|
||||||
|
ShadowLayersHost.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPPSRCS += \
|
CPPSRCS += \
|
||||||
|
|
|
@ -108,7 +108,7 @@ CompositorParent::AllocPLayers(const LayersBackend &backend, const WidgetDescrip
|
||||||
|
|
||||||
mLayerManager = layerManager;
|
mLayerManager = layerManager;
|
||||||
|
|
||||||
return new ShadowLayersParent(slm);
|
return new ShadowLayersParent(slm, this);
|
||||||
} else {
|
} else {
|
||||||
NS_ERROR("Unsupported backend selected for Async Compositor");
|
NS_ERROR("Unsupported backend selected for Async Compositor");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -42,13 +42,15 @@
|
||||||
|
|
||||||
#include "mozilla/layers/PCompositorParent.h"
|
#include "mozilla/layers/PCompositorParent.h"
|
||||||
#include "mozilla/layers/PLayersParent.h"
|
#include "mozilla/layers/PLayersParent.h"
|
||||||
|
#include "ShadowLayersHost.h"
|
||||||
|
|
||||||
class LayerManager;
|
class LayerManager;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
class CompositorParent : public PCompositorParent
|
class CompositorParent : public PCompositorParent,
|
||||||
|
public ShadowLayersHost
|
||||||
{
|
{
|
||||||
NS_INLINE_DECL_REFCOUNTING(CompositorParent)
|
NS_INLINE_DECL_REFCOUNTING(CompositorParent)
|
||||||
public:
|
public:
|
||||||
|
@ -57,6 +59,9 @@ public:
|
||||||
|
|
||||||
bool AnswerInit();
|
bool AnswerInit();
|
||||||
|
|
||||||
|
virtual mozilla::layout::RenderFrameParent* GetRenderFrameParent() { return NULL; }
|
||||||
|
virtual CompositorParent* GetCompositorParent() { return this; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual PLayersParent* AllocPLayers(const LayersBackend &backend, const WidgetDescriptor &widget);
|
virtual PLayersParent* AllocPLayers(const LayersBackend &backend, const WidgetDescriptor &widget);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Mozilla Content App.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* The Mozilla Foundation.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Ali Juma <ajuma@mozilla.com>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#ifndef mozilla_layers_ShadowLayersHost_h
|
||||||
|
#define mozilla_layers_ShadowLayersHost_h
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
namespace layout {
|
||||||
|
class RenderFrameParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace layers {
|
||||||
|
|
||||||
|
class CompositorParent;
|
||||||
|
|
||||||
|
class ShadowLayersHost
|
||||||
|
{
|
||||||
|
NS_INLINE_DECL_REFCOUNTING(ShadowLayersHost)
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual mozilla::layout::RenderFrameParent* GetRenderFrameParent() = 0;
|
||||||
|
virtual CompositorParent* GetCompositorParent() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // layers
|
||||||
|
} // mozilla
|
||||||
|
|
||||||
|
#endif // mozilla_layers_ShadowLayersHost_h
|
|
@ -121,11 +121,12 @@ ShadowChild(const OpRemoveChild& op)
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// ShadowLayersParent
|
// ShadowLayersParent
|
||||||
ShadowLayersParent::ShadowLayersParent(ShadowLayerManager* aManager)
|
ShadowLayersParent::ShadowLayersParent(ShadowLayerManager* aManager, ShadowLayersHost* aHost)
|
||||||
: mDestroyed(false)
|
: mDestroyed(false)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(ShadowLayersParent);
|
MOZ_COUNT_CTOR(ShadowLayersParent);
|
||||||
mLayerManager = aManager;
|
mLayerManager = aManager;
|
||||||
|
mHost = aHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShadowLayersParent::~ShadowLayersParent()
|
ShadowLayersParent::~ShadowLayersParent()
|
||||||
|
@ -219,6 +220,11 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||||
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
|
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
|
||||||
layer->SetTransform(common.transform());
|
layer->SetTransform(common.transform());
|
||||||
layer->SetTileSourceRect(common.useTileSourceRect() ? &common.tileSourceRect() : NULL);
|
layer->SetTileSourceRect(common.useTileSourceRect() ? &common.tileSourceRect() : NULL);
|
||||||
|
if (mHost->GetCompositorParent()) {
|
||||||
|
layer->AsShadowLayer()->SetShadowTransform(common.transform());
|
||||||
|
layer->AsShadowLayer()->SetShadowVisibleRegion(common.visibleRegion());
|
||||||
|
layer->AsShadowLayer()->SetShadowClipRect(layer->GetClipRect());
|
||||||
|
}
|
||||||
static bool fixedPositionLayersEnabled = getenv("MOZ_ENABLE_FIXED_POSITION_LAYERS") != 0;
|
static bool fixedPositionLayersEnabled = getenv("MOZ_ENABLE_FIXED_POSITION_LAYERS") != 0;
|
||||||
if (fixedPositionLayersEnabled) {
|
if (fixedPositionLayersEnabled) {
|
||||||
layer->SetIsFixedPosition(common.isFixedPosition());
|
layer->SetIsFixedPosition(common.isFixedPosition());
|
||||||
|
@ -406,9 +412,7 @@ ShadowLayersParent::DeallocPLayer(PLayerParent* actor)
|
||||||
RenderFrameParent*
|
RenderFrameParent*
|
||||||
ShadowLayersParent::Frame()
|
ShadowLayersParent::Frame()
|
||||||
{
|
{
|
||||||
// Fix me, gives: error: ‘Manager’ was not declared in this scope
|
return mHost->GetRenderFrameParent();
|
||||||
//return static_cast<RenderFrameParent*>(Manager());
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
#include "mozilla/layers/PLayersParent.h"
|
#include "mozilla/layers/PLayersParent.h"
|
||||||
#include "ShadowLayers.h"
|
#include "ShadowLayers.h"
|
||||||
|
#include "ShadowLayersHost.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ class ShadowLayersParent : public PLayersParent,
|
||||||
typedef InfallibleTArray<EditReply> EditReplyArray;
|
typedef InfallibleTArray<EditReply> EditReplyArray;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShadowLayersParent(ShadowLayerManager* aManager);
|
ShadowLayersParent(ShadowLayerManager* aManager, ShadowLayersHost* aHost);
|
||||||
~ShadowLayersParent();
|
~ShadowLayersParent();
|
||||||
|
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
@ -86,6 +87,7 @@ private:
|
||||||
RenderFrameParent* Frame();
|
RenderFrameParent* Frame();
|
||||||
|
|
||||||
nsRefPtr<ShadowLayerManager> mLayerManager;
|
nsRefPtr<ShadowLayerManager> mLayerManager;
|
||||||
|
nsRefPtr<ShadowLayersHost> mHost;
|
||||||
// Hold the root because it might be grafted under various
|
// Hold the root because it might be grafted under various
|
||||||
// containers in the "real" layer tree
|
// containers in the "real" layer tree
|
||||||
nsRefPtr<ContainerLayer> mRoot;
|
nsRefPtr<ContainerLayer> mRoot;
|
||||||
|
|
|
@ -800,7 +800,7 @@ LayerManagerOGL::Render()
|
||||||
|
|
||||||
mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
|
mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
|
||||||
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
|
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
|
||||||
|
/*
|
||||||
ShadowLayer *shadow = RootLayer()->GetLayer()->AsShadowLayer();
|
ShadowLayer *shadow = RootLayer()->GetLayer()->AsShadowLayer();
|
||||||
if (shadow) {
|
if (shadow) {
|
||||||
shadow->SetShadowVisibleRegion(nsIntRect(0, 0, width, height));
|
shadow->SetShadowVisibleRegion(nsIntRect(0, 0, width, height));
|
||||||
|
@ -814,7 +814,7 @@ LayerManagerOGL::Render()
|
||||||
child->AsShadowLayer()->SetShadowVisibleRegion(nsIntRect(0, 0, width, height));
|
child->AsShadowLayer()->SetShadowVisibleRegion(nsIntRect(0, 0, width, height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// Render our layers.
|
// Render our layers.
|
||||||
RootLayer()->RenderLayer(mGLContext->IsDoubleBuffered() ? 0 : mBackBufferFBO,
|
RootLayer()->RenderLayer(mGLContext->IsDoubleBuffered() ? 0 : mBackBufferFBO,
|
||||||
nsIntPoint(0, 0));
|
nsIntPoint(0, 0));
|
||||||
|
|
|
@ -648,7 +648,7 @@ RenderFrameParent::AllocPLayers(LayerManager::LayersBackend* aBackendType)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
*aBackendType = lm->GetBackendType();
|
*aBackendType = lm->GetBackendType();
|
||||||
return new ShadowLayersParent(slm);
|
return new ShadowLayersParent(slm, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#define mozilla_layout_RenderFrameParent_h
|
#define mozilla_layout_RenderFrameParent_h
|
||||||
|
|
||||||
#include "mozilla/layout/PRenderFrameParent.h"
|
#include "mozilla/layout/PRenderFrameParent.h"
|
||||||
|
#include "mozilla/layers/ShadowLayersHost.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "nsDisplayList.h"
|
#include "nsDisplayList.h"
|
||||||
|
@ -59,7 +60,8 @@ class ShadowLayersParent;
|
||||||
|
|
||||||
namespace layout {
|
namespace layout {
|
||||||
|
|
||||||
class RenderFrameParent : public PRenderFrameParent
|
class RenderFrameParent : public PRenderFrameParent,
|
||||||
|
public mozilla::layers::ShadowLayersHost
|
||||||
{
|
{
|
||||||
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
||||||
typedef mozilla::layers::ContainerLayer ContainerLayer;
|
typedef mozilla::layers::ContainerLayer ContainerLayer;
|
||||||
|
@ -100,6 +102,9 @@ public:
|
||||||
|
|
||||||
void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
|
void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
|
||||||
|
|
||||||
|
virtual RenderFrameParent* GetRenderFrameParent() { return this; }
|
||||||
|
virtual mozilla::layers::CompositorParent* GetCompositorParent() { return NULL; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NS_OVERRIDE void ActorDestroy(ActorDestroyReason why);
|
NS_OVERRIDE void ActorDestroy(ActorDestroyReason why);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче