2012-07-18 20:31:40 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; 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/. */
|
|
|
|
|
2012-07-31 04:42:26 +04:00
|
|
|
#ifndef GFX_LAYERSTYPES_H
|
|
|
|
#define GFX_LAYERSTYPES_H
|
2012-07-18 20:31:40 +04:00
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
#include <stdint.h> // for uint32_t
|
|
|
|
#include "nsPoint.h" // for nsIntPoint
|
2013-12-16 14:47:06 +04:00
|
|
|
#include "nsRegion.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
|
2014-04-26 06:34:05 +04:00
|
|
|
#include "mozilla/TypedEnumBits.h"
|
2014-01-23 22:26:41 +04:00
|
|
|
|
2013-06-06 02:14:51 +04:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
#include <ui/GraphicBuffer.h>
|
|
|
|
#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
|
|
|
#if defined(DEBUG) || defined(PR_LOGGING)
|
|
|
|
# include <stdio.h> // FILE
|
2013-08-12 03:17:23 +04:00
|
|
|
# include "prlog.h" // for PR_LOG
|
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
|
|
|
# ifndef MOZ_LAYERS_HAVE_LOG
|
|
|
|
# define MOZ_LAYERS_HAVE_LOG
|
|
|
|
# endif
|
|
|
|
# define MOZ_LAYERS_LOG(_args) \
|
|
|
|
PR_LOG(LayerManager::GetLog(), PR_LOG_DEBUG, _args)
|
|
|
|
# define MOZ_LAYERS_LOG_IF_SHADOWABLE(layer, _args) \
|
|
|
|
do { if (layer->AsShadowableLayer()) { PR_LOG(LayerManager::GetLog(), PR_LOG_DEBUG, _args); } } while (0)
|
|
|
|
#else
|
|
|
|
# define MOZ_LAYERS_LOG(_args)
|
|
|
|
# define MOZ_LAYERS_LOG_IF_SHADOWABLE(layer, _args)
|
|
|
|
#endif // if defined(DEBUG) || defined(PR_LOGGING)
|
|
|
|
|
2014-08-19 06:14:00 +04:00
|
|
|
#define INVALID_OVERLAY -1
|
|
|
|
|
2013-06-06 02:14:51 +04:00
|
|
|
namespace android {
|
|
|
|
class GraphicBuffer;
|
|
|
|
}
|
|
|
|
|
2012-07-18 20:31:40 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
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-02-25 08:23:41 +04:00
|
|
|
class TextureHost;
|
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-01-23 22:26:41 +04:00
|
|
|
#undef NONE
|
|
|
|
#undef OPAQUE
|
|
|
|
|
2015-01-26 01:22:07 +03:00
|
|
|
enum class LayersBackend : int8_t {
|
2012-07-18 20:31:40 +04:00
|
|
|
LAYERS_NONE = 0,
|
|
|
|
LAYERS_BASIC,
|
|
|
|
LAYERS_OPENGL,
|
|
|
|
LAYERS_D3D9,
|
|
|
|
LAYERS_D3D10,
|
2013-05-03 21:34:29 +04:00
|
|
|
LAYERS_D3D11,
|
2013-05-01 09:03:25 +04:00
|
|
|
LAYERS_CLIENT,
|
2012-07-18 20:31:40 +04:00
|
|
|
LAYERS_LAST
|
2015-01-26 01:22:07 +03:00
|
|
|
};
|
2012-07-31 04:42:26 +04:00
|
|
|
|
2015-01-26 01:22:07 +03:00
|
|
|
enum class BufferMode : int8_t {
|
2012-07-31 04:42:26 +04:00
|
|
|
BUFFER_NONE,
|
2014-01-23 22:26:41 +04:00
|
|
|
BUFFERED
|
2015-01-26 01:22:07 +03:00
|
|
|
};
|
2012-07-31 04:42:26 +04:00
|
|
|
|
2015-01-26 01:22:07 +03:00
|
|
|
enum class DrawRegionClip : int8_t {
|
2014-01-23 22:26:41 +04:00
|
|
|
DRAW,
|
2014-10-01 09:25:25 +04:00
|
|
|
NONE
|
2015-01-26 01:22:07 +03:00
|
|
|
};
|
2013-11-06 23:10:50 +04:00
|
|
|
|
2015-01-26 01:22:07 +03:00
|
|
|
enum class SurfaceMode : int8_t {
|
2014-01-17 18:00:00 +04:00
|
|
|
SURFACE_NONE = 0,
|
|
|
|
SURFACE_OPAQUE,
|
|
|
|
SURFACE_SINGLE_CHANNEL_ALPHA,
|
|
|
|
SURFACE_COMPONENT_ALPHA
|
2015-01-26 01:22:07 +03:00
|
|
|
};
|
2014-01-17 18:00:00 +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
|
|
|
// LayerRenderState for Composer2D
|
2013-06-06 02:14:51 +04:00
|
|
|
// We currently only support Composer2D using gralloc. If we want to be backed
|
|
|
|
// by other surfaces we will need a more generic LayerRenderState.
|
2015-01-26 01:22:07 +03:00
|
|
|
enum class LayerRenderStateFlags : int8_t {
|
2014-04-26 06:34:05 +04:00
|
|
|
LAYER_RENDER_STATE_DEFAULT = 0,
|
2014-11-18 04:02:19 +03:00
|
|
|
ORIGIN_BOTTOM_LEFT = 1 << 0,
|
2014-04-26 06:34:05 +04:00
|
|
|
BUFFER_ROTATION = 1 << 1,
|
2013-06-11 14:14:33 +04:00
|
|
|
// Notify Composer2D to swap the RB pixels of gralloc buffer
|
2014-10-30 05:32:41 +03:00
|
|
|
FORMAT_RB_SWAP = 1 << 2,
|
|
|
|
// We record opaqueness here alongside the actual surface we're going to
|
|
|
|
// render. This avoids confusion when a layer might return different kinds
|
|
|
|
// of surfaces over time (e.g. video frames).
|
|
|
|
OPAQUE = 1 << 3
|
2015-01-26 01:22:07 +03:00
|
|
|
};
|
2014-04-26 06:34:05 +04:00
|
|
|
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LayerRenderStateFlags)
|
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-06-06 02:14:51 +04:00
|
|
|
// The 'ifdef MOZ_WIDGET_GONK' sadness here is because we don't want to include
|
|
|
|
// android::sp unless we have to.
|
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
|
|
|
struct LayerRenderState {
|
2013-06-06 02:14:51 +04:00
|
|
|
LayerRenderState()
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
2014-04-26 06:34:05 +04:00
|
|
|
: mFlags(LayerRenderStateFlags::LAYER_RENDER_STATE_DEFAULT)
|
|
|
|
, mHasOwnOffset(false)
|
|
|
|
, mSurface(nullptr)
|
2014-08-19 06:14:00 +04:00
|
|
|
, mOverlayId(INVALID_OVERLAY)
|
2014-04-26 06:34:05 +04:00
|
|
|
, mTexture(nullptr)
|
2013-06-06 02:14:51 +04: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
|
|
|
{}
|
|
|
|
|
2013-06-06 02:14:51 +04:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
LayerRenderState(android::GraphicBuffer* aSurface,
|
|
|
|
const nsIntSize& aSize,
|
2014-04-26 06:34:05 +04:00
|
|
|
LayerRenderStateFlags aFlags,
|
2014-02-25 08:23:41 +04:00
|
|
|
TextureHost* aTexture)
|
2014-04-26 06:34:05 +04:00
|
|
|
: mFlags(aFlags)
|
|
|
|
, mHasOwnOffset(false)
|
|
|
|
, mSurface(aSurface)
|
2014-08-19 06:14:00 +04:00
|
|
|
, mOverlayId(INVALID_OVERLAY)
|
2013-06-06 02:14:51 +04:00
|
|
|
, mSize(aSize)
|
2014-03-03 12:15:00 +04:00
|
|
|
, mTexture(aTexture)
|
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-11-18 04:02:19 +03:00
|
|
|
bool OriginBottomLeft() const
|
|
|
|
{ return bool(mFlags & LayerRenderStateFlags::ORIGIN_BOTTOM_LEFT); }
|
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
|
|
|
|
|
|
|
bool BufferRotated() const
|
2014-04-26 06:34:05 +04:00
|
|
|
{ return bool(mFlags & LayerRenderStateFlags::BUFFER_ROTATION); }
|
2013-06-11 14:14:33 +04:00
|
|
|
|
|
|
|
bool FormatRBSwapped() const
|
2014-04-26 06:34:05 +04:00
|
|
|
{ return bool(mFlags & LayerRenderStateFlags::FORMAT_RB_SWAP); }
|
2014-08-19 06:14:00 +04:00
|
|
|
|
|
|
|
void SetOverlayId(const int32_t& aId)
|
|
|
|
{ mOverlayId = aId; }
|
2013-06-06 02:14:51 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void SetOffset(const nsIntPoint& aOffset)
|
|
|
|
{
|
|
|
|
mOffset = aOffset;
|
|
|
|
mHasOwnOffset = true;
|
|
|
|
}
|
|
|
|
|
2014-04-26 06:34:05 +04:00
|
|
|
// see LayerRenderStateFlags
|
|
|
|
LayerRenderStateFlags mFlags;
|
|
|
|
// true if mOffset is applicable
|
|
|
|
bool mHasOwnOffset;
|
|
|
|
// the location of the layer's origin on mSurface
|
|
|
|
nsIntPoint mOffset;
|
2013-06-06 02:14:51 +04:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
|
|
// surface to render
|
|
|
|
android::sp<android::GraphicBuffer> mSurface;
|
2014-08-19 06:14:00 +04:00
|
|
|
int32_t mOverlayId;
|
|
|
|
// size of mSurface
|
2013-06-06 02:14:51 +04:00
|
|
|
nsIntSize mSize;
|
2014-02-25 08:23:41 +04:00
|
|
|
TextureHost* mTexture;
|
2013-06-06 02:14:51 +04: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
|
|
|
};
|
|
|
|
|
2015-01-26 01:22:07 +03:00
|
|
|
enum class ScaleMode : int8_t {
|
2013-08-20 23:45:30 +04:00
|
|
|
SCALE_NONE,
|
2014-01-23 22:26:41 +04:00
|
|
|
STRETCH,
|
|
|
|
SENTINEL
|
|
|
|
// Unimplemented - PRESERVE_ASPECT_RATIO_CONTAIN
|
2015-01-26 01:22:07 +03:00
|
|
|
};
|
2013-08-20 23:45:30 +04:00
|
|
|
|
2013-12-16 14:47:06 +04:00
|
|
|
struct EventRegions {
|
2015-03-24 16:13:24 +03:00
|
|
|
// The hit region for a layer contains all areas on the layer that are
|
|
|
|
// sensitive to events. This region is an over-approximation and may
|
|
|
|
// contain regions that are not actually sensitive, but any such regions
|
|
|
|
// will be included in the mDispatchToContentHitRegion.
|
2013-12-16 14:47:06 +04:00
|
|
|
nsIntRegion mHitRegion;
|
2015-03-24 16:13:24 +03:00
|
|
|
// The mDispatchToContentHitRegion for a layer contains all areas for
|
|
|
|
// which the main-thread must be consulted before responding to events.
|
|
|
|
// This region will be a subregion of mHitRegion.
|
2013-12-16 14:47:06 +04:00
|
|
|
nsIntRegion mDispatchToContentHitRegion;
|
|
|
|
|
2015-03-24 16:13:24 +03:00
|
|
|
// The following regions represent the touch-action areas of this layer.
|
|
|
|
// All of these regions are approximations to the true region, but any
|
|
|
|
// variance between the approximation and the true region is guaranteed
|
|
|
|
// to be included in the mDispatchToContentHitRegion.
|
|
|
|
nsIntRegion mNoActionRegion;
|
|
|
|
nsIntRegion mHorizontalPanRegion;
|
|
|
|
nsIntRegion mVerticalPanRegion;
|
|
|
|
|
2014-11-14 15:40:14 +03:00
|
|
|
EventRegions()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
explicit EventRegions(nsIntRegion aHitRegion)
|
|
|
|
: mHitRegion(aHitRegion)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-12-16 14:47:06 +04:00
|
|
|
bool operator==(const EventRegions& aRegions) const
|
|
|
|
{
|
|
|
|
return mHitRegion == aRegions.mHitRegion &&
|
|
|
|
mDispatchToContentHitRegion == aRegions.mDispatchToContentHitRegion;
|
|
|
|
}
|
|
|
|
bool operator!=(const EventRegions& aRegions) const
|
|
|
|
{
|
|
|
|
return !(*this == aRegions);
|
|
|
|
}
|
|
|
|
|
2014-11-14 15:40:14 +03:00
|
|
|
void OrWith(const EventRegions& aOther)
|
|
|
|
{
|
|
|
|
mHitRegion.OrWith(aOther.mHitRegion);
|
|
|
|
mDispatchToContentHitRegion.OrWith(aOther.mDispatchToContentHitRegion);
|
|
|
|
}
|
|
|
|
|
2014-11-14 15:40:14 +03:00
|
|
|
void AndWith(const nsIntRegion& aRegion)
|
|
|
|
{
|
|
|
|
mHitRegion.AndWith(aRegion);
|
|
|
|
mDispatchToContentHitRegion.AndWith(aRegion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Sub(const EventRegions& aMinuend, const nsIntRegion& aSubtrahend)
|
|
|
|
{
|
|
|
|
mHitRegion.Sub(aMinuend.mHitRegion, aSubtrahend);
|
|
|
|
mDispatchToContentHitRegion.Sub(aMinuend.mDispatchToContentHitRegion, aSubtrahend);
|
|
|
|
}
|
|
|
|
|
2015-04-14 23:39:00 +03:00
|
|
|
void ApplyTranslationAndScale(float aXTrans, float aYTrans, float aXScale, float aYScale)
|
|
|
|
{
|
|
|
|
mHitRegion.ScaleRoundOut(aXScale, aYScale);
|
|
|
|
mDispatchToContentHitRegion.ScaleRoundOut(aXScale, aYScale);
|
|
|
|
mNoActionRegion.ScaleRoundOut(aXScale, aYScale);
|
|
|
|
mHorizontalPanRegion.ScaleRoundOut(aXScale, aYScale);
|
|
|
|
mVerticalPanRegion.ScaleRoundOut(aXScale, aYScale);
|
|
|
|
|
|
|
|
mHitRegion.MoveBy(aXTrans, aYTrans);
|
|
|
|
mDispatchToContentHitRegion.MoveBy(aXTrans, aYTrans);
|
|
|
|
mNoActionRegion.MoveBy(aXTrans, aYTrans);
|
|
|
|
mHorizontalPanRegion.MoveBy(aXTrans, aYTrans);
|
|
|
|
mVerticalPanRegion.MoveBy(aXTrans, aYTrans);
|
|
|
|
}
|
|
|
|
|
2014-11-14 15:40:14 +03:00
|
|
|
void Transform(const gfx3DMatrix& aTransform)
|
|
|
|
{
|
|
|
|
mHitRegion.Transform(aTransform);
|
|
|
|
mDispatchToContentHitRegion.Transform(aTransform);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsEmpty() const
|
|
|
|
{
|
|
|
|
return mHitRegion.IsEmpty()
|
|
|
|
&& mDispatchToContentHitRegion.IsEmpty();
|
|
|
|
}
|
|
|
|
|
2013-12-16 14:47:06 +04:00
|
|
|
nsCString ToString() const
|
|
|
|
{
|
|
|
|
nsCString result = mHitRegion.ToString();
|
|
|
|
result.AppendLiteral(";dispatchToContent=");
|
|
|
|
result.Append(mDispatchToContentHitRegion.ToString());
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-02-17 05:30:02 +03:00
|
|
|
// Bit flags that go on a ContainerLayer (or RefLayer) and override the
|
|
|
|
// event regions in the entire subtree below. This is needed for propagating
|
|
|
|
// various flags across processes since the child-process layout code doesn't
|
|
|
|
// know about parent-process listeners or CSS rules.
|
|
|
|
enum EventRegionsOverride {
|
|
|
|
// The default, no flags set
|
|
|
|
NoOverride = 0,
|
|
|
|
// Treat all hit regions in the subtree as dispatch-to-content
|
|
|
|
ForceDispatchToContent = (1 << 0),
|
2015-02-17 05:30:02 +03:00
|
|
|
// Treat all hit regions in the subtree as empty
|
|
|
|
ForceEmptyHitRegion = (1 << 1),
|
2015-02-17 05:30:02 +03:00
|
|
|
// OR union of all valid bit flags, for use in BitFlagsEnumSerializer
|
2015-02-17 05:30:02 +03:00
|
|
|
ALL_BITS = (1 << 2) - 1
|
2015-02-17 05:30:02 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
MOZ_ALWAYS_INLINE EventRegionsOverride
|
|
|
|
operator|(EventRegionsOverride a, EventRegionsOverride b)
|
|
|
|
{
|
|
|
|
return (EventRegionsOverride)((int)a | (int)b);
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ALWAYS_INLINE EventRegionsOverride&
|
|
|
|
operator|=(EventRegionsOverride& a, EventRegionsOverride b)
|
|
|
|
{
|
|
|
|
a = a | b;
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
} // namespace
|
2012-07-18 20:31:40 +04:00
|
|
|
|
2012-07-31 04:42:26 +04:00
|
|
|
#endif /* GFX_LAYERSTYPES_H */
|