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
|
2014-01-23 22:26:41 +04:00
|
|
|
|
2013-06-06 02:14:51 +04:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
2015-06-08 12:27:23 +03:00
|
|
|
#include <utils/RefBase.h>
|
2016-01-06 07:50:39 +03:00
|
|
|
#include "mozilla/layers/GonkNativeHandle.h"
|
2015-09-28 16:55:48 +03:00
|
|
|
#endif
|
|
|
|
|
2016-01-07 02:56:25 +03:00
|
|
|
#include "Units.h"
|
2015-09-28 16:55:48 +03:00
|
|
|
#include "mozilla/gfx/Point.h" // for IntPoint
|
|
|
|
#include "mozilla/TypedEnumBits.h"
|
|
|
|
#include "nsRegion.h"
|
|
|
|
|
2015-05-09 00:37:01 +03:00
|
|
|
#include <stdio.h> // FILE
|
2015-05-19 21:15:34 +03:00
|
|
|
#include "mozilla/Logging.h" // for PR_LOG
|
2015-09-28 16:55:48 +03:00
|
|
|
|
2015-05-09 00:37:01 +03:00
|
|
|
#ifndef MOZ_LAYERS_HAVE_LOG
|
|
|
|
# define MOZ_LAYERS_HAVE_LOG
|
|
|
|
#endif
|
|
|
|
#define MOZ_LAYERS_LOG(_args) \
|
2015-06-04 01:25:57 +03:00
|
|
|
MOZ_LOG(LayerManager::GetLog(), LogLevel::Debug, _args)
|
2015-05-09 00:37:01 +03:00
|
|
|
#define MOZ_LAYERS_LOG_IF_SHADOWABLE(layer, _args) \
|
2015-06-04 01:25:57 +03:00
|
|
|
do { if (layer->AsShadowableLayer()) { MOZ_LOG(LayerManager::GetLog(), LogLevel::Debug, _args); } } while (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
|
|
|
|
2014-08-19 06:14:00 +04:00
|
|
|
#define INVALID_OVERLAY -1
|
|
|
|
|
2013-06-06 02:14:51 +04:00
|
|
|
namespace android {
|
2015-06-08 12:27:23 +03:00
|
|
|
class MOZ_EXPORT GraphicBuffer;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace android
|
2013-06-06 02:14:51 +04:00
|
|
|
|
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,
|
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 {
|
2015-06-08 12:27:23 +03:00
|
|
|
// Constructors and destructor are defined in LayersTypes.cpp so we don't
|
|
|
|
// have to pull in a definition for GraphicBuffer.h here. In KK at least,
|
|
|
|
// that results in nasty pollution such as libui's hardware.h #defining
|
|
|
|
// 'version_major' and 'version_minor' which conflict with Theora's codec.c...
|
|
|
|
LayerRenderState();
|
|
|
|
LayerRenderState(const LayerRenderState& aOther);
|
|
|
|
~LayerRenderState();
|
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,
|
2015-06-03 14:45:24 +03:00
|
|
|
const gfx::IntSize& aSize,
|
2014-04-26 06:34:05 +04:00
|
|
|
LayerRenderStateFlags aFlags,
|
2015-06-08 12:27:23 +03:00
|
|
|
TextureHost* 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; }
|
2015-09-28 16:55:48 +03:00
|
|
|
|
2016-01-06 07:50:39 +03:00
|
|
|
void SetSidebandStream(const GonkNativeHandle& aStream)
|
|
|
|
{
|
|
|
|
mSidebandStream = aStream;
|
|
|
|
}
|
|
|
|
|
2015-09-28 16:55:48 +03:00
|
|
|
android::GraphicBuffer* GetGrallocBuffer() const
|
|
|
|
{ return mSurface.get(); }
|
|
|
|
|
2016-01-06 07:50:39 +03:00
|
|
|
const GonkNativeHandle& GetSidebandStream()
|
|
|
|
{ return mSidebandStream; }
|
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;
|
2015-06-08 12:27:23 +03:00
|
|
|
// The 'ifdef MOZ_WIDGET_GONK' sadness here is because we don't want to include
|
|
|
|
// android::sp unless we have to.
|
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
|
2015-06-03 14:45:24 +03:00
|
|
|
gfx::IntSize mSize;
|
2014-02-25 08:23:41 +04:00
|
|
|
TextureHost* mTexture;
|
2016-01-06 07:50:39 +03:00
|
|
|
GonkNativeHandle mSidebandStream;
|
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);
|
|
|
|
}
|
|
|
|
|
2015-07-11 03:06:35 +03:00
|
|
|
void Transform(const gfx::Matrix4x4& aTransform)
|
2014-11-14 15:40:14 +03:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-09-29 01:51:37 +03:00
|
|
|
// Flags used as an argument to functions that dump textures.
|
|
|
|
enum TextureDumpMode {
|
|
|
|
Compress, // dump texture with LZ4 compression
|
|
|
|
DoNotCompress // dump texture uncompressed
|
|
|
|
};
|
|
|
|
|
2016-01-07 02:56:25 +03:00
|
|
|
// Some specialized typedefs of Matrix4x4Typed.
|
|
|
|
typedef gfx::Matrix4x4Typed<LayerPixel, CSSTransformedLayerPixel> CSSTransformMatrix;
|
|
|
|
// Several different async transforms can contribute to a layer's transform
|
|
|
|
// (specifically, an async animation can contribute a transform, and each APZC
|
|
|
|
// that scrolls a layer can contribute async scroll/zoom and overscroll
|
|
|
|
// transforms).
|
|
|
|
// To try to model this with typed units, we represent individual async
|
|
|
|
// transforms as ParentLayer -> ParentLayer transforms (aliased as
|
|
|
|
// AsyncTransformComponentMatrix), and we represent the product of all of them
|
|
|
|
// as a CSSTransformLayer -> ParentLayer transform (aliased as
|
|
|
|
// AsyncTransformMatrix). To create an AsyncTransformMatrix from component
|
|
|
|
// matrices, a ViewAs operation is needed. A MultipleAsyncTransforms
|
|
|
|
// PixelCastJustification is provided for this purpose.
|
|
|
|
typedef gfx::Matrix4x4Typed<ParentLayerPixel, ParentLayerPixel> AsyncTransformComponentMatrix;
|
|
|
|
typedef gfx::Matrix4x4Typed<CSSTransformedLayerPixel, ParentLayerPixel> AsyncTransformMatrix;
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2012-07-18 20:31:40 +04:00
|
|
|
|
2012-07-31 04:42:26 +04:00
|
|
|
#endif /* GFX_LAYERSTYPES_H */
|