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 13:20:52 +04: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-12 03:17:23 +04: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-11 02:14:11 +04:00
|
|
|
#include "FPSCounter.h" // for FPSState, FPSCounter
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "FrameMetrics.h" // for FrameMetrics
|
2013-08-22 11:11:51 +04:00
|
|
|
#include "GeckoProfiler.h" // for profiler_set_frame_number, etc
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "ImageLayerComposite.h" // for ImageLayerComposite
|
|
|
|
#include "Layers.h" // for Layer, ContainerLayer, etc
|
2014-07-03 03:17:00 +04:00
|
|
|
#include "LayerScope.h" // for LayerScope Tool
|
2014-07-28 00:32:00 +04:00
|
|
|
#include "protobuf/LayerScopePacket.pb.h" // for protobuf (LayerScope)
|
2014-09-26 21:06:08 +04:00
|
|
|
#include "PaintedLayerComposite.h" // for PaintedLayerComposite
|
2015-07-01 14:51:03 +03:00
|
|
|
#include "TiledContentHost.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "Units.h" // for ScreenIntRect
|
2015-04-12 05:03:00 +03:00
|
|
|
#include "UnitTransforms.h" // for ViewAs
|
2016-06-09 07:36:12 +03:00
|
|
|
#include "apz/src/AsyncPanZoomController.h" // for AsyncPanZoomController
|
2014-02-27 06:53:31 +04: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 13:20:52 +04:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
#include "gfxPlatformMac.h"
|
|
|
|
#endif
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "gfxRect.h" // for gfxRect
|
2014-05-09 00:49:01 +04:00
|
|
|
#include "gfxUtils.h" // for frame color util
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed
|
2013-08-12 03:17:23 +04:00
|
|
|
#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
|
2014-08-28 06:13:41 +04:00
|
|
|
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
|
2013-11-18 01:47:40 +04:00
|
|
|
#include "mozilla/layers/LayersTypes.h" // for etc
|
2014-05-21 21:29:49 +04:00
|
|
|
#include "ipc/CompositorBench.h" // for CompositorBench
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "ipc/ShadowLayerUtils.h"
|
|
|
|
#include "mozilla/mozalloc.h" // for operator new, etc
|
2015-01-15 01:24:09 +03:00
|
|
|
#include "nsAppRunner.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h" // for nsRefPtr
|
2013-08-12 03:17:23 +04:00
|
|
|
#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
|
2015-05-07 12:07:42 +03:00
|
|
|
#include "nsRect.h" // for mozilla::gfx::IntRect
|
2013-08-12 03:17:23 +04:00
|
|
|
#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 13:20:52 +04:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
|
|
|
#include <android/log.h>
|
2015-04-11 05:14:00 +03:00
|
|
|
#include "AndroidBridge.h"
|
2015-08-08 23:50:47 +03:00
|
|
|
#endif
|
|
|
|
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
2015-04-11 05:14:00 +03:00
|
|
|
#include "opengl/CompositorOGL.h"
|
|
|
|
#include "GLContextEGL.h"
|
|
|
|
#include "GLContextProvider.h"
|
|
|
|
#include "ScopedGLHelpers.h"
|
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 13:20:52 +04:00
|
|
|
#endif
|
2015-08-08 23:50:47 +03:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
#include "nsScreenManagerGonk.h"
|
|
|
|
#include "nsWindow.h"
|
|
|
|
#endif
|
2013-09-10 23:56:49 +04:00
|
|
|
#include "GeckoProfiler.h"
|
2014-03-12 06:27:33 +04:00
|
|
|
#include "TextRenderer.h" // for TextRenderer
|
2016-05-04 03:37:34 +03:00
|
|
|
#include "mozilla/layers/CompositorBridgeParent.h"
|
2016-03-10 12:20:40 +03:00
|
|
|
#include "TreeTraversal.h" // for ForEachNode
|
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 13:20:52 +04:00
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
class gfxContext;
|
|
|
|
|
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 13:20:52 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-12 03:17:23 +04: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 13:20:52 +04:00
|
|
|
using namespace mozilla::gfx;
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
|
|
|
|
static LayerComposite*
|
|
|
|
ToLayerComposite(Layer* aLayer)
|
|
|
|
{
|
|
|
|
return static_cast<LayerComposite*>(aLayer->ImplData());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ClearSubtree(Layer* aLayer)
|
|
|
|
{
|
2016-03-10 12:20:40 +03:00
|
|
|
ForEachNode<ForwardIterator>(
|
|
|
|
aLayer,
|
|
|
|
[] (Layer* layer)
|
|
|
|
{
|
|
|
|
ToLayerComposite(layer)->CleanupResources();
|
|
|
|
});
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
2014-09-04 21:54:54 +04:00
|
|
|
: mWarningLevel(0.0f)
|
|
|
|
, mUnusedApzTransformWarning(false)
|
2016-06-29 01:31:15 +03:00
|
|
|
, mDisabledApzWarning(false)
|
2014-09-04 21:54:54 +04:00
|
|
|
, mCompositor(aCompositor)
|
2013-11-22 02:07:57 +04:00
|
|
|
, mInTransaction(false)
|
|
|
|
, mIsCompositorReady(false)
|
2013-12-03 19:49:46 +04:00
|
|
|
, mDebugOverlayWantsNextFrame(false)
|
2014-04-04 05:59:13 +04:00
|
|
|
, mGeometryChanged(true)
|
2014-09-02 23:23:34 +04:00
|
|
|
, mLastFrameMissedHWC(false)
|
2015-10-30 13:49:07 +03:00
|
|
|
, mWindowOverlayChanged(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 13:20:52 +04:00
|
|
|
{
|
2014-03-12 06:27:30 +04:00
|
|
|
mTextRenderer = new TextRenderer(aCompositor);
|
2013-08-04 11:46:17 +04: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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
void
|
|
|
|
LayerManagerComposite::Destroy()
|
|
|
|
{
|
|
|
|
if (!mDestroyed) {
|
2013-04-22 06:40:51 +04: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 13:20:52 +04:00
|
|
|
if (mRoot) {
|
|
|
|
RootLayer()->Destroy();
|
|
|
|
}
|
|
|
|
mRoot = nullptr;
|
2015-10-27 20:15:02 +03:00
|
|
|
mClonedLayerTreeProperties = 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 13:20:52 +04:00
|
|
|
mDestroyed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-05-07 12:07:42 +03:00
|
|
|
LayerManagerComposite::UpdateRenderBounds(const IntRect& 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 13:20:52 +04:00
|
|
|
{
|
|
|
|
mRenderBounds = aRect;
|
|
|
|
}
|
|
|
|
|
2014-07-18 10:48:23 +04:00
|
|
|
bool
|
|
|
|
LayerManagerComposite::AreComponentAlphaLayersEnabled()
|
|
|
|
{
|
2015-10-06 09:39:00 +03:00
|
|
|
return mCompositor->GetBackendType() != LayersBackend::LAYERS_BASIC &&
|
2014-07-18 10:48:23 +04:00
|
|
|
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 13:20:52 +04:00
|
|
|
void
|
|
|
|
LayerManagerComposite::BeginTransaction()
|
|
|
|
{
|
|
|
|
mInTransaction = true;
|
2016-05-01 13:54:26 +03:00
|
|
|
|
2013-11-22 02:07:57 +04:00
|
|
|
if (!mCompositor->Ready()) {
|
|
|
|
return;
|
|
|
|
}
|
2016-05-01 13:54:26 +03:00
|
|
|
|
2013-11-22 02:07:57 +04:00
|
|
|
mIsCompositorReady = 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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-05-07 12:07:42 +03:00
|
|
|
LayerManagerComposite::BeginTransactionWithDrawTarget(DrawTarget* aTarget, const IntRect& 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 13:20:52 +04:00
|
|
|
{
|
|
|
|
mInTransaction = true;
|
2016-05-01 13:54:26 +03:00
|
|
|
|
2013-11-22 02:07:57 +04: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 13:20:52 +04:00
|
|
|
|
|
|
|
#ifdef MOZ_LAYERS_HAVE_LOG
|
|
|
|
MOZ_LAYERS_LOG(("[----- BeginTransaction"));
|
|
|
|
Log();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-11-22 02:07:57 +04:00
|
|
|
mIsCompositorReady = true;
|
2014-05-28 05:21:32 +04:00
|
|
|
mCompositor->SetTargetContext(aTarget, aRect);
|
2014-03-05 02:36:52 +04:00
|
|
|
mTarget = aTarget;
|
2014-05-28 05:21:32 +04: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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2016-02-19 04:12:40 +03:00
|
|
|
/**
|
|
|
|
* Get accumulated transform of from the context creating layer to the
|
|
|
|
* given layer.
|
|
|
|
*/
|
|
|
|
static Matrix4x4
|
|
|
|
GetAccTransformIn3DContext(Layer* aLayer) {
|
|
|
|
Matrix4x4 transform = aLayer->GetLocalTransform();
|
|
|
|
for (Layer* layer = aLayer->GetParent();
|
|
|
|
layer && layer->Extend3DContext();
|
|
|
|
layer = layer->GetParent()) {
|
|
|
|
transform = transform * layer->GetLocalTransform();
|
|
|
|
}
|
|
|
|
return transform;
|
|
|
|
}
|
|
|
|
|
2014-10-20 08:04:39 +04:00
|
|
|
void
|
2015-11-23 22:45:53 +03:00
|
|
|
LayerManagerComposite::PostProcessLayers(Layer* aLayer,
|
|
|
|
nsIntRegion& aOpaqueRegion,
|
2015-12-03 00:54:03 +03:00
|
|
|
LayerIntRegion& aVisibleRegion,
|
|
|
|
const Maybe<ParentLayerIntRect>& aClipFromAncestors)
|
2014-10-20 08:04:39 +04:00
|
|
|
{
|
2016-02-19 04:12:40 +03:00
|
|
|
if (aLayer->Extend3DContext()) {
|
|
|
|
// For layers participating 3D rendering context, their visible
|
|
|
|
// region should be empty (invisible), so we pass through them
|
|
|
|
// without doing anything.
|
|
|
|
|
|
|
|
// Direct children of the establisher may have a clip, becaue the
|
|
|
|
// item containing it; ex. of nsHTMLScrollFrame, may give it one.
|
|
|
|
Maybe<ParentLayerIntRect> layerClip =
|
|
|
|
aLayer->AsLayerComposite()->GetShadowClipRect();
|
|
|
|
Maybe<ParentLayerIntRect> ancestorClipForChildren =
|
|
|
|
IntersectMaybeRects(layerClip, aClipFromAncestors);
|
|
|
|
MOZ_ASSERT(!layerClip || !aLayer->Combines3DTransformWithAncestors(),
|
|
|
|
"Only direct children of the establisher could have a clip");
|
|
|
|
|
|
|
|
for (Layer* child = aLayer->GetLastChild();
|
|
|
|
child;
|
|
|
|
child = child->GetPrevSibling()) {
|
|
|
|
PostProcessLayers(child, aOpaqueRegion, aVisibleRegion,
|
|
|
|
ancestorClipForChildren);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-10-20 08:04:39 +04:00
|
|
|
nsIntRegion localOpaque;
|
2016-02-19 04:12:40 +03:00
|
|
|
// Treat layers on the path to the root of the 3D rendering context as
|
|
|
|
// a giant layer if it is a leaf.
|
|
|
|
Matrix4x4 transform = GetAccTransformIn3DContext(aLayer);
|
2014-10-20 08:04:39 +04:00
|
|
|
Matrix transform2d;
|
2015-11-10 04:43:54 +03:00
|
|
|
Maybe<nsIntPoint> integerTranslation;
|
2014-10-20 08:04:39 +04:00
|
|
|
// If aLayer has a simple transform (only an integer translation) then we
|
|
|
|
// can easily convert aOpaqueRegion into pre-transform coordinates and include
|
|
|
|
// that region.
|
2015-12-03 00:54:03 +03:00
|
|
|
if (transform.Is2D(&transform2d)) {
|
2014-10-20 08:04:39 +04:00
|
|
|
if (transform2d.IsIntegerTranslation()) {
|
2015-11-10 04:43:54 +03:00
|
|
|
integerTranslation = Some(TruncatedToInt(transform2d.GetTranslation()));
|
2014-10-20 08:04:39 +04:00
|
|
|
localOpaque = aOpaqueRegion;
|
2015-11-10 04:43:54 +03:00
|
|
|
localOpaque.MoveBy(-*integerTranslation);
|
2014-10-20 08:04:39 +04:00
|
|
|
}
|
|
|
|
}
|
2016-05-01 13:54:26 +03:00
|
|
|
|
2015-12-03 00:54:03 +03:00
|
|
|
// Compute a clip that's the combination of our layer clip with the clip
|
|
|
|
// from our ancestors.
|
|
|
|
LayerComposite* composite = aLayer->AsLayerComposite();
|
|
|
|
Maybe<ParentLayerIntRect> layerClip = composite->GetShadowClipRect();
|
2016-02-19 04:12:40 +03:00
|
|
|
MOZ_ASSERT(!layerClip || !aLayer->Combines3DTransformWithAncestors(),
|
|
|
|
"The layer with a clip should not participate "
|
|
|
|
"a 3D rendering context");
|
2015-12-03 00:54:03 +03:00
|
|
|
Maybe<ParentLayerIntRect> outsideClip =
|
|
|
|
IntersectMaybeRects(layerClip, aClipFromAncestors);
|
|
|
|
|
|
|
|
// Convert the combined clip into our pre-transform coordinate space, so
|
|
|
|
// that it can later be intersected with our visible region.
|
|
|
|
// If our transform is a perspective, there's no meaningful insideClip rect
|
|
|
|
// we can compute (it would need to be a cone).
|
|
|
|
Maybe<LayerIntRect> insideClip;
|
|
|
|
if (outsideClip && !transform.HasPerspectiveComponent()) {
|
|
|
|
Matrix4x4 inverse = transform;
|
|
|
|
if (inverse.Invert()) {
|
|
|
|
Maybe<LayerRect> insideClipFloat =
|
2015-12-03 10:20:35 +03:00
|
|
|
UntransformBy(ViewAs<ParentLayerToLayerMatrix4x4>(inverse),
|
|
|
|
ParentLayerRect(*outsideClip),
|
|
|
|
LayerRect::MaxIntRect());
|
2015-12-03 00:54:03 +03:00
|
|
|
if (insideClipFloat) {
|
|
|
|
insideClipFloat->RoundOut();
|
|
|
|
LayerIntRect insideClipInt;
|
|
|
|
if (insideClipFloat->ToIntRect(&insideClipInt)) {
|
|
|
|
insideClip = Some(insideClipInt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Maybe<ParentLayerIntRect> ancestorClipForChildren;
|
|
|
|
if (insideClip) {
|
|
|
|
ancestorClipForChildren =
|
|
|
|
Some(ViewAs<ParentLayerPixel>(*insideClip, PixelCastJustification::MovingDownToChildren));
|
|
|
|
}
|
2014-10-20 08:04:39 +04:00
|
|
|
|
2015-11-23 22:45:53 +03:00
|
|
|
// Save the value of localOpaque, which currently stores the region obscured
|
|
|
|
// by siblings (and uncles and such), before our descendants contribute to it.
|
|
|
|
nsIntRegion obscured = localOpaque;
|
|
|
|
|
|
|
|
// Recurse on our descendants, in front-to-back order. In this process:
|
|
|
|
// - Occlusions are computed for them, and they contribute to localOpaque.
|
2015-12-03 00:54:03 +03:00
|
|
|
// - They recalculate their visible regions, taking ancestorClipForChildren
|
|
|
|
// into account, and accumulate them into descendantsVisibleRegion.
|
2015-11-23 22:45:53 +03:00
|
|
|
LayerIntRegion descendantsVisibleRegion;
|
2016-02-07 13:51:11 +03:00
|
|
|
bool hasPreserve3DChild = false;
|
2015-11-23 22:45:53 +03:00
|
|
|
for (Layer* child = aLayer->GetLastChild(); child; child = child->GetPrevSibling()) {
|
2015-12-03 00:54:03 +03:00
|
|
|
PostProcessLayers(child, localOpaque, descendantsVisibleRegion, ancestorClipForChildren);
|
2016-02-07 13:51:11 +03:00
|
|
|
if (child->Extend3DContext()) {
|
|
|
|
hasPreserve3DChild = true;
|
|
|
|
}
|
2015-11-23 22:45:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Recalculate our visible region.
|
2015-11-29 10:07:55 +03:00
|
|
|
LayerIntRegion visible = composite->GetShadowVisibleRegion();
|
2015-11-23 22:45:53 +03:00
|
|
|
|
|
|
|
// If we have descendants, throw away the visible region stored on this
|
|
|
|
// layer, and use the region accumulated by our descendants instead.
|
2016-02-07 13:51:11 +03:00
|
|
|
if (aLayer->GetFirstChild() && !hasPreserve3DChild) {
|
2015-11-23 22:45:53 +03:00
|
|
|
visible = descendantsVisibleRegion;
|
2014-10-20 08:04:39 +04:00
|
|
|
}
|
|
|
|
|
2015-11-23 22:45:53 +03:00
|
|
|
// Subtract any areas that we know to be opaque.
|
|
|
|
if (!obscured.IsEmpty()) {
|
|
|
|
visible.SubOut(LayerIntRegion::FromUnknownRegion(obscured));
|
|
|
|
}
|
|
|
|
|
2015-12-03 00:54:03 +03:00
|
|
|
// Clip the visible region using the combined clip.
|
|
|
|
if (insideClip) {
|
|
|
|
visible.AndWith(*insideClip);
|
|
|
|
}
|
2015-11-29 10:07:55 +03:00
|
|
|
composite->SetShadowVisibleRegion(visible);
|
2015-11-23 22:45:53 +03:00
|
|
|
|
|
|
|
// Transform the newly calculated visible region into our parent's space,
|
|
|
|
// apply our clip to it (if any), and accumulate it into |aVisibleRegion|
|
|
|
|
// for the caller to use.
|
2015-12-01 04:06:45 +03:00
|
|
|
ParentLayerIntRegion visibleParentSpace = TransformBy(
|
2015-12-01 04:14:31 +03:00
|
|
|
ViewAs<LayerToParentLayerMatrix4x4>(transform), visible);
|
2015-11-23 22:45:53 +03:00
|
|
|
if (const Maybe<ParentLayerIntRect>& clipRect = composite->GetShadowClipRect()) {
|
|
|
|
visibleParentSpace.AndWith(*clipRect);
|
2014-10-20 08:04:39 +04:00
|
|
|
}
|
2015-11-23 22:45:53 +03:00
|
|
|
aVisibleRegion.OrWith(ViewAs<LayerPixel>(visibleParentSpace,
|
|
|
|
PixelCastJustification::MovingDownToChildren));
|
2014-10-20 08:04:39 +04:00
|
|
|
|
|
|
|
// If we have a simple transform, then we can add our opaque area into
|
|
|
|
// aOpaqueRegion.
|
2015-11-10 04:43:54 +03:00
|
|
|
if (integerTranslation &&
|
2015-06-21 19:27:31 +03:00
|
|
|
!aLayer->HasMaskLayers() &&
|
2015-09-30 10:02:00 +03:00
|
|
|
aLayer->IsOpaqueForVisibility()) {
|
2016-04-11 05:51:21 +03:00
|
|
|
if (aLayer->IsOpaque()) {
|
2015-11-10 04:43:54 +03:00
|
|
|
localOpaque.OrWith(composite->GetFullyRenderedRegion());
|
2014-10-20 08:04:39 +04:00
|
|
|
}
|
2015-11-10 04:43:54 +03:00
|
|
|
localOpaque.MoveBy(*integerTranslation);
|
2015-12-03 00:54:03 +03:00
|
|
|
if (layerClip) {
|
|
|
|
localOpaque.AndWith(layerClip->ToUnknownRect());
|
2014-10-20 08:04:39 +04:00
|
|
|
}
|
2015-11-10 04:43:54 +03:00
|
|
|
aOpaqueRegion.OrWith(localOpaque);
|
2014-10-20 08:04:39 +04: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 13:20:52 +04:00
|
|
|
void
|
2015-07-07 06:38:38 +03:00
|
|
|
LayerManagerComposite::EndTransaction(const TimeStamp& aTimeStamp,
|
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 13:20:52 +04:00
|
|
|
EndTransactionFlags aFlags)
|
|
|
|
{
|
2013-11-20 11:27:23 +04:00
|
|
|
NS_ASSERTION(mInTransaction, "Didn't call BeginTransaction?");
|
2015-05-15 09:33:20 +03:00
|
|
|
NS_ASSERTION(!(aFlags & END_NO_COMPOSITE),
|
|
|
|
"Shouldn't get END_NO_COMPOSITE 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 13:20:52 +04:00
|
|
|
mInTransaction = false;
|
|
|
|
|
2013-11-22 02:07:57 +04: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 13:20:52 +04:00
|
|
|
#ifdef MOZ_LAYERS_HAVE_LOG
|
|
|
|
MOZ_LAYERS_LOG((" ----- (beginning paint)"));
|
|
|
|
Log();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-07-07 23:50:29 +03:00
|
|
|
// Set composition timestamp here because we need it in
|
|
|
|
// ComputeEffectiveTransforms (so the correct video frame size is picked) and
|
|
|
|
// also to compute invalid regions properly.
|
|
|
|
mCompositor->SetCompositionTime(aTimeStamp);
|
|
|
|
|
2015-10-27 20:15:02 +03:00
|
|
|
if (mRoot && !(aFlags & END_NO_IMMEDIATE_REDRAW)) {
|
|
|
|
MOZ_ASSERT(!aTimeStamp.IsNull());
|
|
|
|
UpdateAndRender();
|
2016-06-15 14:28:10 +03:00
|
|
|
mCompositor->FlushPendingNotifyNotUsed();
|
2015-10-27 20:15:02 +03:00
|
|
|
} else {
|
|
|
|
// Modified the layer tree.
|
|
|
|
mGeometryChanged = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
mCompositor->ClearTargetContext();
|
|
|
|
mTarget = nullptr;
|
|
|
|
|
|
|
|
#ifdef MOZ_LAYERS_HAVE_LOG
|
|
|
|
Log();
|
|
|
|
MOZ_LAYERS_LOG(("]----- EndTransaction"));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LayerManagerComposite::UpdateAndRender()
|
|
|
|
{
|
|
|
|
nsIntRegion invalid;
|
2015-11-02 20:28:00 +03:00
|
|
|
bool didEffectiveTransforms = false;
|
2015-10-27 20:15:02 +03:00
|
|
|
|
2016-02-09 03:01:45 +03:00
|
|
|
nsIntRegion opaque;
|
|
|
|
LayerIntRegion visible;
|
|
|
|
PostProcessLayers(mRoot, opaque, visible, Nothing());
|
|
|
|
|
2015-10-27 20:15:02 +03:00
|
|
|
if (mClonedLayerTreeProperties) {
|
2015-11-02 20:28:00 +03:00
|
|
|
// Effective transforms are needed by ComputeDifferences().
|
|
|
|
mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4());
|
|
|
|
didEffectiveTransforms = true;
|
|
|
|
|
2015-10-27 20:15:02 +03:00
|
|
|
// We need to compute layer tree differences even if we're not going to
|
|
|
|
// immediately use the resulting damage area, since ComputeDifferences
|
|
|
|
// is also responsible for invalidates intermediate surfaces in
|
|
|
|
// ContainerLayers.
|
|
|
|
nsIntRegion changed = mClonedLayerTreeProperties->ComputeDifferences(mRoot, nullptr, &mGeometryChanged);
|
|
|
|
|
|
|
|
if (mTarget) {
|
|
|
|
// Since we're composing to an external target, we're not going to use
|
|
|
|
// the damage region from layers changes - we want to composite
|
|
|
|
// everything in the target bounds. Instead we accumulate the layers
|
|
|
|
// damage region for the next window composite.
|
|
|
|
mInvalidRegion.Or(mInvalidRegion, changed);
|
|
|
|
} else {
|
|
|
|
invalid = Move(changed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mTarget) {
|
|
|
|
invalid.Or(invalid, mTargetBounds);
|
|
|
|
} else {
|
|
|
|
// If we didn't have a previous layer tree, invalidate the entire render
|
|
|
|
// area.
|
|
|
|
if (!mClonedLayerTreeProperties) {
|
|
|
|
invalid.Or(invalid, mRenderBounds);
|
|
|
|
}
|
2013-11-21 23:25:16 +04:00
|
|
|
|
2015-10-27 20:15:02 +03:00
|
|
|
// Add any additional invalid rects from the window manager or previous
|
|
|
|
// damage computed during ComposeToTarget().
|
|
|
|
invalid.Or(invalid, mInvalidRegion);
|
|
|
|
mInvalidRegion.SetEmpty();
|
2013-11-21 23:25:16 +04:00
|
|
|
}
|
|
|
|
|
2015-10-30 13:49:07 +03:00
|
|
|
if (invalid.IsEmpty() && !mWindowOverlayChanged) {
|
2015-05-15 09:27:04 +03:00
|
|
|
// Composition requested, but nothing has changed. Don't do any work.
|
2016-01-11 05:11:14 +03:00
|
|
|
mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot());
|
2015-05-15 09:27:04 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-20 01:03:48 +03:00
|
|
|
// We don't want our debug overlay to cause more frames to happen
|
|
|
|
// so we will invalidate after we've decided if something changed.
|
2016-01-11 05:12:05 +03:00
|
|
|
InvalidateDebugOverlay(invalid, mRenderBounds);
|
2015-10-20 01:03:48 +03:00
|
|
|
|
2015-11-02 20:28:00 +03:00
|
|
|
if (!didEffectiveTransforms) {
|
|
|
|
// The results of our drawing always go directly into a pixel buffer,
|
|
|
|
// so we don't need to pass any global transform here.
|
|
|
|
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 13:20:52 +04:00
|
|
|
|
2016-04-05 04:25:04 +03:00
|
|
|
Render(invalid, opaque);
|
2015-08-08 23:50:47 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
2015-10-27 20:15:02 +03:00
|
|
|
RenderToPresentationSurface();
|
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 13:20:52 +04:00
|
|
|
#endif
|
2015-10-27 20:15:02 +03:00
|
|
|
mGeometryChanged = false;
|
2015-10-30 13:49:07 +03:00
|
|
|
mWindowOverlayChanged = false;
|
2016-01-11 05:11:14 +03:00
|
|
|
|
|
|
|
// Update cached layer tree information.
|
|
|
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
already_AddRefed<DrawTarget>
|
2014-04-10 12:49:49 +04:00
|
|
|
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 13:20:52 +04:00
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Should only be called on the drawing side");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2014-09-26 21:06:08 +04:00
|
|
|
already_AddRefed<PaintedLayer>
|
|
|
|
LayerManagerComposite::CreatePaintedLayer()
|
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 13:20:52 +04:00
|
|
|
{
|
2015-01-15 01:24:09 +03:00
|
|
|
MOZ_ASSERT(gIsGtest, "Unless you're testing the compositor using GTest,"
|
|
|
|
"this should only be called on the drawing side");
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<PaintedLayer> layer = new PaintedLayerComposite(this);
|
2015-01-15 01:24:09 +03:00
|
|
|
return layer.forget();
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<ContainerLayer>
|
|
|
|
LayerManagerComposite::CreateContainerLayer()
|
|
|
|
{
|
2015-01-15 01:24:09 +03:00
|
|
|
MOZ_ASSERT(gIsGtest, "Unless you're testing the compositor using GTest,"
|
|
|
|
"this should only be called on the drawing side");
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ContainerLayer> layer = new ContainerLayerComposite(this);
|
2015-01-15 01:24:09 +03:00
|
|
|
return layer.forget();
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<ImageLayer>
|
|
|
|
LayerManagerComposite::CreateImageLayer()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Should only be called on the drawing side");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<ColorLayer>
|
|
|
|
LayerManagerComposite::CreateColorLayer()
|
|
|
|
{
|
2015-01-15 01:24:09 +03:00
|
|
|
MOZ_ASSERT(gIsGtest, "Unless you're testing the compositor using GTest,"
|
|
|
|
"this should only be called on the drawing side");
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ColorLayer> layer = new ColorLayerComposite(this);
|
2015-01-15 01:24:09 +03:00
|
|
|
return layer.forget();
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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 05:41:00 +04: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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2014-06-18 00:34:42 +04: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
|
|
|
|
|
2015-10-20 01:03:48 +03:00
|
|
|
void
|
2016-01-11 05:12:05 +03:00
|
|
|
LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const IntRect& aBounds)
|
2015-10-20 01:03:48 +03:00
|
|
|
{
|
|
|
|
bool drawFps = gfxPrefs::LayersDrawFPS();
|
|
|
|
bool drawFrameCounter = gfxPrefs::DrawFrameCounter();
|
|
|
|
bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
|
|
|
|
|
|
|
|
if (drawFps || drawFrameCounter) {
|
2016-01-11 05:12:05 +03:00
|
|
|
aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 256, 256));
|
2015-10-20 01:03:48 +03:00
|
|
|
}
|
|
|
|
if (drawFrameColorBars) {
|
2016-01-11 05:12:05 +03:00
|
|
|
aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.height));
|
2015-10-20 01:03:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-06 20:19:52 +04:00
|
|
|
static uint16_t sFrameCount = 0;
|
|
|
|
void
|
2016-05-13 23:15:17 +03:00
|
|
|
LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds)
|
2013-07-06 20:19:52 +04:00
|
|
|
{
|
2014-05-09 00:49:01 +04:00
|
|
|
bool drawFps = gfxPrefs::LayersDrawFPS();
|
|
|
|
bool drawFrameCounter = gfxPrefs::DrawFrameCounter();
|
|
|
|
bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
|
|
|
|
|
2014-08-28 23:24:26 +04:00
|
|
|
TimeStamp now = TimeStamp::Now();
|
|
|
|
|
2014-05-09 00:49:01 +04:00
|
|
|
if (drawFps) {
|
2014-02-11 02:14:11 +04:00
|
|
|
if (!mFPS) {
|
2014-08-25 19:09:39 +04:00
|
|
|
mFPS = MakeUnique<FPSState>();
|
2014-02-11 02:14:11 +04:00
|
|
|
}
|
|
|
|
|
2014-09-04 21:54:54 +04:00
|
|
|
float alpha = 1;
|
2014-08-28 23:24:26 +04:00
|
|
|
#ifdef ANDROID
|
|
|
|
// Draw a translation delay warning overlay
|
|
|
|
int width;
|
|
|
|
int border;
|
2015-05-21 00:01:34 +03:00
|
|
|
if (!mWarnTime.IsNull() && (now - mWarnTime).ToMilliseconds() < kVisualWarningDuration) {
|
2014-08-28 23:24:26 +04:00
|
|
|
EffectChain effects;
|
|
|
|
|
|
|
|
// Black blorder
|
|
|
|
border = 4;
|
|
|
|
width = 6;
|
|
|
|
effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(0, 0, 0, 1));
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(border, border, aBounds.width - 2 * border, width),
|
|
|
|
aBounds, effects, alpha, gfx::Matrix4x4());
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(border, aBounds.height - border - width, aBounds.width - 2 * border, width),
|
|
|
|
aBounds, effects, alpha, gfx::Matrix4x4());
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(border, border + width, width, aBounds.height - 2 * border - width * 2),
|
|
|
|
aBounds, effects, alpha, gfx::Matrix4x4());
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(aBounds.width - border - width, border + width, width, aBounds.height - 2 * border - 2 * width),
|
|
|
|
aBounds, effects, alpha, gfx::Matrix4x4());
|
|
|
|
|
|
|
|
// Content
|
|
|
|
border = 5;
|
|
|
|
width = 4;
|
|
|
|
effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(1, 1.f - mWarningLevel, 0, 1));
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(border, border, aBounds.width - 2 * border, width),
|
|
|
|
aBounds, effects, alpha, gfx::Matrix4x4());
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(border, aBounds.height - border - width, aBounds.width - 2 * border, width),
|
|
|
|
aBounds, effects, alpha, gfx::Matrix4x4());
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(border, border + width, width, aBounds.height - 2 * border - width * 2),
|
|
|
|
aBounds, effects, alpha, gfx::Matrix4x4());
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(aBounds.width - border - width, border + width, width, aBounds.height - 2 * border - 2 * width),
|
|
|
|
aBounds, effects, alpha, gfx::Matrix4x4());
|
|
|
|
SetDebugOverlayWantsNextFrame(true);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-02-11 02:14:11 +04:00
|
|
|
float fillRatio = mCompositor->GetFillRatio();
|
2015-03-04 02:47:00 +03:00
|
|
|
mFPS->DrawFPS(now, drawFrameColorBars ? 10 : 1, 2, unsigned(fillRatio), mCompositor);
|
2014-09-04 21:54:54 +04:00
|
|
|
|
|
|
|
if (mUnusedApzTransformWarning) {
|
|
|
|
// If we have an unused APZ transform on this composite, draw a 20x20 red box
|
|
|
|
// in the top-right corner
|
|
|
|
EffectChain effects;
|
|
|
|
effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(1, 0, 0, 1));
|
2016-06-29 01:31:15 +03:00
|
|
|
mCompositor->DrawQuad(gfx::Rect(aBounds.width - 20, 0, 20, 20),
|
2014-09-04 21:54:54 +04:00
|
|
|
aBounds, effects, alpha, gfx::Matrix4x4());
|
|
|
|
|
|
|
|
mUnusedApzTransformWarning = false;
|
|
|
|
SetDebugOverlayWantsNextFrame(true);
|
|
|
|
}
|
2016-06-29 01:31:15 +03:00
|
|
|
if (mDisabledApzWarning) {
|
|
|
|
// If we have a disabled APZ on this composite, draw a 20x20 yellow box
|
|
|
|
// in the top-right corner, to the left of the unused-apz-transform
|
|
|
|
// warning box
|
|
|
|
EffectChain effects;
|
|
|
|
effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(1, 1, 0, 1));
|
|
|
|
mCompositor->DrawQuad(gfx::Rect(aBounds.width - 40, 0, 20, 20),
|
|
|
|
aBounds, effects, alpha, gfx::Matrix4x4());
|
|
|
|
|
|
|
|
mDisabledApzWarning = false;
|
|
|
|
SetDebugOverlayWantsNextFrame(true);
|
|
|
|
}
|
|
|
|
|
2015-08-07 21:11:18 +03:00
|
|
|
|
|
|
|
// Each frame is invalidate by the previous frame for simplicity
|
2014-02-11 02:14:11 +04:00
|
|
|
} else {
|
|
|
|
mFPS = nullptr;
|
2013-07-06 20:19:52 +04:00
|
|
|
}
|
|
|
|
|
2014-05-09 00:49:01 +04:00
|
|
|
if (drawFrameColorBars) {
|
2016-05-13 23:15:17 +03:00
|
|
|
gfx::IntRect sideRect(0, 0, 10, aBounds.height);
|
2014-05-09 00:49:01 +04:00
|
|
|
|
|
|
|
EffectChain effects;
|
|
|
|
effects.mPrimaryEffect = new EffectSolidColor(gfxUtils::GetColorForFrameNumber(sFrameCount));
|
2016-05-13 23:15:17 +03:00
|
|
|
mCompositor->DrawQuad(Rect(sideRect),
|
2014-05-09 00:49:01 +04:00
|
|
|
sideRect,
|
|
|
|
effects,
|
|
|
|
1.0,
|
|
|
|
gfx::Matrix4x4());
|
2015-08-07 21:11:18 +03:00
|
|
|
|
2014-05-09 00:49:01 +04:00
|
|
|
}
|
|
|
|
|
2014-06-18 00:34:42 +04:00
|
|
|
#ifdef MOZ_PROFILING
|
2014-05-09 00:49:01 +04:00
|
|
|
if (drawFrameCounter) {
|
2014-02-11 02:14:11 +04:00
|
|
|
profiler_set_frame_number(sFrameCount);
|
2014-06-18 00:34:42 +04:00
|
|
|
const char* qr = sQRCodeTable[sFrameCount%256];
|
2013-07-06 20:19:52 +04:00
|
|
|
|
2014-06-18 00:34:42 +04:00
|
|
|
int size = 21;
|
|
|
|
int padding = 2;
|
2014-02-11 02:14:11 +04:00
|
|
|
float opacity = 1.0;
|
2014-06-18 00:34:42 +04:00
|
|
|
const uint16_t bitWidth = 5;
|
2016-05-13 23:15:17 +03:00
|
|
|
gfx::IntRect clip(0,0, bitWidth*640, bitWidth*640);
|
2014-06-18 00:34:42 +04:00
|
|
|
|
|
|
|
// 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-11 02:14:11 +04:00
|
|
|
}
|
2013-07-06 20:19:52 +04:00
|
|
|
}
|
2015-08-07 21:11:18 +03:00
|
|
|
|
2014-05-09 00:49:01 +04:00
|
|
|
}
|
2014-06-18 00:34:42 +04:00
|
|
|
#endif
|
2014-05-09 00:49:01 +04:00
|
|
|
|
|
|
|
if (drawFrameColorBars || drawFrameCounter) {
|
2014-02-11 02:14:11 +04:00
|
|
|
// We intentionally overflow at 2^16.
|
|
|
|
sFrameCount++;
|
2013-07-06 20:19:52 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CompositingRenderTarget>
|
2014-08-25 23:36:17 +04:00
|
|
|
LayerManagerComposite::PushGroupForLayerEffects()
|
2014-08-08 01:44:08 +04:00
|
|
|
{
|
2014-08-25 23:36:17 +04:00
|
|
|
// This is currently true, so just making sure that any new use of this
|
|
|
|
// method is flagged for investigation
|
|
|
|
MOZ_ASSERT(gfxPrefs::LayersEffectInvert() ||
|
|
|
|
gfxPrefs::LayersEffectGrayscale() ||
|
|
|
|
gfxPrefs::LayersEffectContrast() != 0.0);
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CompositingRenderTarget> previousTarget = mCompositor->GetCurrentRenderTarget();
|
2014-08-08 01:44:08 +04:00
|
|
|
// make our render target the same size as the destination target
|
|
|
|
// so that we don't have to change size if the drawing area changes.
|
|
|
|
IntRect rect(previousTarget->GetOrigin(), previousTarget->GetSize());
|
|
|
|
// XXX: I'm not sure if this is true or not...
|
|
|
|
MOZ_ASSERT(rect.x == 0 && rect.y == 0);
|
|
|
|
if (!mTwoPassTmpTarget ||
|
|
|
|
mTwoPassTmpTarget->GetSize() != previousTarget->GetSize() ||
|
|
|
|
mTwoPassTmpTarget->GetOrigin() != previousTarget->GetOrigin()) {
|
|
|
|
mTwoPassTmpTarget = mCompositor->CreateRenderTarget(rect, INIT_MODE_NONE);
|
|
|
|
}
|
2016-06-21 18:31:13 +03:00
|
|
|
MOZ_ASSERT(mTwoPassTmpTarget);
|
2014-08-08 01:44:08 +04:00
|
|
|
mCompositor->SetRenderTarget(mTwoPassTmpTarget);
|
|
|
|
return previousTarget;
|
|
|
|
}
|
2014-08-25 23:36:17 +04:00
|
|
|
void
|
2015-10-18 08:24:48 +03:00
|
|
|
LayerManagerComposite::PopGroupForLayerEffects(RefPtr<CompositingRenderTarget> aPreviousTarget,
|
2015-05-07 12:07:42 +03:00
|
|
|
IntRect aClipRect,
|
2014-08-25 23:36:17 +04:00
|
|
|
bool aGrayscaleEffect,
|
|
|
|
bool aInvertEffect,
|
|
|
|
float aContrastEffect)
|
2014-08-08 01:44:08 +04:00
|
|
|
{
|
2014-08-25 23:36:17 +04:00
|
|
|
MOZ_ASSERT(mTwoPassTmpTarget);
|
|
|
|
|
|
|
|
// This is currently true, so just making sure that any new use of this
|
|
|
|
// method is flagged for investigation
|
|
|
|
MOZ_ASSERT(aInvertEffect || aGrayscaleEffect || aContrastEffect != 0.0);
|
|
|
|
|
2014-08-08 01:44:08 +04:00
|
|
|
mCompositor->SetRenderTarget(aPreviousTarget);
|
|
|
|
|
|
|
|
EffectChain effectChain(RootLayer());
|
2014-08-25 23:36:17 +04:00
|
|
|
Matrix5x4 effectMatrix;
|
|
|
|
if (aGrayscaleEffect) {
|
|
|
|
// R' = G' = B' = luminance
|
|
|
|
// R' = 0.2126*R + 0.7152*G + 0.0722*B
|
|
|
|
// G' = 0.2126*R + 0.7152*G + 0.0722*B
|
|
|
|
// B' = 0.2126*R + 0.7152*G + 0.0722*B
|
|
|
|
Matrix5x4 grayscaleMatrix(0.2126f, 0.2126f, 0.2126f, 0,
|
|
|
|
0.7152f, 0.7152f, 0.7152f, 0,
|
|
|
|
0.0722f, 0.0722f, 0.0722f, 0,
|
|
|
|
0, 0, 0, 1,
|
|
|
|
0, 0, 0, 0);
|
|
|
|
effectMatrix = grayscaleMatrix;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aInvertEffect) {
|
|
|
|
// R' = 1 - R
|
|
|
|
// G' = 1 - G
|
|
|
|
// B' = 1 - B
|
|
|
|
Matrix5x4 colorInvertMatrix(-1, 0, 0, 0,
|
|
|
|
0, -1, 0, 0,
|
|
|
|
0, 0, -1, 0,
|
|
|
|
0, 0, 0, 1,
|
|
|
|
1, 1, 1, 0);
|
|
|
|
effectMatrix = effectMatrix * colorInvertMatrix;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aContrastEffect != 0.0) {
|
|
|
|
// Multiplying with:
|
|
|
|
// R' = (1 + c) * (R - 0.5) + 0.5
|
|
|
|
// G' = (1 + c) * (G - 0.5) + 0.5
|
|
|
|
// B' = (1 + c) * (B - 0.5) + 0.5
|
|
|
|
float cP1 = aContrastEffect + 1;
|
|
|
|
float hc = 0.5*aContrastEffect;
|
|
|
|
Matrix5x4 contrastMatrix( cP1, 0, 0, 0,
|
|
|
|
0, cP1, 0, 0,
|
|
|
|
0, 0, cP1, 0,
|
|
|
|
0, 0, 0, 1,
|
|
|
|
-hc, -hc, -hc, 0);
|
|
|
|
effectMatrix = effectMatrix * contrastMatrix;
|
2014-08-08 01:44:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
effectChain.mPrimaryEffect = new EffectRenderTarget(mTwoPassTmpTarget);
|
2014-08-25 23:36:17 +04:00
|
|
|
effectChain.mSecondaryEffects[EffectTypes::COLOR_MATRIX] = new EffectColorMatrix(effectMatrix);
|
2014-08-08 01:44:08 +04:00
|
|
|
|
2016-05-13 23:15:17 +03:00
|
|
|
mCompositor->DrawQuad(Rect(Point(0, 0), Size(mTwoPassTmpTarget->GetSize())), aClipRect, effectChain, 1.,
|
2014-08-08 01:44:08 +04:00
|
|
|
Matrix4x4());
|
|
|
|
}
|
|
|
|
|
2016-02-09 04:26:54 +03:00
|
|
|
// Used to clear the 'mLayerComposited' flag at the beginning of each Render().
|
|
|
|
static void
|
|
|
|
ClearLayerFlags(Layer* aLayer) {
|
2016-03-10 12:20:40 +03:00
|
|
|
ForEachNode<ForwardIterator>(
|
|
|
|
aLayer,
|
|
|
|
[] (Layer* layer)
|
|
|
|
{
|
|
|
|
if (layer->AsLayerComposite()) {
|
|
|
|
layer->AsLayerComposite()->SetLayerComposited(false);
|
|
|
|
}
|
|
|
|
});
|
2016-02-09 04:26:54 +03: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 13:20:52 +04:00
|
|
|
void
|
2016-04-05 04:25:04 +03:00
|
|
|
LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegion& aOpaqueRegion)
|
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 13:20:52 +04:00
|
|
|
{
|
2014-05-24 01:12:29 +04:00
|
|
|
PROFILER_LABEL("LayerManagerComposite", "Render",
|
|
|
|
js::ProfileEntry::Category::GRAPHICS);
|
|
|
|
|
2016-06-21 18:31:13 +03:00
|
|
|
if (mDestroyed || !mCompositor || mCompositor->IsDestroyed()) {
|
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 13:20:52 +04:00
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-02-09 04:26:54 +03:00
|
|
|
ClearLayerFlags(mRoot);
|
|
|
|
|
2014-08-25 23:36:17 +04:00
|
|
|
// At this time, it doesn't really matter if these preferences change
|
|
|
|
// during the execution of the function; we should be safe in all
|
|
|
|
// permutations. However, may as well just get the values onces and
|
|
|
|
// then use them, just in case the consistency becomes important in
|
|
|
|
// the future.
|
|
|
|
bool invertVal = gfxPrefs::LayersEffectInvert();
|
|
|
|
bool grayscaleVal = gfxPrefs::LayersEffectGrayscale();
|
|
|
|
float contrastVal = gfxPrefs::LayersEffectContrast();
|
|
|
|
bool haveLayerEffects = (invertVal || grayscaleVal || contrastVal != 0.0);
|
2013-12-17 21:01:39 +04:00
|
|
|
|
2014-07-03 03:17:00 +04:00
|
|
|
// Set LayerScope begin/end frame
|
|
|
|
LayerScopeAutoFrame frame(PR_Now());
|
|
|
|
|
2014-07-28 00:32:00 +04:00
|
|
|
// Dump to console
|
2014-12-18 21:32:53 +03:00
|
|
|
if (gfxPrefs::LayersDump()) {
|
2016-03-17 23:18:10 +03:00
|
|
|
this->Dump(/* aSorted= */true);
|
2014-12-18 21:32:53 +03:00
|
|
|
} else if (profiler_feature_active("layersdump")) {
|
|
|
|
std::stringstream ss;
|
|
|
|
Dump(ss);
|
|
|
|
profiler_log(ss.str().c_str());
|
2014-07-28 00:32:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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-08-25 23:36:17 +04:00
|
|
|
/** Our more efficient but less powerful alter ego, if one is available. */
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<Composer2D> composer2D;
|
2015-04-17 19:28:41 +03:00
|
|
|
composer2D = mCompositor->GetWidget()->GetComposer2D();
|
2014-08-25 23:36:17 +04:00
|
|
|
|
2015-04-17 19:28:41 +03:00
|
|
|
// We can't use composert2D if we have layer effects
|
|
|
|
if (!mTarget && !haveLayerEffects &&
|
2015-04-15 16:39:44 +03:00
|
|
|
gfxPrefs::Composer2DCompositionEnabled() &&
|
2015-06-05 06:29:30 +03:00
|
|
|
composer2D && composer2D->HasHwc() && composer2D->TryRenderWithHwc(mRoot,
|
2016-04-30 02:20:41 +03:00
|
|
|
mCompositor->GetWidget()->RealWidget(),
|
2016-01-19 07:52:32 +03:00
|
|
|
mGeometryChanged,
|
|
|
|
mCompositor->HasImageHostOverlays()))
|
2015-04-15 16:39:44 +03:00
|
|
|
{
|
2015-01-16 10:00:25 +03:00
|
|
|
LayerScope::SetHWComposed();
|
2014-02-13 00:25:52 +04:00
|
|
|
if (mFPS) {
|
|
|
|
double fps = mFPS->mCompositionFps.AddFrameAndGetFps(TimeStamp::Now());
|
2014-02-27 06:53:31 +04:00
|
|
|
if (gfxPrefs::LayersDrawFPS()) {
|
2014-02-13 00:25:52 +04:00
|
|
|
printf_stderr("HWComposer: FPS is %g\n", fps);
|
|
|
|
}
|
2014-02-11 02:14:11 +04:00
|
|
|
}
|
2014-09-10 23:59:00 +04:00
|
|
|
mCompositor->EndFrameForExternalComposition(Matrix());
|
2014-09-02 23:23:34 +04:00
|
|
|
mLastFrameMissedHWC = 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 13:20:52 +04:00
|
|
|
return;
|
2015-04-17 19:28:41 +03:00
|
|
|
} else if (!mTarget && !haveLayerEffects) {
|
2014-09-02 23:23:34 +04:00
|
|
|
mLastFrameMissedHWC = !!composer2D;
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-09-10 23:56:49 +04:00
|
|
|
{
|
2014-05-24 01:12:29 +04:00
|
|
|
PROFILER_LABEL("LayerManagerComposite", "PreRender",
|
|
|
|
js::ProfileEntry::Category::GRAPHICS);
|
|
|
|
|
2013-10-09 18:39:22 +04:00
|
|
|
if (!mCompositor->GetWidget()->PreRender(this)) {
|
|
|
|
return;
|
|
|
|
}
|
2013-09-10 23:56:49 +04:00
|
|
|
}
|
2013-05-10 01:02:49 +04:00
|
|
|
|
2015-04-12 05:03:00 +03:00
|
|
|
ParentLayerIntRect clipRect;
|
2016-05-13 23:15:17 +03:00
|
|
|
IntRect bounds(mRenderBounds.x, mRenderBounds.y, mRenderBounds.width, mRenderBounds.height);
|
|
|
|
IntRect actualBounds;
|
2014-05-21 21:29:49 +04:00
|
|
|
|
|
|
|
CompositorBench(mCompositor, bounds);
|
|
|
|
|
2016-02-25 22:38:05 +03:00
|
|
|
MOZ_ASSERT(mRoot->GetOpacity() == 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 13:20:52 +04:00
|
|
|
if (mRoot->GetClipRect()) {
|
|
|
|
clipRect = *mRoot->GetClipRect();
|
2016-05-13 23:15:17 +03:00
|
|
|
IntRect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
|
2016-04-05 04:25:04 +03:00
|
|
|
mCompositor->BeginFrame(aInvalidRegion, &rect, bounds, aOpaqueRegion, 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 13:20:52 +04:00
|
|
|
} else {
|
2016-05-13 23:15:17 +03:00
|
|
|
gfx::IntRect rect;
|
2016-04-05 04:25:04 +03:00
|
|
|
mCompositor->BeginFrame(aInvalidRegion, nullptr, bounds, aOpaqueRegion, &rect, &actualBounds);
|
2015-04-12 05:03:00 +03:00
|
|
|
clipRect = ParentLayerIntRect(rect.x, rect.y, rect.width, rect.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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-05-01 04:42:05 +04:00
|
|
|
if (actualBounds.IsEmpty()) {
|
2013-10-09 18:39:23 +04:00
|
|
|
mCompositor->GetWidget()->PostRender(this);
|
2013-05-01 04:42:05 +04: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 13:20:52 +04:00
|
|
|
// Allow widget to render a custom background.
|
2015-11-17 07:34:00 +03:00
|
|
|
mCompositor->GetWidget()->DrawWindowUnderlay(
|
2016-05-13 23:15:17 +03:00
|
|
|
this, LayoutDeviceIntRect::FromUnknownRect(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 13:20:52 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CompositingRenderTarget> previousTarget;
|
2014-08-25 23:36:17 +04:00
|
|
|
if (haveLayerEffects) {
|
|
|
|
previousTarget = PushGroupForLayerEffects();
|
2014-08-08 01:44:08 +04:00
|
|
|
} else {
|
|
|
|
mTwoPassTmpTarget = 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 13:20:52 +04:00
|
|
|
// Render our layers.
|
2015-04-12 05:03:00 +03:00
|
|
|
RootLayer()->Prepare(ViewAs<RenderTargetPixel>(clipRect, PixelCastJustification::RenderTargetIsParentLayerForRoot));
|
2015-11-07 06:13:40 +03:00
|
|
|
RootLayer()->RenderLayer(clipRect.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 13:20:52 +04:00
|
|
|
|
2014-03-28 07:38:32 +04:00
|
|
|
if (!mRegionToClear.IsEmpty()) {
|
2016-01-19 04:20:58 +03:00
|
|
|
for (auto iter = mRegionToClear.RectIter(); !iter.Done(); iter.Next()) {
|
|
|
|
const IntRect& r = iter.Get();
|
|
|
|
mCompositor->ClearRect(Rect(r.x, r.y, r.width, r.height));
|
2014-03-28 07:38:32 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-08 01:44:08 +04:00
|
|
|
if (mTwoPassTmpTarget) {
|
2014-08-25 23:36:17 +04:00
|
|
|
MOZ_ASSERT(haveLayerEffects);
|
2015-11-07 06:13:40 +03:00
|
|
|
PopGroupForLayerEffects(previousTarget, clipRect.ToUnknownRect(),
|
2014-08-25 23:36:17 +04:00
|
|
|
grayscaleVal, invertVal, contrastVal);
|
2014-08-08 01:44:08 +04: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 13:20:52 +04:00
|
|
|
// Allow widget to render a custom foreground.
|
2015-11-19 06:10:38 +03:00
|
|
|
mCompositor->GetWidget()->DrawWindowOverlay(
|
2016-05-13 23:15:17 +03:00
|
|
|
this, LayoutDeviceIntRect::FromUnknownRect(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 13:20:52 +04:00
|
|
|
|
2013-07-06 20:19:52 +04:00
|
|
|
// Debugging
|
|
|
|
RenderDebugOverlay(actualBounds);
|
|
|
|
|
2013-09-10 23:56:49 +04:00
|
|
|
{
|
2014-05-24 01:12:29 +04:00
|
|
|
PROFILER_LABEL("LayerManagerComposite", "EndFrame",
|
|
|
|
js::ProfileEntry::Category::GRAPHICS);
|
|
|
|
|
2013-09-10 23:56:49 +04:00
|
|
|
mCompositor->EndFrame();
|
2016-04-30 02:20:41 +03:00
|
|
|
|
|
|
|
// Call after EndFrame()
|
2016-05-04 03:37:34 +03:00
|
|
|
mCompositor->SetDispAcquireFence(mRoot);
|
2013-09-10 23:56:49 +04:00
|
|
|
}
|
2013-10-09 18:39:23 +04:00
|
|
|
|
2015-04-17 19:28:41 +03:00
|
|
|
if (composer2D) {
|
2016-04-30 02:20:41 +03:00
|
|
|
composer2D->Render(mCompositor->GetWidget()->RealWidget());
|
2015-04-17 19:28:41 +03:00
|
|
|
}
|
|
|
|
|
2013-10-09 18:39:23 +04:00
|
|
|
mCompositor->GetWidget()->PostRender(this);
|
2013-11-27 11:32:19 +04: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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2015-08-08 23:50:47 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
2015-04-11 05:14:00 +03:00
|
|
|
class ScopedCompositorProjMatrix {
|
|
|
|
public:
|
|
|
|
ScopedCompositorProjMatrix(CompositorOGL* aCompositor, const Matrix4x4& aProjMatrix):
|
|
|
|
mCompositor(aCompositor),
|
|
|
|
mOriginalProjMatrix(mCompositor->GetProjMatrix())
|
|
|
|
{
|
|
|
|
mCompositor->SetProjMatrix(aProjMatrix);
|
|
|
|
}
|
|
|
|
|
|
|
|
~ScopedCompositorProjMatrix()
|
|
|
|
{
|
|
|
|
mCompositor->SetProjMatrix(mOriginalProjMatrix);
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
CompositorOGL* const mCompositor;
|
|
|
|
const Matrix4x4 mOriginalProjMatrix;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ScopedCompostitorSurfaceSize {
|
|
|
|
public:
|
|
|
|
ScopedCompostitorSurfaceSize(CompositorOGL* aCompositor, const gfx::IntSize& aSize) :
|
|
|
|
mCompositor(aCompositor),
|
|
|
|
mOriginalSize(mCompositor->GetDestinationSurfaceSize())
|
|
|
|
{
|
|
|
|
mCompositor->SetDestinationSurfaceSize(aSize);
|
|
|
|
}
|
|
|
|
~ScopedCompostitorSurfaceSize()
|
|
|
|
{
|
|
|
|
mCompositor->SetDestinationSurfaceSize(mOriginalSize);
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
CompositorOGL* const mCompositor;
|
|
|
|
const gfx::IntSize mOriginalSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ScopedCompositorRenderOffset {
|
|
|
|
public:
|
|
|
|
ScopedCompositorRenderOffset(CompositorOGL* aCompositor, const ScreenPoint& aOffset) :
|
|
|
|
mCompositor(aCompositor),
|
|
|
|
mOriginalOffset(mCompositor->GetScreenRenderOffset())
|
|
|
|
{
|
|
|
|
mCompositor->SetScreenRenderOffset(aOffset);
|
|
|
|
}
|
|
|
|
~ScopedCompositorRenderOffset()
|
|
|
|
{
|
|
|
|
mCompositor->SetScreenRenderOffset(mOriginalOffset);
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
CompositorOGL* const mCompositor;
|
|
|
|
const ScreenPoint mOriginalOffset;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ScopedContextSurfaceOverride {
|
|
|
|
public:
|
|
|
|
ScopedContextSurfaceOverride(GLContextEGL* aContext, void* aSurface) :
|
|
|
|
mContext(aContext)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aSurface);
|
|
|
|
mContext->SetEGLSurfaceOverride(aSurface);
|
|
|
|
mContext->MakeCurrent(true);
|
|
|
|
}
|
|
|
|
~ScopedContextSurfaceOverride()
|
|
|
|
{
|
|
|
|
mContext->SetEGLSurfaceOverride(EGL_NO_SURFACE);
|
|
|
|
mContext->MakeCurrent(true);
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
GLContextEGL* const mContext;
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
LayerManagerComposite::RenderToPresentationSurface()
|
|
|
|
{
|
2015-08-08 23:50:47 +03:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
2015-04-11 05:14:00 +03:00
|
|
|
if (!AndroidBridge::Bridge()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void* window = AndroidBridge::Bridge()->GetPresentationWindow();
|
|
|
|
|
|
|
|
if (!window) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
EGLSurface surface = AndroidBridge::Bridge()->GetPresentationSurface();
|
|
|
|
|
|
|
|
if (!surface) {
|
|
|
|
//create surface;
|
|
|
|
surface = GLContextProviderEGL::CreateEGLSurface(window);
|
|
|
|
if (!surface) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
AndroidBridge::Bridge()->SetPresentationSurface(surface);
|
|
|
|
}
|
|
|
|
|
2016-04-14 13:38:42 +03:00
|
|
|
CompositorOGL* compositor = mCompositor->AsCompositorOGL();
|
2015-04-11 05:14:00 +03:00
|
|
|
GLContext* gl = compositor->gl();
|
|
|
|
GLContextEGL* egl = GLContextEGL::Cast(gl);
|
|
|
|
|
|
|
|
if (!egl) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const IntSize windowSize = AndroidBridge::Bridge()->GetNativeWindowSize(window);
|
|
|
|
|
2015-08-08 23:50:47 +03:00
|
|
|
#elif defined(MOZ_WIDGET_GONK)
|
2016-04-14 13:38:42 +03:00
|
|
|
CompositorOGL* compositor = mCompositor->AsCompositorOGL();
|
2016-05-05 12:27:38 +03:00
|
|
|
nsScreenGonk* screen = static_cast<nsWindow*>(mCompositor->GetWidget()->RealWidget())->GetScreen();
|
2015-08-08 23:50:47 +03:00
|
|
|
if (!screen->IsPrimaryScreen()) {
|
|
|
|
// Only primary screen support mirroring
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsWindow* mirrorScreenWidget = screen->GetMirroringWidget();
|
|
|
|
if (!mirrorScreenWidget) {
|
|
|
|
// No mirroring
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsScreenGonk* mirrorScreen = mirrorScreenWidget->GetScreen();
|
|
|
|
if (!mirrorScreen->GetTopWindows().IsEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
EGLSurface surface = mirrorScreen->GetEGLSurface();
|
|
|
|
if (surface == LOCAL_EGL_NO_SURFACE) {
|
|
|
|
// Create GLContext
|
2015-12-29 14:13:24 +03:00
|
|
|
RefPtr<GLContext> gl = gl::GLContextProvider::CreateForWindow(mirrorScreenWidget, false);
|
2015-08-08 23:50:47 +03:00
|
|
|
mirrorScreenWidget->SetNativeData(NS_NATIVE_OPENGL_CONTEXT,
|
|
|
|
reinterpret_cast<uintptr_t>(gl.get()));
|
|
|
|
surface = mirrorScreen->GetEGLSurface();
|
|
|
|
if (surface == LOCAL_EGL_NO_SURFACE) {
|
|
|
|
// Failed to create EGLSurface
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GLContext* gl = compositor->gl();
|
|
|
|
GLContextEGL* egl = GLContextEGL::Cast(gl);
|
2015-11-12 16:44:43 +03:00
|
|
|
const IntSize windowSize = mirrorScreen->GetNaturalBounds().Size().ToUnknownSize();
|
2015-08-08 23:50:47 +03:00
|
|
|
#endif
|
|
|
|
|
2015-04-11 05:14:00 +03:00
|
|
|
if ((windowSize.width <= 0) || (windowSize.height <= 0)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-08-08 23:50:47 +03:00
|
|
|
ScreenRotation rotation = compositor->GetScreenRotation();
|
|
|
|
|
2015-04-11 05:14:00 +03:00
|
|
|
const int actualWidth = windowSize.width;
|
|
|
|
const int actualHeight = windowSize.height;
|
|
|
|
|
|
|
|
const gfx::IntSize originalSize = compositor->GetDestinationSurfaceSize();
|
2015-08-08 23:50:47 +03:00
|
|
|
const nsIntRect originalRect = nsIntRect(0, 0, originalSize.width, originalSize.height);
|
2015-04-11 05:14:00 +03:00
|
|
|
|
2015-08-08 23:50:47 +03:00
|
|
|
int pageWidth = originalSize.width;
|
|
|
|
int pageHeight = originalSize.height;
|
|
|
|
if (rotation == ROTATION_90 || rotation == ROTATION_270) {
|
|
|
|
pageWidth = originalSize.height;
|
|
|
|
pageHeight = originalSize.width;
|
|
|
|
}
|
2015-04-11 05:14:00 +03:00
|
|
|
|
|
|
|
float scale = 1.0;
|
|
|
|
|
|
|
|
if ((pageWidth > actualWidth) || (pageHeight > actualHeight)) {
|
|
|
|
const float scaleWidth = (float)actualWidth / (float)pageWidth;
|
|
|
|
const float scaleHeight = (float)actualHeight / (float)pageHeight;
|
|
|
|
scale = scaleWidth <= scaleHeight ? scaleWidth : scaleHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
const gfx::IntSize actualSize(actualWidth, actualHeight);
|
|
|
|
ScopedCompostitorSurfaceSize overrideSurfaceSize(compositor, actualSize);
|
|
|
|
|
|
|
|
const ScreenPoint offset((actualWidth - (int)(scale * pageWidth)) / 2, 0);
|
|
|
|
ScopedContextSurfaceOverride overrideSurface(egl, surface);
|
|
|
|
|
2015-08-08 23:50:47 +03:00
|
|
|
Matrix viewMatrix = ComputeTransformForRotation(originalRect,
|
|
|
|
rotation);
|
|
|
|
viewMatrix.Invert(); // unrotate
|
|
|
|
viewMatrix.PostScale(scale, scale);
|
|
|
|
viewMatrix.PostTranslate(offset.x, offset.y);
|
|
|
|
Matrix4x4 matrix = Matrix4x4::From2D(viewMatrix);
|
|
|
|
|
|
|
|
mRoot->ComputeEffectiveTransforms(matrix);
|
|
|
|
nsIntRegion opaque;
|
2015-11-23 22:45:53 +03:00
|
|
|
LayerIntRegion visible;
|
2015-12-03 00:54:03 +03:00
|
|
|
PostProcessLayers(mRoot, opaque, visible, Nothing());
|
2015-08-08 23:50:47 +03:00
|
|
|
|
2015-04-11 05:14:00 +03:00
|
|
|
nsIntRegion invalid;
|
2016-05-13 23:15:17 +03:00
|
|
|
IntRect bounds(0, 0, scale * pageWidth, actualHeight);
|
|
|
|
IntRect rect, actualBounds;
|
2016-02-25 22:38:05 +03:00
|
|
|
MOZ_ASSERT(mRoot->GetOpacity() == 1);
|
2016-04-05 04:25:04 +03:00
|
|
|
mCompositor->BeginFrame(invalid, nullptr, bounds, nsIntRegion(), &rect, &actualBounds);
|
2015-04-11 05:14:00 +03:00
|
|
|
|
|
|
|
// The Java side of Fennec sets a scissor rect that accounts for
|
|
|
|
// chrome such as the URL bar. Override that so that the entire frame buffer
|
|
|
|
// is cleared.
|
2015-08-08 23:50:47 +03:00
|
|
|
ScopedScissorRect scissorRect(egl, 0, 0, actualWidth, actualHeight);
|
2015-04-11 05:14:00 +03:00
|
|
|
egl->fClearColor(0.0, 0.0, 0.0, 0.0);
|
|
|
|
egl->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
|
|
|
|
|
2015-08-08 23:50:47 +03:00
|
|
|
const IntRect clipRect = IntRect(0, 0, actualWidth, actualHeight);
|
|
|
|
|
2015-11-10 02:22:25 +03:00
|
|
|
RootLayer()->Prepare(RenderTargetIntRect::FromUnknownRect(clipRect));
|
2015-04-11 05:14:00 +03:00
|
|
|
RootLayer()->RenderLayer(clipRect);
|
|
|
|
|
|
|
|
mCompositor->EndFrame();
|
2015-08-08 23:50:47 +03:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
2016-05-12 03:09:43 +03:00
|
|
|
mCompositor->SetDispAcquireFence(mRoot); // Call after EndFrame()
|
2015-08-13 16:52:49 +03:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<Composer2D> composer2D;
|
2015-08-08 23:50:47 +03:00
|
|
|
composer2D = mCompositor->GetWidget()->GetComposer2D();
|
|
|
|
if (composer2D) {
|
|
|
|
composer2D->Render(mirrorScreenWidget);
|
|
|
|
}
|
|
|
|
#endif
|
2015-04-11 05:14:00 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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 13:20:52 +04:00
|
|
|
static void
|
|
|
|
SubtractTransformedRegion(nsIntRegion& aRegion,
|
|
|
|
const nsIntRegion& aRegionToSubtract,
|
2014-08-01 16:31:47 +04: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 13:20:52 +04: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.
|
2016-01-19 04:20:58 +03:00
|
|
|
for (auto iter = aRegionToSubtract.RectIter(); !iter.Done(); iter.Next()) {
|
|
|
|
const IntRect& rect = iter.Get();
|
|
|
|
Rect incompleteRect = aTransform.TransformAndClipBounds(IntRectToRect(rect),
|
2015-08-07 03:26:09 +03:00
|
|
|
Rect::MaxIntRect());
|
2015-05-07 12:07:42 +03:00
|
|
|
aRegion.Sub(aRegion, IntRect(incompleteRect.x,
|
2016-01-19 04:20:58 +03:00
|
|
|
incompleteRect.y,
|
|
|
|
incompleteRect.width,
|
|
|
|
incompleteRect.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 13:20:52 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */ void
|
|
|
|
LayerManagerComposite::ComputeRenderIntegrityInternal(Layer* aLayer,
|
|
|
|
nsIntRegion& aScreenRegion,
|
|
|
|
nsIntRegion& aLowPrecisionScreenRegion,
|
2014-08-01 16:31:47 +04: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 13:20:52 +04:00
|
|
|
{
|
2016-03-10 12:20:40 +03:00
|
|
|
ForEachNode<ForwardIterator>(
|
|
|
|
aLayer,
|
|
|
|
[&aScreenRegion, &aLowPrecisionScreenRegion, &aTransform] (Layer* layer)
|
|
|
|
{
|
|
|
|
if (layer->GetOpacity() <= 0.f ||
|
|
|
|
(aScreenRegion.IsEmpty() && aLowPrecisionScreenRegion.IsEmpty())) {
|
|
|
|
return TraversalFlag::Skip;
|
|
|
|
}
|
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 13:20:52 +04:00
|
|
|
|
2016-03-10 12:20:40 +03:00
|
|
|
// If the layer's a container, recurse into all of its children
|
|
|
|
ContainerLayer* container = layer->AsContainerLayer();
|
|
|
|
if (container) {
|
|
|
|
// Accumulate the transform of intermediate surfaces
|
|
|
|
Matrix4x4 transform = aTransform;
|
|
|
|
if (container->UseIntermediateSurface()) {
|
|
|
|
transform = layer->GetEffectiveTransform();
|
|
|
|
transform = aTransform * transform;
|
|
|
|
}
|
|
|
|
return TraversalFlag::Continue;
|
|
|
|
}
|
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 13:20:52 +04:00
|
|
|
|
2016-03-10 12:20:40 +03:00
|
|
|
// Only painted layers can be incomplete
|
|
|
|
PaintedLayer* paintedLayer = layer->AsPaintedLayer();
|
|
|
|
if (!paintedLayer || !container) {
|
|
|
|
return TraversalFlag::Skip;
|
|
|
|
}
|
|
|
|
// See if there's any incomplete rendering
|
|
|
|
nsIntRegion incompleteRegion = layer->GetLocalVisibleRegion().ToUnknownRegion();
|
|
|
|
incompleteRegion.Sub(incompleteRegion, paintedLayer->GetValidRegion());
|
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 13:20:52 +04:00
|
|
|
|
|
|
|
if (!incompleteRegion.IsEmpty()) {
|
2016-03-10 12:20:40 +03:00
|
|
|
// Calculate the transform to get between screen and layer space
|
|
|
|
Matrix4x4 transformToScreen = layer->GetEffectiveTransform();
|
|
|
|
transformToScreen = aTransform * transformToScreen;
|
|
|
|
|
|
|
|
SubtractTransformedRegion(aScreenRegion, incompleteRegion, transformToScreen);
|
|
|
|
|
|
|
|
// See if there's any incomplete low-precision rendering
|
|
|
|
TiledContentHost* composer = nullptr;
|
|
|
|
LayerComposite* shadow = layer->AsLayerComposite();
|
|
|
|
if (shadow) {
|
|
|
|
composer = shadow->GetCompositableHost()->AsTiledContentHost();
|
|
|
|
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);
|
|
|
|
}
|
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 13:20:52 +04:00
|
|
|
}
|
2016-03-10 12:20:40 +03:00
|
|
|
return TraversalFlag::Skip;
|
|
|
|
});
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2014-08-22 23:26:56 +04:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
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 13:20:52 +04:00
|
|
|
static float
|
2013-06-10 17:05:42 +04:00
|
|
|
GetDisplayportCoverage(const CSSRect& aDisplayPort,
|
2014-08-01 16:31:47 +04:00
|
|
|
const Matrix4x4& aTransformToScreen,
|
2015-05-07 12:07:42 +03:00
|
|
|
const IntRect& aScreenRect)
|
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 13:20:52 +04:00
|
|
|
{
|
2014-08-01 16:31:47 +04: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 13:20:52 +04:00
|
|
|
transformedDisplayport.RoundOut();
|
2015-05-07 12:07:42 +03:00
|
|
|
IntRect displayport = IntRect(transformedDisplayport.x,
|
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 13:20:52 +04:00
|
|
|
transformedDisplayport.y,
|
|
|
|
transformedDisplayport.width,
|
|
|
|
transformedDisplayport.height);
|
|
|
|
if (!displayport.Contains(aScreenRect)) {
|
|
|
|
nsIntRegion coveredRegion;
|
|
|
|
coveredRegion.And(aScreenRect, displayport);
|
2013-07-31 01:10:32 +04: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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1.0f;
|
|
|
|
}
|
2014-08-22 23:26:56 +04:00
|
|
|
#endif // MOZ_WIDGET_ANDROID
|
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 13:20:52 +04:00
|
|
|
|
|
|
|
float
|
|
|
|
LayerManagerComposite::ComputeRenderIntegrity()
|
|
|
|
{
|
|
|
|
// We only ever have incomplete rendering when progressive tiles are enabled.
|
|
|
|
Layer* root = GetRoot();
|
2014-11-07 22:17:14 +03:00
|
|
|
if (!gfxPlatform::GetPlatform()->UseProgressivePaint() || !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 13:20:52 +04:00
|
|
|
return 1.f;
|
|
|
|
}
|
|
|
|
|
2014-08-28 06:13:42 +04:00
|
|
|
FrameMetrics rootMetrics = LayerMetricsWrapper::TopmostScrollableMetrics(root);
|
|
|
|
if (!rootMetrics.IsScrollable()) {
|
|
|
|
// The root may not have any scrollable metrics, in which case rootMetrics
|
|
|
|
// will just be an empty FrameMetrics. Instead use the actual metrics from
|
|
|
|
// the root layer.
|
|
|
|
rootMetrics = LayerMetricsWrapper(root).Metrics();
|
|
|
|
}
|
2015-05-07 21:44:03 +03:00
|
|
|
ParentLayerIntRect bounds = RoundedToInt(rootMetrics.GetCompositionBounds());
|
2015-05-07 12:07:42 +03:00
|
|
|
IntRect screenRect(bounds.x,
|
2014-07-04 16:12:41 +04:00
|
|
|
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 13:20:52 +04:00
|
|
|
|
|
|
|
float lowPrecisionMultiplier = 1.0f;
|
|
|
|
float highPrecisionMultiplier = 1.0f;
|
|
|
|
|
2014-08-22 23:26:56 +04:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
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 13:20:52 +04:00
|
|
|
// Use the transform on the primary scrollable layer and its FrameMetrics
|
|
|
|
// to find out how much of the viewport the current displayport covers
|
2014-08-28 06:13:41 +04:00
|
|
|
nsTArray<Layer*> rootScrollableLayers;
|
|
|
|
GetRootScrollableLayers(rootScrollableLayers);
|
|
|
|
if (rootScrollableLayers.Length() > 0) {
|
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 13:20:52 +04:00
|
|
|
// This is derived from the code in
|
2013-10-29 17:27:50 +04:00
|
|
|
// AsyncCompositionManager::TransformScrollableLayer
|
2014-08-28 06:13:41 +04:00
|
|
|
Layer* rootScrollable = rootScrollableLayers[0];
|
|
|
|
const FrameMetrics& metrics = LayerMetricsWrapper::TopmostScrollableMetrics(rootScrollable);
|
|
|
|
Matrix4x4 transform = rootScrollable->GetEffectiveTransform();
|
2015-01-17 00:15:52 +03:00
|
|
|
transform.PostScale(metrics.GetPresShellResolution(), metrics.GetPresShellResolution(), 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 13:20:52 +04:00
|
|
|
|
|
|
|
// Clip the screen rect to the document bounds
|
2014-08-01 16:31:47 +04:00
|
|
|
Rect documentBounds =
|
2014-12-27 20:48:27 +03:00
|
|
|
transform.TransformBounds(Rect(metrics.GetScrollableRect().x - metrics.GetScrollOffset().x,
|
|
|
|
metrics.GetScrollableRect().y - metrics.GetScrollOffset().y,
|
|
|
|
metrics.GetScrollableRect().width,
|
|
|
|
metrics.GetScrollableRect().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 13:20:52 +04:00
|
|
|
documentBounds.RoundOut();
|
2015-05-07 12:07:42 +03:00
|
|
|
screenRect = screenRect.Intersect(IntRect(documentBounds.x, documentBounds.y,
|
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 13:20:52 +04:00
|
|
|
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;
|
2014-12-30 22:07:57 +03:00
|
|
|
if (!metrics.GetCriticalDisplayPort().IsEmpty()) {
|
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 13:20:52 +04:00
|
|
|
hasLowPrecision = true;
|
|
|
|
highPrecisionMultiplier =
|
2014-12-30 22:07:57 +03:00
|
|
|
GetDisplayportCoverage(metrics.GetCriticalDisplayPort(), transform, screenRect);
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Work out how much of the display-port covers the screen
|
2014-12-23 18:35:58 +03:00
|
|
|
if (!metrics.GetDisplayPort().IsEmpty()) {
|
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 13:20:52 +04:00
|
|
|
if (hasLowPrecision) {
|
|
|
|
lowPrecisionMultiplier =
|
2014-12-23 18:35:58 +03:00
|
|
|
GetDisplayportCoverage(metrics.GetDisplayPort(), transform, screenRect);
|
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 13:20:52 +04:00
|
|
|
} else {
|
|
|
|
lowPrecisionMultiplier = highPrecisionMultiplier =
|
2014-12-23 18:35:58 +03:00
|
|
|
GetDisplayportCoverage(metrics.GetDisplayPort(), transform, screenRect);
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If none of the screen is covered, we have zero integrity.
|
|
|
|
if (highPrecisionMultiplier <= 0.0f && lowPrecisionMultiplier <= 0.0f) {
|
|
|
|
return 0.0f;
|
|
|
|
}
|
2014-08-22 23:26:56 +04:00
|
|
|
#endif // MOZ_WIDGET_ANDROID
|
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 13:20:52 +04:00
|
|
|
|
|
|
|
nsIntRegion screenRegion(screenRect);
|
|
|
|
nsIntRegion lowPrecisionScreenRegion(screenRect);
|
2014-08-01 16:31:47 +04: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 13:20:52 +04: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-31 01:10:32 +04: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 13:20:52 +04:00
|
|
|
float lowPrecisionIntegrity = 1.f;
|
|
|
|
if (!lowPrecisionScreenRegion.IsEqual(screenRect)) {
|
2013-07-31 01:10:32 +04: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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return ((highPrecisionIntegrity * highPrecisionMultiplier) +
|
|
|
|
(lowPrecisionIntegrity * lowPrecisionMultiplier)) / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1.f;
|
|
|
|
}
|
|
|
|
|
2014-09-26 21:06:08 +04:00
|
|
|
already_AddRefed<PaintedLayerComposite>
|
|
|
|
LayerManagerComposite::CreatePaintedLayerComposite()
|
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 13:20:52 +04:00
|
|
|
{
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-10-18 08:24:48 +03:00
|
|
|
return RefPtr<PaintedLayerComposite>(new PaintedLayerComposite(this)).forget();
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
{
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-10-18 08:24:48 +03:00
|
|
|
return RefPtr<ContainerLayerComposite>(new ContainerLayerComposite(this)).forget();
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
{
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-10-18 08:24:48 +03:00
|
|
|
return RefPtr<ImageLayerComposite>(new ImageLayerComposite(this)).forget();
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
{
|
|
|
|
if (LayerManagerComposite::mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-10-18 08:24:48 +03:00
|
|
|
return RefPtr<ColorLayerComposite>(new ColorLayerComposite(this)).forget();
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
{
|
|
|
|
if (LayerManagerComposite::mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-10-18 08:24:48 +03:00
|
|
|
return RefPtr<CanvasLayerComposite>(new CanvasLayerComposite(this)).forget();
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
{
|
|
|
|
if (LayerManagerComposite::mDestroyed) {
|
|
|
|
NS_WARNING("Call on destroyed layer manager");
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-10-18 08:24:48 +03:00
|
|
|
return RefPtr<RefLayerComposite>(new RefLayerComposite(this)).forget();
|
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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-08-28 08:44:03 +04:00
|
|
|
LayerManagerComposite::AutoAddMaskEffect::AutoAddMaskEffect(Layer* aMaskLayer,
|
2016-03-21 23:10:37 +03:00
|
|
|
EffectChain& aEffects)
|
2014-08-01 17:53:12 +04:00
|
|
|
: mCompositable(nullptr), mFailed(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 13:20:52 +04:00
|
|
|
{
|
|
|
|
if (!aMaskLayer) {
|
2013-08-28 08:44:03 +04: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 13:20:52 +04:00
|
|
|
}
|
2013-08-28 08:44:03 +04:00
|
|
|
|
2013-12-09 05:41:00 +04:00
|
|
|
mCompositable = ToLayerComposite(aMaskLayer)->GetCompositableHost();
|
2013-08-28 08:44:03 +04:00
|
|
|
if (!mCompositable) {
|
2013-04-17 09:10:50 +04:00
|
|
|
NS_WARNING("Mask layer with no compositable host");
|
2014-08-01 17:53:12 +04:00
|
|
|
mFailed = true;
|
2013-08-28 08:44:03 +04:00
|
|
|
return;
|
2013-04-17 09:10:50 +04:00
|
|
|
}
|
|
|
|
|
2016-03-21 23:10:37 +03:00
|
|
|
if (!mCompositable->AddMaskEffect(aEffects, aMaskLayer->GetEffectiveTransform())) {
|
2013-12-11 21:32:41 +04:00
|
|
|
mCompositable = nullptr;
|
2014-08-01 17:53:12 +04:00
|
|
|
mFailed = true;
|
2013-12-11 21:32:41 +04: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 13:20:52 +04:00
|
|
|
}
|
|
|
|
|
2013-08-28 08:44:03 +04:00
|
|
|
LayerManagerComposite::AutoAddMaskEffect::~AutoAddMaskEffect()
|
2013-08-02 05:12:16 +04:00
|
|
|
{
|
2013-08-28 08:44:03 +04:00
|
|
|
if (!mCompositable) {
|
2013-08-02 05:12:16 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-08-28 08:44:03 +04:00
|
|
|
mCompositable->RemoveMaskEffect();
|
2013-08-02 05:12:16 +04:00
|
|
|
}
|
|
|
|
|
2016-02-29 09:53:15 +03:00
|
|
|
void
|
|
|
|
LayerManagerComposite::ChangeCompositor(Compositor* aNewCompositor)
|
|
|
|
{
|
|
|
|
mCompositor = aNewCompositor;
|
|
|
|
mTextRenderer = new TextRenderer(aNewCompositor);
|
|
|
|
mTwoPassTmpTarget = nullptr;
|
|
|
|
}
|
|
|
|
|
2013-04-26 02:25:33 +04:00
|
|
|
LayerComposite::LayerComposite(LayerManagerComposite *aManager)
|
|
|
|
: mCompositeManager(aManager)
|
|
|
|
, mCompositor(aManager->GetCompositor())
|
|
|
|
, mShadowOpacity(1.0)
|
2013-05-16 16:34:24 +04:00
|
|
|
, mShadowTransformSetByAnimation(false)
|
2013-04-26 02:25:33 +04:00
|
|
|
, mDestroyed(false)
|
2013-10-16 01:01:42 +04:00
|
|
|
, mLayerComposited(false)
|
2013-04-26 02:25:33 +04: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 13:20:52 +04:00
|
|
|
void
|
|
|
|
LayerComposite::Destroy()
|
|
|
|
{
|
|
|
|
if (!mDestroyed) {
|
|
|
|
mDestroyed = true;
|
|
|
|
CleanupResources();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-09 13:48:29 +04: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-26 02:25:33 +04:00
|
|
|
bool
|
2013-12-20 20:46:29 +04:00
|
|
|
LayerManagerComposite::CanUseCanvasLayerForSize(const IntSize &aSize)
|
2013-04-26 02:25:33 +04:00
|
|
|
{
|
2013-09-27 04:37:19 +04:00
|
|
|
return mCompositor->CanUseCanvasLayerForSize(gfx::IntSize(aSize.width,
|
|
|
|
aSize.height));
|
2013-04-26 02:25:33 +04:00
|
|
|
}
|
|
|
|
|
2014-02-11 02:14:11 +04:00
|
|
|
void
|
|
|
|
LayerManagerComposite::NotifyShadowTreeTransaction()
|
|
|
|
{
|
|
|
|
if (mFPS) {
|
|
|
|
mFPS->NotifyShadowTreeTransaction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-15 02:11:38 +04:00
|
|
|
void
|
|
|
|
LayerComposite::SetLayerManager(LayerManagerComposite* aManager)
|
|
|
|
{
|
|
|
|
mCompositeManager = aManager;
|
|
|
|
mCompositor = aManager->GetCompositor();
|
|
|
|
}
|
|
|
|
|
2015-06-04 23:51:10 +03:00
|
|
|
bool
|
|
|
|
LayerManagerComposite::AsyncPanZoomEnabled() const
|
|
|
|
{
|
2016-05-04 03:37:34 +03:00
|
|
|
if (CompositorBridgeParent* bridge = mCompositor->GetCompositorBridgeParent()) {
|
|
|
|
return bridge->AsyncPanZoomEnabled();
|
|
|
|
}
|
|
|
|
return false;
|
2015-06-04 23:51:10 +03:00
|
|
|
}
|
|
|
|
|
2015-02-18 22:51:05 +03:00
|
|
|
nsIntRegion
|
|
|
|
LayerComposite::GetFullyRenderedRegion() {
|
2015-07-01 14:51:03 +03:00
|
|
|
if (TiledContentHost* tiled = GetCompositableHost() ? GetCompositableHost()->AsTiledContentHost()
|
|
|
|
: nullptr) {
|
2015-11-29 10:07:55 +03:00
|
|
|
nsIntRegion shadowVisibleRegion = GetShadowVisibleRegion().ToUnknownRegion();
|
2015-02-18 22:51:05 +03:00
|
|
|
// Discard the region which hasn't been drawn yet when doing
|
|
|
|
// progressive drawing. Note that if the shadow visible region
|
|
|
|
// shrunk the tiled valig region may not have discarded this yet.
|
|
|
|
shadowVisibleRegion.And(shadowVisibleRegion, tiled->GetValidRegion());
|
|
|
|
return shadowVisibleRegion;
|
|
|
|
} else {
|
2015-11-29 10:07:55 +03:00
|
|
|
return GetShadowVisibleRegion().ToUnknownRegion();
|
2015-02-18 22:51:05 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-03 17:33:43 +03:00
|
|
|
Matrix4x4
|
2016-05-01 13:54:26 +03:00
|
|
|
LayerComposite::GetShadowTransform() {
|
|
|
|
Matrix4x4 transform = mShadowTransform;
|
|
|
|
Layer* layer = GetLayer();
|
|
|
|
|
|
|
|
transform.PostScale(layer->GetPostXScale(), layer->GetPostYScale(), 1.0f);
|
|
|
|
if (const ContainerLayer* c = layer->AsContainerLayer()) {
|
|
|
|
transform.PreScale(c->GetPreXScale(), c->GetPreYScale(), 1.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
return transform;
|
|
|
|
}
|
|
|
|
|
2016-02-29 09:53:15 +03:00
|
|
|
bool
|
|
|
|
LayerComposite::HasStaleCompositor() const
|
|
|
|
{
|
|
|
|
return mCompositeManager->GetCompositor() != mCompositor;
|
|
|
|
}
|
|
|
|
|
2016-06-09 07:36:12 +03:00
|
|
|
static bool
|
|
|
|
LayerHasCheckerboardingAPZC(Layer* aLayer, Color* aOutColor)
|
|
|
|
{
|
|
|
|
bool answer = false;
|
|
|
|
for (LayerMetricsWrapper i(aLayer, LayerMetricsWrapper::StartAt::BOTTOM); i; i = i.GetParent()) {
|
|
|
|
if (!i.Metrics().IsScrollable()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (i.GetApzc() && i.GetApzc()->IsCurrentlyCheckerboarding()) {
|
|
|
|
if (aOutColor) {
|
|
|
|
*aOutColor = i.Metadata().GetBackgroundColor();
|
|
|
|
}
|
|
|
|
answer = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return answer;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
LayerComposite::NeedToDrawCheckerboarding(gfx::Color* aOutCheckerboardingColor)
|
|
|
|
{
|
|
|
|
return GetLayer()->Manager()->AsyncPanZoomEnabled() &&
|
|
|
|
(GetLayer()->GetContentFlags() & Layer::CONTENT_OPAQUE) &&
|
|
|
|
GetLayer()->IsOpaqueForVisibility() &&
|
|
|
|
LayerHasCheckerboardingAPZC(GetLayer(), aOutCheckerboardingColor);
|
|
|
|
}
|
|
|
|
|
2013-04-26 02:25:33 +04: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)
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|