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 09:20:52 +00:00
|
|
|
/* -*- 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/. */
|
|
|
|
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "LayerManagerComposite.h"
|
|
|
|
#include <stddef.h> // for size_t
|
|
|
|
#include <stdint.h> // for uint16_t, uint32_t
|
|
|
|
#include "CanvasLayerComposite.h" // for CanvasLayerComposite
|
|
|
|
#include "ColorLayerComposite.h" // for ColorLayerComposite
|
|
|
|
#include "Composer2D.h" // for Composer2D
|
|
|
|
#include "CompositableHost.h" // for CompositableHost
|
|
|
|
#include "ContainerLayerComposite.h" // for ContainerLayerComposite, etc
|
2014-02-10 22:14:11 +00:00
|
|
|
#include "FPSCounter.h" // for FPSState, FPSCounter
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "FrameMetrics.h" // for FrameMetrics
|
2013-08-22 07:11:51 +00:00
|
|
|
#include "GeckoProfiler.h" // for profiler_set_frame_number, etc
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "ImageLayerComposite.h" // for ImageLayerComposite
|
|
|
|
#include "Layers.h" // for Layer, ContainerLayer, etc
|
2014-07-02 23:17:00 +00:00
|
|
|
#include "LayerScope.h" // for LayerScope Tool
|
2014-07-27 20:32:00 +00:00
|
|
|
#include "protobuf/LayerScopePacket.pb.h" // for protobuf (LayerScope)
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "ThebesLayerComposite.h" // for ThebesLayerComposite
|
|
|
|
#include "TiledLayerBuffer.h" // for TiledLayerComposer
|
|
|
|
#include "Units.h" // for ScreenIntRect
|
|
|
|
#include "gfx2DGlue.h" // for ToMatrix4x4
|
2014-02-27 02:53:31 +00:00
|
|
|
#include "gfxPrefs.h" // for gfxPrefs
|
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 09:20:52 +00:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
#include "gfxPlatformMac.h"
|
|
|
|
#endif
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "gfxRect.h" // for gfxRect
|
2014-05-08 20:49:01 +00:00
|
|
|
#include "gfxUtils.h" // for frame color util
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr, TemporaryRef
|
|
|
|
#include "mozilla/gfx/2D.h" // for DrawTarget
|
|
|
|
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
|
|
|
#include "mozilla/gfx/Point.h" // for IntSize, Point
|
|
|
|
#include "mozilla/gfx/Rect.h" // for Rect
|
|
|
|
#include "mozilla/gfx/Types.h" // for Color, SurfaceFormat
|
|
|
|
#include "mozilla/layers/Compositor.h" // for Compositor
|
|
|
|
#include "mozilla/layers/CompositorTypes.h"
|
|
|
|
#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc
|
2013-11-17 21:47:40 +00:00
|
|
|
#include "mozilla/layers/LayersTypes.h" // for etc
|
2014-05-21 17:29:49 +00:00
|
|
|
#include "ipc/CompositorBench.h" // for CompositorBench
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "ipc/ShadowLayerUtils.h"
|
|
|
|
#include "mozilla/mozalloc.h" // for operator new, etc
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
|
|
|
#include "nsDebug.h" // for NS_WARNING, NS_RUNTIMEABORT, etc
|
|
|
|
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
|
|
|
|
#include "nsIWidget.h" // for nsIWidget
|
|
|
|
#include "nsPoint.h" // for nsIntPoint
|
|
|
|
#include "nsRect.h" // for nsIntRect
|
|
|
|
#include "nsRegion.h" // for nsIntRegion, etc
|
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 09:20:52 +00:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
|
|
|
#include <android/log.h>
|
|
|
|
#endif
|
2013-09-10 19:56:49 +00:00
|
|
|
#include "GeckoProfiler.h"
|
2014-03-12 02:27:33 +00:00
|
|
|
#include "TextRenderer.h" // for TextRenderer
|
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 09:20:52 +00:00
|
|
|
|
2013-08-11 23:17:23 +00:00
|
|
|
class gfxContext;
|
|
|
|
struct nsIntSize;
|
|
|
|
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 23:17:23 +00:00
|
|
|
class ImageLayer;
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
using namespace mozilla::gfx;
|
2013-04-25 22:25:33 +00:00
|
|
|
using namespace mozilla::gl;
|
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 09:20:52 +00:00
|
|
|
|
|
|
|
static LayerComposite*
|
|
|
|
ToLayerComposite(Layer* aLayer)
|
|
|
|
{
|
|
|
|
return static_cast<LayerComposite*>(aLayer->ImplData());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ClearSubtree(Layer* aLayer)
|
|
|
|
{
|
|
|
|
ToLayerComposite(aLayer)->CleanupResources();
|
|
|
|
for (Layer* child = aLayer->GetFirstChild(); child;
|
|
|
|
child = child->GetNextSibling()) {
|
|
|
|
ClearSubtree(child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LayerManagerComposite::ClearCachedResources(Layer* aSubtree)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(!aSubtree || aSubtree->Manager() == this);
|
|
|
|
Layer* subtree = aSubtree ? aSubtree : mRoot.get();
|
|
|
|
if (!subtree) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ClearSubtree(subtree);
|
|
|
|
// FIXME [bjacob]
|
|
|
|
// XXX the old LayerManagerOGL code had a mMaybeInvalidTree that it set to true here.
|
|
|
|
// Do we need that?
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LayerManagerComposite
|
|
|
|
*/
|
|
|
|
LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor)
|
2013-04-25 22:25:33 +00:00
|
|
|
: mCompositor(aCompositor)
|
2013-11-21 22:07:57 +00:00
|
|
|
, mInTransaction(false)
|
|
|
|
, mIsCompositorReady(false)
|
2013-12-03 15:49:46 +00:00
|
|
|
, mDebugOverlayWantsNextFrame(false)
|
2014-04-04 01:59:13 +00:00
|
|
|
, mGeometryChanged(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 09:20:52 +00:00
|
|
|
{
|
2014-03-12 02:27:30 +00:00
|
|
|
mTextRenderer = new TextRenderer(aCompositor);
|
2013-08-04 07:46:17 +00:00
|
|
|
MOZ_ASSERT(aCompositor);
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
LayerManagerComposite::~LayerManagerComposite()
|
|
|
|
{
|
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
bool
|
|
|
|
LayerManagerComposite::Initialize()
|
|
|
|
{
|
2013-06-05 22:14:51 +00:00
|
|
|
bool result = mCompositor->Initialize();
|
|
|
|
return result;
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LayerManagerComposite::Destroy()
|
|
|
|
{
|
|
|
|
if (!mDestroyed) {
|
2013-04-22 02:40:51 +00:00
|
|
|
mCompositor->GetWidget()->CleanupWindowEffects();
|
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 09:20:52 +00:00
|
|
|
if (mRoot) {
|
|
|
|
RootLayer()->Destroy();
|
|
|
|
}
|
|
|
|
mRoot = nullptr;
|
|
|
|
mDestroyed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LayerManagerComposite::UpdateRenderBounds(const nsIntRect& aRect)
|
|
|
|
{
|
|
|
|
mRenderBounds = aRect;
|
|
|
|
}
|
|
|
|
|
2014-07-18 06:48:23 +00:00
|
|
|
bool
|
|
|
|
LayerManagerComposite::AreComponentAlphaLayersEnabled()
|
|
|
|
{
|
|
|
|
return Compositor::GetBackend() != LayersBackend::LAYERS_BASIC &&
|
|
|
|
LayerManager::AreComponentAlphaLayersEnabled();
|
|
|
|
}
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
void
|
|
|
|
LayerManagerComposite::BeginTransaction()
|
|
|
|
{
|
|
|
|
mInTransaction = true;
|
2013-11-21 22:07:57 +00:00
|
|
|
|
|
|
|
if (!mCompositor->Ready()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mIsCompositorReady = true;
|
|
|
|
|
2014-04-04 01:59:13 +00:00
|
|
|
if (Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL ||
|
|
|
|
Compositor::GetBackend() == LayersBackend::LAYERS_BASIC) {
|
2013-11-21 19:25:16 +00:00
|
|
|
mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot());
|
|
|
|
}
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-05-28 01:21:32 +00:00
|
|
|
LayerManagerComposite::BeginTransactionWithDrawTarget(DrawTarget* aTarget, const nsIntRect& aRect)
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
mInTransaction = true;
|
2013-11-21 22:07:57 +00:00
|
|
|
|
|
|
|
if (!mCompositor->Ready()) {
|
|
|
|
return;
|
|
|
|
}
|
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 09:20:52 +00:00
|
|
|
|
|
|
|
#ifdef MOZ_LAYERS_HAVE_LOG
|
|
|
|
MOZ_LAYERS_LOG(("[----- BeginTransaction"));
|
|
|
|
Log();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-11-21 22:07:57 +00:00
|
|
|
mIsCompositorReady = true;
|
2014-05-28 01:21:32 +00:00
|
|
|
mCompositor->SetTargetContext(aTarget, aRect);
|
2014-03-04 22:36:52 +00:00
|
|
|
mTarget = aTarget;
|
2014-05-28 01:21:32 +00:00
|
|
|
mTargetBounds = aRect;
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
LayerManagerComposite::EndEmptyTransaction(EndTransactionFlags aFlags)
|
|
|
|
{
|
2013-11-20 07:27:23 +00:00
|
|
|
NS_ASSERTION(mInTransaction, "Didn't call BeginTransaction?");
|
|
|
|
if (!mRoot) {
|
|
|
|
mInTransaction = false;
|
2013-11-21 22:07:57 +00:00
|
|
|
mIsCompositorReady = 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 09:20:52 +00:00
|
|
|
return false;
|
2013-11-20 07:27:23 +00: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 09:20:52 +00:00
|
|
|
|
|
|
|
EndTransaction(nullptr, nullptr);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback,
|
|
|
|
void* aCallbackData,
|
|
|
|
EndTransactionFlags aFlags)
|
|
|
|
{
|
2013-11-20 07:27:23 +00:00
|
|
|
NS_ASSERTION(mInTransaction, "Didn't call BeginTransaction?");
|
2013-12-09 01:40:59 +00:00
|
|
|
NS_ASSERTION(!aCallback && !aCallbackData, "Not expecting callbacks here");
|
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 09:20:52 +00:00
|
|
|
mInTransaction = false;
|
|
|
|
|
2013-11-21 22:07:57 +00:00
|
|
|
if (!mIsCompositorReady) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mIsCompositorReady = 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 09:20:52 +00:00
|
|
|
#ifdef MOZ_LAYERS_HAVE_LOG
|
|
|
|
MOZ_LAYERS_LOG((" ----- (beginning paint)"));
|
|
|
|
Log();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-11-21 19:25:16 +00:00
|
|
|
if (mRoot && mClonedLayerTreeProperties) {
|
2014-05-28 01:21:32 +00:00
|
|
|
MOZ_ASSERT(!mTarget);
|
2014-04-04 01:59:13 +00:00
|
|
|
nsIntRegion invalid =
|
|
|
|
mClonedLayerTreeProperties->ComputeDifferences(mRoot, nullptr, &mGeometryChanged);
|
2013-11-21 19:25:16 +00:00
|
|
|
mClonedLayerTreeProperties = nullptr;
|
|
|
|
|
|
|
|
mInvalidRegion.Or(mInvalidRegion, invalid);
|
2014-05-28 01:21:32 +00:00
|
|
|
} else if (!mTarget) {
|
2013-11-21 19:25:16 +00:00
|
|
|
mInvalidRegion.Or(mInvalidRegion, mRenderBounds);
|
|
|
|
}
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
if (mRoot && !(aFlags & END_NO_IMMEDIATE_REDRAW)) {
|
|
|
|
if (aFlags & END_NO_COMPOSITE) {
|
|
|
|
// Apply pending tree updates before recomputing effective
|
|
|
|
// properties.
|
|
|
|
mRoot->ApplyPendingUpdatesToSubtree();
|
|
|
|
}
|
|
|
|
|
|
|
|
// The results of our drawing always go directly into a pixel buffer,
|
|
|
|
// so we don't need to pass any global transform here.
|
2014-01-27 15:28:04 +00:00
|
|
|
mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4());
|
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 09:20:52 +00:00
|
|
|
|
|
|
|
Render();
|
2014-04-04 01:59:13 +00:00
|
|
|
mGeometryChanged = false;
|
2014-07-07 19:58:26 +00:00
|
|
|
} else {
|
|
|
|
// Modified layer tree
|
|
|
|
mGeometryChanged = 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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
2014-05-28 01:21:32 +00:00
|
|
|
mCompositor->ClearTargetContext();
|
2014-03-04 22:36:52 +00:00
|
|
|
mTarget = nullptr;
|
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 09:20:52 +00:00
|
|
|
|
|
|
|
#ifdef MOZ_LAYERS_HAVE_LOG
|
|
|
|
Log();
|
|
|
|
MOZ_LAYERS_LOG(("]----- EndTransaction"));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-04-10 08:49:49 +00:00
|
|
|
TemporaryRef<DrawTarget>
|
|
|
|
LayerManagerComposite::CreateOptimalMaskDrawTarget(const IntSize &aSize)
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Should only be called on the drawing side");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<ThebesLayer>
|
|
|
|
LayerManagerComposite::CreateThebesLayer()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Should only be called on the drawing side");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<ContainerLayer>
|
|
|
|
LayerManagerComposite::CreateContainerLayer()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Should only be called on the drawing side");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<ImageLayer>
|
|
|
|
LayerManagerComposite::CreateImageLayer()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Should only be called on the drawing side");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<ColorLayer>
|
|
|
|
LayerManagerComposite::CreateColorLayer()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Should only be called on the drawing side");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<CanvasLayer>
|
|
|
|
LayerManagerComposite::CreateCanvasLayer()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Should only be called on the drawing side");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
LayerComposite*
|
|
|
|
LayerManagerComposite::RootLayer() const
|
|
|
|
{
|
|
|
|
if (mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2013-12-09 01:41:00 +00:00
|
|
|
return ToLayerComposite(mRoot);
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
2014-06-17 20:34:42 +00:00
|
|
|
#ifdef MOZ_PROFILING
|
|
|
|
// Only build the QR feature when profiling to avoid bloating
|
|
|
|
// our data section.
|
|
|
|
// This table was generated using qrencode and is a binary
|
|
|
|
// encoding of the qrcodes 0-255.
|
|
|
|
#include "qrcode_table.h"
|
|
|
|
#endif
|
|
|
|
|
2013-07-06 16:19:52 +00:00
|
|
|
static uint16_t sFrameCount = 0;
|
|
|
|
void
|
|
|
|
LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds)
|
|
|
|
{
|
2014-05-08 20:49:01 +00:00
|
|
|
bool drawFps = gfxPrefs::LayersDrawFPS();
|
|
|
|
bool drawFrameCounter = gfxPrefs::DrawFrameCounter();
|
|
|
|
bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
|
|
|
|
|
|
|
|
if (drawFps) {
|
2014-02-10 22:14:11 +00:00
|
|
|
if (!mFPS) {
|
|
|
|
mFPS = new FPSState();
|
|
|
|
}
|
|
|
|
|
|
|
|
float fillRatio = mCompositor->GetFillRatio();
|
2014-05-08 20:49:01 +00:00
|
|
|
mFPS->DrawFPS(TimeStamp::Now(), drawFrameColorBars ? 10 : 0, 0, unsigned(fillRatio), mCompositor);
|
2014-02-10 22:14:11 +00:00
|
|
|
} else {
|
|
|
|
mFPS = nullptr;
|
2013-07-06 16:19:52 +00:00
|
|
|
}
|
|
|
|
|
2014-05-08 20:49:01 +00:00
|
|
|
if (drawFrameColorBars) {
|
|
|
|
gfx::Rect sideRect(0, 0, 10, aBounds.height);
|
|
|
|
|
|
|
|
EffectChain effects;
|
|
|
|
effects.mPrimaryEffect = new EffectSolidColor(gfxUtils::GetColorForFrameNumber(sFrameCount));
|
|
|
|
mCompositor->DrawQuad(sideRect,
|
|
|
|
sideRect,
|
|
|
|
effects,
|
|
|
|
1.0,
|
|
|
|
gfx::Matrix4x4());
|
|
|
|
}
|
|
|
|
|
2014-06-17 20:34:42 +00:00
|
|
|
#ifdef MOZ_PROFILING
|
2014-05-08 20:49:01 +00:00
|
|
|
if (drawFrameCounter) {
|
2014-02-10 22:14:11 +00:00
|
|
|
profiler_set_frame_number(sFrameCount);
|
2014-06-17 20:34:42 +00:00
|
|
|
const char* qr = sQRCodeTable[sFrameCount%256];
|
2013-07-06 16:19:52 +00:00
|
|
|
|
2014-06-17 20:34:42 +00:00
|
|
|
int size = 21;
|
|
|
|
int padding = 2;
|
2014-02-10 22:14:11 +00:00
|
|
|
float opacity = 1.0;
|
2014-06-17 20:34:42 +00:00
|
|
|
const uint16_t bitWidth = 5;
|
|
|
|
gfx::Rect clip(0,0, bitWidth*640, bitWidth*640);
|
|
|
|
|
|
|
|
// Draw the white squares at once
|
|
|
|
gfx::Color bitColor(1.0, 1.0, 1.0, 1.0);
|
|
|
|
EffectChain effects;
|
|
|
|
effects.mPrimaryEffect = new EffectSolidColor(bitColor);
|
|
|
|
int totalSize = (size + padding * 2) * bitWidth;
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(0, 0, totalSize, totalSize),
|
|
|
|
clip,
|
|
|
|
effects,
|
|
|
|
opacity,
|
|
|
|
gfx::Matrix4x4());
|
|
|
|
|
|
|
|
// Draw a black square for every bit set in qr[index]
|
|
|
|
effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(0, 0, 0, 1.0));
|
|
|
|
for (int y = 0; y < size; y++) {
|
|
|
|
for (int x = 0; x < size; x++) {
|
|
|
|
// Select the right bit from the binary encoding
|
|
|
|
int currBit = 128 >> ((x + y * 21) % 8);
|
|
|
|
int i = (x + y * 21) / 8;
|
|
|
|
if (qr[i] & currBit) {
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(bitWidth * (x + padding),
|
|
|
|
bitWidth * (y + padding),
|
|
|
|
bitWidth, bitWidth),
|
|
|
|
clip,
|
|
|
|
effects,
|
|
|
|
opacity,
|
|
|
|
gfx::Matrix4x4());
|
|
|
|
}
|
2014-02-10 22:14:11 +00:00
|
|
|
}
|
2013-07-06 16:19:52 +00:00
|
|
|
}
|
2014-05-08 20:49:01 +00:00
|
|
|
}
|
2014-06-17 20:34:42 +00:00
|
|
|
#endif
|
2014-05-08 20:49:01 +00:00
|
|
|
|
|
|
|
if (drawFrameColorBars || drawFrameCounter) {
|
2014-02-10 22:14:11 +00:00
|
|
|
// We intentionally overflow at 2^16.
|
|
|
|
sFrameCount++;
|
2013-07-06 16:19:52 +00: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 09:20:52 +00:00
|
|
|
void
|
|
|
|
LayerManagerComposite::Render()
|
|
|
|
{
|
2014-05-23 21:12:29 +00:00
|
|
|
PROFILER_LABEL("LayerManagerComposite", "Render",
|
|
|
|
js::ProfileEntry::Category::GRAPHICS);
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
if (mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-12-17 17:01:39 +00:00
|
|
|
/** Our more efficient but less powerful alter ego, if one is available. */
|
|
|
|
nsRefPtr<Composer2D> composer2D = mCompositor->GetWidget()->GetComposer2D();
|
|
|
|
|
2014-07-02 23:17:00 +00:00
|
|
|
// Set LayerScope begin/end frame
|
|
|
|
LayerScopeAutoFrame frame(PR_Now());
|
|
|
|
|
2014-07-27 20:32:00 +00:00
|
|
|
// Dump to console
|
|
|
|
if (gfxPrefs::LayersDump()) {
|
|
|
|
this->Dump();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dump to LayerScope Viewer
|
|
|
|
if (LayerScope::CheckSendable()) {
|
|
|
|
// Create a LayersPacket, dump Layers into it and transfer the
|
|
|
|
// packet('s ownership) to LayerScope.
|
|
|
|
auto packet = MakeUnique<layerscope::Packet>();
|
|
|
|
layerscope::LayersPacket* layersPacket = packet->mutable_layers();
|
|
|
|
this->Dump(layersPacket);
|
|
|
|
LayerScope::SendLayerDump(Move(packet));
|
|
|
|
}
|
|
|
|
|
2014-04-04 01:59:13 +00:00
|
|
|
if (!mTarget && composer2D && composer2D->TryRender(mRoot, mWorldMatrix, mGeometryChanged)) {
|
2014-02-12 20:25:52 +00:00
|
|
|
if (mFPS) {
|
|
|
|
double fps = mFPS->mCompositionFps.AddFrameAndGetFps(TimeStamp::Now());
|
2014-02-27 02:53:31 +00:00
|
|
|
if (gfxPrefs::LayersDrawFPS()) {
|
2014-02-12 20:25:52 +00:00
|
|
|
printf_stderr("HWComposer: FPS is %g\n", fps);
|
|
|
|
}
|
2014-02-10 22:14:11 +00: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 09:20:52 +00:00
|
|
|
mCompositor->EndFrameForExternalComposition(mWorldMatrix);
|
2014-07-07 19:58:26 +00:00
|
|
|
// Reset the invalid region as compositing is done
|
|
|
|
mInvalidRegion.SetEmpty();
|
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 09:20:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-09-10 19:56:49 +00:00
|
|
|
{
|
2014-05-23 21:12:29 +00:00
|
|
|
PROFILER_LABEL("LayerManagerComposite", "PreRender",
|
|
|
|
js::ProfileEntry::Category::GRAPHICS);
|
|
|
|
|
2013-10-09 14:39:22 +00:00
|
|
|
if (!mCompositor->GetWidget()->PreRender(this)) {
|
|
|
|
return;
|
|
|
|
}
|
2013-09-10 19:56:49 +00:00
|
|
|
}
|
2013-05-09 21:02:49 +00:00
|
|
|
|
2014-05-28 01:21:32 +00:00
|
|
|
nsIntRegion invalid;
|
|
|
|
if (mTarget) {
|
|
|
|
invalid = mTargetBounds;
|
|
|
|
} else {
|
|
|
|
invalid = mInvalidRegion;
|
|
|
|
// Reset the invalid region now that we've begun compositing.
|
|
|
|
mInvalidRegion.SetEmpty();
|
|
|
|
}
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
nsIntRect clipRect;
|
|
|
|
Rect bounds(mRenderBounds.x, mRenderBounds.y, mRenderBounds.width, mRenderBounds.height);
|
|
|
|
Rect actualBounds;
|
2014-05-21 17:29:49 +00:00
|
|
|
|
|
|
|
CompositorBench(mCompositor, bounds);
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
if (mRoot->GetClipRect()) {
|
|
|
|
clipRect = *mRoot->GetClipRect();
|
|
|
|
WorldTransformRect(clipRect);
|
|
|
|
Rect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
|
2014-05-28 01:21:32 +00:00
|
|
|
mCompositor->BeginFrame(invalid, &rect, mWorldMatrix, bounds, nullptr, &actualBounds);
|
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 09:20:52 +00:00
|
|
|
} else {
|
|
|
|
gfx::Rect rect;
|
2014-05-28 01:21:32 +00:00
|
|
|
mCompositor->BeginFrame(invalid, nullptr, mWorldMatrix, bounds, &rect, &actualBounds);
|
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 09:20:52 +00:00
|
|
|
clipRect = nsIntRect(rect.x, rect.y, rect.width, rect.height);
|
|
|
|
}
|
|
|
|
|
2013-05-01 00:42:05 +00:00
|
|
|
if (actualBounds.IsEmpty()) {
|
2013-10-09 14:39:23 +00:00
|
|
|
mCompositor->GetWidget()->PostRender(this);
|
2013-05-01 00:42:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
// Allow widget to render a custom background.
|
|
|
|
mCompositor->GetWidget()->DrawWindowUnderlay(this, nsIntRect(actualBounds.x,
|
|
|
|
actualBounds.y,
|
|
|
|
actualBounds.width,
|
|
|
|
actualBounds.height));
|
|
|
|
|
|
|
|
// Render our layers.
|
2014-07-15 20:26:20 +00:00
|
|
|
RootLayer()->Prepare(clipRect);
|
2013-11-07 09:53:08 +00:00
|
|
|
RootLayer()->RenderLayer(clipRect);
|
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 09:20:52 +00:00
|
|
|
|
2014-03-28 03:38:32 +00:00
|
|
|
if (!mRegionToClear.IsEmpty()) {
|
|
|
|
nsIntRegionRectIterator iter(mRegionToClear);
|
|
|
|
const nsIntRect *r;
|
|
|
|
while ((r = iter.Next())) {
|
|
|
|
mCompositor->ClearRect(Rect(r->x, r->y, r->width, r->height));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
// Allow widget to render a custom foreground.
|
|
|
|
mCompositor->GetWidget()->DrawWindowOverlay(this, nsIntRect(actualBounds.x,
|
|
|
|
actualBounds.y,
|
|
|
|
actualBounds.width,
|
|
|
|
actualBounds.height));
|
|
|
|
|
2013-07-06 16:19:52 +00:00
|
|
|
// Debugging
|
|
|
|
RenderDebugOverlay(actualBounds);
|
|
|
|
|
2013-09-10 19:56:49 +00:00
|
|
|
{
|
2014-05-23 21:12:29 +00:00
|
|
|
PROFILER_LABEL("LayerManagerComposite", "EndFrame",
|
|
|
|
js::ProfileEntry::Category::GRAPHICS);
|
|
|
|
|
2013-09-10 19:56:49 +00:00
|
|
|
mCompositor->EndFrame();
|
2014-03-18 01:36:56 +00:00
|
|
|
mCompositor->SetFBAcquireFence(mRoot);
|
2013-09-10 19:56:49 +00:00
|
|
|
}
|
2013-10-09 14:39:23 +00:00
|
|
|
|
|
|
|
mCompositor->GetWidget()->PostRender(this);
|
2013-11-27 07:32:19 +00:00
|
|
|
|
|
|
|
RecordFrame();
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-01-16 07:22:19 +00:00
|
|
|
LayerManagerComposite::SetWorldTransform(const gfx::Matrix& aMatrix)
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aMatrix.PreservesAxisAlignedRectangles(),
|
|
|
|
"SetWorldTransform only accepts matrices that satisfy PreservesAxisAlignedRectangles");
|
|
|
|
NS_ASSERTION(!aMatrix.HasNonIntegerScale(),
|
|
|
|
"SetWorldTransform only accepts matrices with integer scale");
|
|
|
|
|
|
|
|
mWorldMatrix = aMatrix;
|
|
|
|
}
|
|
|
|
|
2014-01-16 07:22:19 +00:00
|
|
|
gfx::Matrix&
|
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 09:20:52 +00:00
|
|
|
LayerManagerComposite::GetWorldTransform(void)
|
|
|
|
{
|
|
|
|
return mWorldMatrix;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LayerManagerComposite::WorldTransformRect(nsIntRect& aRect)
|
|
|
|
{
|
2014-01-16 07:22:19 +00:00
|
|
|
gfx::Rect grect(aRect.x, aRect.y, aRect.width, aRect.height);
|
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 09:20:52 +00:00
|
|
|
grect = mWorldMatrix.TransformBounds(grect);
|
|
|
|
aRect.SetRect(grect.X(), grect.Y(), grect.Width(), grect.Height());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
SubtractTransformedRegion(nsIntRegion& aRegion,
|
|
|
|
const nsIntRegion& aRegionToSubtract,
|
2014-08-01 12:31:47 +00:00
|
|
|
const Matrix4x4& aTransform)
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
if (aRegionToSubtract.IsEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// For each rect in the region, find out its bounds in screen space and
|
|
|
|
// subtract it from the screen region.
|
|
|
|
nsIntRegionRectIterator it(aRegionToSubtract);
|
|
|
|
while (const nsIntRect* rect = it.Next()) {
|
2014-08-01 12:31:47 +00:00
|
|
|
Rect incompleteRect = aTransform.TransformBounds(ToRect(*rect));
|
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 09:20:52 +00:00
|
|
|
aRegion.Sub(aRegion, nsIntRect(incompleteRect.x,
|
|
|
|
incompleteRect.y,
|
|
|
|
incompleteRect.width,
|
|
|
|
incompleteRect.height));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */ void
|
|
|
|
LayerManagerComposite::ComputeRenderIntegrityInternal(Layer* aLayer,
|
|
|
|
nsIntRegion& aScreenRegion,
|
|
|
|
nsIntRegion& aLowPrecisionScreenRegion,
|
2014-08-01 12:31:47 +00:00
|
|
|
const Matrix4x4& aTransform)
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
if (aLayer->GetOpacity() <= 0.f ||
|
|
|
|
(aScreenRegion.IsEmpty() && aLowPrecisionScreenRegion.IsEmpty())) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the layer's a container, recurse into all of its children
|
|
|
|
ContainerLayer* container = aLayer->AsContainerLayer();
|
|
|
|
if (container) {
|
|
|
|
// Accumulate the transform of intermediate surfaces
|
2014-08-01 12:31:47 +00:00
|
|
|
Matrix4x4 transform = aTransform;
|
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 09:20:52 +00:00
|
|
|
if (container->UseIntermediateSurface()) {
|
2014-08-01 12:31:47 +00:00
|
|
|
transform = aLayer->GetEffectiveTransform();
|
|
|
|
transform = aTransform * transform;
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
for (Layer* child = aLayer->GetFirstChild(); child;
|
|
|
|
child = child->GetNextSibling()) {
|
|
|
|
ComputeRenderIntegrityInternal(child, aScreenRegion, aLowPrecisionScreenRegion, transform);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Only thebes layers can be incomplete
|
|
|
|
ThebesLayer* thebesLayer = aLayer->AsThebesLayer();
|
|
|
|
if (!thebesLayer) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// See if there's any incomplete rendering
|
|
|
|
nsIntRegion incompleteRegion = aLayer->GetEffectiveVisibleRegion();
|
|
|
|
incompleteRegion.Sub(incompleteRegion, thebesLayer->GetValidRegion());
|
|
|
|
|
|
|
|
if (!incompleteRegion.IsEmpty()) {
|
|
|
|
// Calculate the transform to get between screen and layer space
|
2014-08-01 12:31:47 +00:00
|
|
|
Matrix4x4 transformToScreen = aLayer->GetEffectiveTransform();
|
|
|
|
transformToScreen = aTransform * transformToScreen;
|
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 09:20:52 +00:00
|
|
|
|
|
|
|
SubtractTransformedRegion(aScreenRegion, incompleteRegion, transformToScreen);
|
|
|
|
|
|
|
|
// See if there's any incomplete low-precision rendering
|
|
|
|
TiledLayerComposer* composer = nullptr;
|
|
|
|
LayerComposite* shadow = aLayer->AsLayerComposite();
|
|
|
|
if (shadow) {
|
2013-04-16 21:36:06 +00:00
|
|
|
composer = shadow->GetTiledLayerComposer();
|
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 09:20:52 +00:00
|
|
|
if (composer) {
|
|
|
|
incompleteRegion.Sub(incompleteRegion, composer->GetValidLowPrecisionRegion());
|
|
|
|
if (!incompleteRegion.IsEmpty()) {
|
|
|
|
SubtractTransformedRegion(aLowPrecisionScreenRegion, incompleteRegion, transformToScreen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If we can't get a valid low precision region, assume it's the same as
|
|
|
|
// the high precision region.
|
|
|
|
if (!composer) {
|
|
|
|
SubtractTransformedRegion(aLowPrecisionScreenRegion, incompleteRegion, transformToScreen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MOZ_ANDROID_OMTC
|
|
|
|
static float
|
2013-06-10 13:05:42 +00:00
|
|
|
GetDisplayportCoverage(const CSSRect& aDisplayPort,
|
2014-08-01 12:31:47 +00:00
|
|
|
const Matrix4x4& aTransformToScreen,
|
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 09:20:52 +00:00
|
|
|
const nsIntRect& aScreenRect)
|
|
|
|
{
|
2014-08-01 12:31:47 +00:00
|
|
|
Rect transformedDisplayport =
|
|
|
|
aTransformToScreen.TransformBounds(aDisplayPort.ToUnknownRect());
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
transformedDisplayport.RoundOut();
|
|
|
|
nsIntRect displayport = nsIntRect(transformedDisplayport.x,
|
|
|
|
transformedDisplayport.y,
|
|
|
|
transformedDisplayport.width,
|
|
|
|
transformedDisplayport.height);
|
|
|
|
if (!displayport.Contains(aScreenRect)) {
|
|
|
|
nsIntRegion coveredRegion;
|
|
|
|
coveredRegion.And(aScreenRect, displayport);
|
2013-07-30 21:10:32 +00:00
|
|
|
return coveredRegion.Area() / (float)(aScreenRect.width * aScreenRect.height);
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1.0f;
|
|
|
|
}
|
|
|
|
#endif // MOZ_ANDROID_OMTC
|
|
|
|
|
|
|
|
float
|
|
|
|
LayerManagerComposite::ComputeRenderIntegrity()
|
|
|
|
{
|
|
|
|
// We only ever have incomplete rendering when progressive tiles are enabled.
|
|
|
|
Layer* root = GetRoot();
|
2014-02-27 02:53:31 +00:00
|
|
|
if (!gfxPrefs::UseProgressiveTilePainting() || !root) {
|
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 09:20:52 +00:00
|
|
|
return 1.f;
|
|
|
|
}
|
|
|
|
|
|
|
|
const FrameMetrics& rootMetrics = root->AsContainerLayer()->GetFrameMetrics();
|
2014-07-04 12:12:41 +00:00
|
|
|
ParentLayerIntRect bounds = RoundedToInt(rootMetrics.mCompositionBounds);
|
|
|
|
nsIntRect screenRect(bounds.x,
|
|
|
|
bounds.y,
|
|
|
|
bounds.width,
|
|
|
|
bounds.height);
|
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 09:20:52 +00:00
|
|
|
|
|
|
|
float lowPrecisionMultiplier = 1.0f;
|
|
|
|
float highPrecisionMultiplier = 1.0f;
|
|
|
|
|
|
|
|
#ifdef MOZ_ANDROID_OMTC
|
|
|
|
// Use the transform on the primary scrollable layer and its FrameMetrics
|
|
|
|
// to find out how much of the viewport the current displayport covers
|
|
|
|
Layer* primaryScrollable = GetPrimaryScrollableLayer();
|
|
|
|
if (primaryScrollable) {
|
|
|
|
// This is derived from the code in
|
2013-10-29 13:27:50 +00:00
|
|
|
// AsyncCompositionManager::TransformScrollableLayer
|
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 09:20:52 +00:00
|
|
|
const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics();
|
2014-08-01 12:31:47 +00:00
|
|
|
Matrix4x4 transform = primaryScrollable->GetEffectiveTransform();
|
2013-10-29 13:27:50 +00:00
|
|
|
transform.ScalePost(metrics.mResolution.scale, metrics.mResolution.scale, 1);
|
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 09:20:52 +00:00
|
|
|
|
|
|
|
// Clip the screen rect to the document bounds
|
2014-08-01 12:31:47 +00:00
|
|
|
Rect documentBounds =
|
|
|
|
transform.TransformBounds(Rect(metrics.mScrollableRect.x - metrics.GetScrollOffset().x,
|
|
|
|
metrics.mScrollableRect.y - metrics.GetScrollOffset().y,
|
|
|
|
metrics.mScrollableRect.width,
|
|
|
|
metrics.mScrollableRect.height));
|
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 09:20:52 +00:00
|
|
|
documentBounds.RoundOut();
|
|
|
|
screenRect = screenRect.Intersect(nsIntRect(documentBounds.x, documentBounds.y,
|
|
|
|
documentBounds.width, documentBounds.height));
|
|
|
|
|
|
|
|
// If the screen rect is empty, the user has scrolled entirely into
|
|
|
|
// over-scroll and so we can be considered to have full integrity.
|
|
|
|
if (screenRect.IsEmpty()) {
|
|
|
|
return 1.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Work out how much of the critical display-port covers the screen
|
|
|
|
bool hasLowPrecision = false;
|
|
|
|
if (!metrics.mCriticalDisplayPort.IsEmpty()) {
|
|
|
|
hasLowPrecision = true;
|
|
|
|
highPrecisionMultiplier =
|
|
|
|
GetDisplayportCoverage(metrics.mCriticalDisplayPort, transform, screenRect);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Work out how much of the display-port covers the screen
|
|
|
|
if (!metrics.mDisplayPort.IsEmpty()) {
|
|
|
|
if (hasLowPrecision) {
|
|
|
|
lowPrecisionMultiplier =
|
|
|
|
GetDisplayportCoverage(metrics.mDisplayPort, transform, screenRect);
|
|
|
|
} else {
|
|
|
|
lowPrecisionMultiplier = highPrecisionMultiplier =
|
|
|
|
GetDisplayportCoverage(metrics.mDisplayPort, transform, screenRect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If none of the screen is covered, we have zero integrity.
|
|
|
|
if (highPrecisionMultiplier <= 0.0f && lowPrecisionMultiplier <= 0.0f) {
|
|
|
|
return 0.0f;
|
|
|
|
}
|
|
|
|
#endif // MOZ_ANDROID_OMTC
|
|
|
|
|
|
|
|
nsIntRegion screenRegion(screenRect);
|
|
|
|
nsIntRegion lowPrecisionScreenRegion(screenRect);
|
2014-08-01 12:31:47 +00:00
|
|
|
Matrix4x4 transform;
|
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 09:20:52 +00:00
|
|
|
ComputeRenderIntegrityInternal(root, screenRegion,
|
|
|
|
lowPrecisionScreenRegion, transform);
|
|
|
|
|
|
|
|
if (!screenRegion.IsEqual(screenRect)) {
|
|
|
|
// Calculate the area of the region. All rects in an nsRegion are
|
|
|
|
// non-overlapping.
|
|
|
|
float screenArea = screenRect.width * screenRect.height;
|
2013-07-30 21:10:32 +00:00
|
|
|
float highPrecisionIntegrity = screenRegion.Area() / screenArea;
|
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 09:20:52 +00:00
|
|
|
float lowPrecisionIntegrity = 1.f;
|
|
|
|
if (!lowPrecisionScreenRegion.IsEqual(screenRect)) {
|
2013-07-30 21:10:32 +00:00
|
|
|
lowPrecisionIntegrity = lowPrecisionScreenRegion.Area() / screenArea;
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ((highPrecisionIntegrity * highPrecisionMultiplier) +
|
|
|
|
(lowPrecisionIntegrity * lowPrecisionMultiplier)) / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1.f;
|
|
|
|
}
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
already_AddRefed<ThebesLayerComposite>
|
|
|
|
LayerManagerComposite::CreateThebesLayerComposite()
|
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 09:20:52 +00:00
|
|
|
{
|
2013-04-25 22:25:33 +00:00
|
|
|
if (mDestroyed) {
|
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 09:20:52 +00:00
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return nsRefPtr<ThebesLayerComposite>(new ThebesLayerComposite(this)).forget();
|
|
|
|
}
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
already_AddRefed<ContainerLayerComposite>
|
|
|
|
LayerManagerComposite::CreateContainerLayerComposite()
|
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 09:20:52 +00:00
|
|
|
{
|
2013-04-25 22:25:33 +00:00
|
|
|
if (mDestroyed) {
|
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 09:20:52 +00:00
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return nsRefPtr<ContainerLayerComposite>(new ContainerLayerComposite(this)).forget();
|
|
|
|
}
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
already_AddRefed<ImageLayerComposite>
|
|
|
|
LayerManagerComposite::CreateImageLayerComposite()
|
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 09:20:52 +00:00
|
|
|
{
|
2013-04-25 22:25:33 +00:00
|
|
|
if (mDestroyed) {
|
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 09:20:52 +00:00
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return nsRefPtr<ImageLayerComposite>(new ImageLayerComposite(this)).forget();
|
|
|
|
}
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
already_AddRefed<ColorLayerComposite>
|
|
|
|
LayerManagerComposite::CreateColorLayerComposite()
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
if (LayerManagerComposite::mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return nsRefPtr<ColorLayerComposite>(new ColorLayerComposite(this)).forget();
|
|
|
|
}
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
already_AddRefed<CanvasLayerComposite>
|
|
|
|
LayerManagerComposite::CreateCanvasLayerComposite()
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
if (LayerManagerComposite::mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return nsRefPtr<CanvasLayerComposite>(new CanvasLayerComposite(this)).forget();
|
|
|
|
}
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
already_AddRefed<RefLayerComposite>
|
|
|
|
LayerManagerComposite::CreateRefLayerComposite()
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
if (LayerManagerComposite::mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return nsRefPtr<RefLayerComposite>(new RefLayerComposite(this)).forget();
|
|
|
|
}
|
|
|
|
|
2013-08-28 04:44:03 +00:00
|
|
|
LayerManagerComposite::AutoAddMaskEffect::AutoAddMaskEffect(Layer* aMaskLayer,
|
|
|
|
EffectChain& aEffects,
|
|
|
|
bool aIs3D)
|
|
|
|
: mCompositable(nullptr)
|
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 09:20:52 +00:00
|
|
|
{
|
|
|
|
if (!aMaskLayer) {
|
2013-08-28 04:44:03 +00:00
|
|
|
return;
|
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 09:20:52 +00:00
|
|
|
}
|
2013-08-28 04:44:03 +00:00
|
|
|
|
2013-12-09 01:41:00 +00:00
|
|
|
mCompositable = ToLayerComposite(aMaskLayer)->GetCompositableHost();
|
2013-08-28 04:44:03 +00:00
|
|
|
if (!mCompositable) {
|
2013-04-17 05:10:50 +00:00
|
|
|
NS_WARNING("Mask layer with no compositable host");
|
2013-08-28 04:44:03 +00:00
|
|
|
return;
|
2013-04-17 05:10:50 +00:00
|
|
|
}
|
|
|
|
|
2014-01-25 01:49:19 +00:00
|
|
|
if (!mCompositable->AddMaskEffect(aEffects, aMaskLayer->GetEffectiveTransform(), aIs3D)) {
|
2013-12-11 17:32:41 +00:00
|
|
|
mCompositable = nullptr;
|
|
|
|
}
|
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 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
2013-08-28 04:44:03 +00:00
|
|
|
LayerManagerComposite::AutoAddMaskEffect::~AutoAddMaskEffect()
|
2013-08-02 01:12:16 +00:00
|
|
|
{
|
2013-08-28 04:44:03 +00:00
|
|
|
if (!mCompositable) {
|
2013-08-02 01:12:16 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-08-28 04:44:03 +00:00
|
|
|
mCompositable->RemoveMaskEffect();
|
2013-08-02 01:12:16 +00: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 09:20:52 +00:00
|
|
|
TemporaryRef<DrawTarget>
|
|
|
|
LayerManagerComposite::CreateDrawTarget(const IntSize &aSize,
|
|
|
|
SurfaceFormat aFormat)
|
|
|
|
{
|
|
|
|
#ifdef XP_MACOSX
|
|
|
|
// We don't want to accelerate if the surface is too small which indicates
|
|
|
|
// that it's likely used for an icon/static image. We also don't want to
|
|
|
|
// accelerate anything that is above the maximum texture size of weakest gpu.
|
|
|
|
// Safari uses 5000 area as the minimum for acceleration, we decided 64^2 is more logical.
|
|
|
|
bool useAcceleration = aSize.width <= 4096 && aSize.height <= 4096 &&
|
|
|
|
aSize.width > 64 && aSize.height > 64 &&
|
|
|
|
gfxPlatformMac::GetPlatform()->UseAcceleratedCanvas();
|
|
|
|
if (useAcceleration) {
|
2014-01-10 19:06:16 +00:00
|
|
|
return Factory::CreateDrawTarget(BackendType::COREGRAPHICS_ACCELERATED,
|
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 09:20:52 +00:00
|
|
|
aSize, aFormat);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return LayerManager::CreateDrawTarget(aSize, aFormat);
|
|
|
|
}
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
LayerComposite::LayerComposite(LayerManagerComposite *aManager)
|
|
|
|
: mCompositeManager(aManager)
|
|
|
|
, mCompositor(aManager->GetCompositor())
|
|
|
|
, mShadowOpacity(1.0)
|
|
|
|
, mUseShadowClipRect(false)
|
2013-05-16 12:34:24 +00:00
|
|
|
, mShadowTransformSetByAnimation(false)
|
2013-04-25 22:25:33 +00:00
|
|
|
, mDestroyed(false)
|
2013-10-15 21:01:42 +00:00
|
|
|
, mLayerComposited(false)
|
2013-04-25 22:25:33 +00:00
|
|
|
{ }
|
|
|
|
|
|
|
|
LayerComposite::~LayerComposite()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
void
|
|
|
|
LayerComposite::Destroy()
|
|
|
|
{
|
|
|
|
if (!mDestroyed) {
|
|
|
|
mDestroyed = true;
|
|
|
|
CleanupResources();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-09 09:48:29 +00:00
|
|
|
void
|
|
|
|
LayerComposite::AddBlendModeEffect(EffectChain& aEffectChain)
|
|
|
|
{
|
|
|
|
gfx::CompositionOp blendMode = GetLayer()->GetEffectiveMixBlendMode();
|
|
|
|
if (blendMode == gfx::CompositionOp::OP_OVER) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
aEffectChain.mSecondaryEffects[EffectTypes::BLEND_MODE] = new EffectBlendMode(blendMode);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
bool
|
2013-12-20 16:46:29 +00:00
|
|
|
LayerManagerComposite::CanUseCanvasLayerForSize(const IntSize &aSize)
|
2013-04-25 22:25:33 +00:00
|
|
|
{
|
2013-09-27 00:37:19 +00:00
|
|
|
return mCompositor->CanUseCanvasLayerForSize(gfx::IntSize(aSize.width,
|
|
|
|
aSize.height));
|
2013-04-25 22:25:33 +00:00
|
|
|
}
|
|
|
|
|
2014-02-10 22:14:11 +00:00
|
|
|
void
|
|
|
|
LayerManagerComposite::NotifyShadowTreeTransaction()
|
|
|
|
{
|
|
|
|
if (mFPS) {
|
|
|
|
mFPS->NotifyShadowTreeTransaction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-25 22:25:33 +00:00
|
|
|
#ifndef MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
|
|
|
|
|
|
|
|
/*static*/ bool
|
|
|
|
LayerManagerComposite::SupportsDirectTexturing()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*static*/ void
|
|
|
|
LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
|
|
|
|
|
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 09:20:52 +00:00
|
|
|
} /* layers */
|
|
|
|
} /* mozilla */
|