1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef GFX_LAYERSTYPES_H
7 #define GFX_LAYERSTYPES_H
11 #if defined(DEBUG) || defined(PR_LOGGING)
12 # include <stdio.h> // FILE
14 # ifndef MOZ_LAYERS_HAVE_LOG
15 # define MOZ_LAYERS_HAVE_LOG
17 # define MOZ_LAYERS_LOG(_args) \
18 PR_LOG(LayerManager::GetLog(), PR_LOG_DEBUG, _args)
19 # define MOZ_LAYERS_LOG_IF_SHADOWABLE(layer, _args) \
20 do { if (layer->AsShadowableLayer()) { PR_LOG(LayerManager::GetLog(), PR_LOG_DEBUG, _args); } } while (0)
22 struct PRLogModuleInfo
;
23 # define MOZ_LAYERS_LOG(_args)
24 # define MOZ_LAYERS_LOG_IF_SHADOWABLE(layer, _args)
25 #endif // if defined(DEBUG) || defined(PR_LOGGING)
30 class SurfaceDescriptor
;
32 typedef uint32_t TextureFlags
;
48 // The kinds of mask layer a shader can support
49 // We rely on the items in this enum being sequential
51 MaskNone
= 0, // no mask layer
52 Mask2d
, // mask layer for layers with 2D transforms
53 Mask3d
, // mask layer for layers with 3D transforms
57 // LayerRenderState for Composer2D
58 enum LayerRenderStateFlags
{
59 LAYER_RENDER_STATE_Y_FLIPPED
= 1 << 0,
60 LAYER_RENDER_STATE_BUFFER_ROTATION
= 1 << 1
63 struct LayerRenderState
{
64 LayerRenderState() : mSurface(nullptr), mFlags(0), mHasOwnOffset(false)
67 LayerRenderState(SurfaceDescriptor
* aSurface
, uint32_t aFlags
= 0)
70 , mHasOwnOffset(false)
73 LayerRenderState(SurfaceDescriptor
* aSurface
, nsIntPoint aOffset
, uint32_t aFlags
= 0)
81 { return mFlags
& LAYER_RENDER_STATE_Y_FLIPPED
; }
83 bool BufferRotated() const
84 { return mFlags
& LAYER_RENDER_STATE_BUFFER_ROTATION
; }
86 SurfaceDescriptor
* mSurface
;
95 #endif /* GFX_LAYERSTYPES_H */