2011-06-24 10:41:16 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 04:12:37 -07:00
|
|
|
* 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/. */
|
2011-06-24 10:41:16 -07:00
|
|
|
|
|
|
|
#ifndef MOZILLA_GFX_TYPES_H_
|
|
|
|
#define MOZILLA_GFX_TYPES_H_
|
|
|
|
|
2012-09-01 13:16:17 -07:00
|
|
|
#include "mozilla/NullPtr.h"
|
2011-06-24 10:41:16 -07:00
|
|
|
|
|
|
|
#include <stddef.h>
|
2013-07-30 07:25:31 -07:00
|
|
|
#include <stdint.h>
|
2011-06-24 10:41:16 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
typedef float Float;
|
|
|
|
|
|
|
|
enum SurfaceType
|
|
|
|
{
|
|
|
|
SURFACE_DATA, /* Data surface - bitmap in memory */
|
|
|
|
SURFACE_D2D1_BITMAP, /* Surface wrapping a ID2D1Bitmap */
|
|
|
|
SURFACE_D2D1_DRAWTARGET, /* Surface made from a D2D draw target */
|
|
|
|
SURFACE_CAIRO, /* Surface wrapping a cairo surface */
|
2011-12-27 21:56:11 -08:00
|
|
|
SURFACE_CAIRO_IMAGE, /* Data surface wrapping a cairo image surface */
|
2011-11-02 12:55:03 -07:00
|
|
|
SURFACE_COREGRAPHICS_IMAGE, /* Surface wrapping a CoreGraphics Image */
|
2012-01-30 22:46:54 -08:00
|
|
|
SURFACE_COREGRAPHICS_CGCONTEXT, /* Surface wrapping a CG context */
|
2012-04-03 13:25:52 -07:00
|
|
|
SURFACE_SKIA, /* Surface wrapping a Skia bitmap */
|
2012-09-24 08:02:50 -07:00
|
|
|
SURFACE_DUAL_DT, /* Snapshot of a dual drawtarget */
|
2013-07-17 05:12:22 -07:00
|
|
|
SURFACE_D2D1_1_IMAGE, /* A D2D 1.1 ID2D1Image SourceSurface */
|
2012-09-24 08:02:50 -07:00
|
|
|
SURFACE_RECORDING /* Surface used for recording */
|
2011-06-24 10:41:16 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum SurfaceFormat
|
|
|
|
{
|
|
|
|
FORMAT_B8G8R8A8,
|
|
|
|
FORMAT_B8G8R8X8,
|
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 02:20:52 -07:00
|
|
|
FORMAT_R8G8B8A8,
|
|
|
|
FORMAT_R8G8B8X8,
|
2011-11-02 12:55:03 -07:00
|
|
|
FORMAT_R5G6B5,
|
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 02:20:52 -07:00
|
|
|
FORMAT_A8,
|
|
|
|
FORMAT_YUV,
|
|
|
|
FORMAT_UNKNOWN
|
2011-06-24 10:41:16 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum BackendType
|
|
|
|
{
|
2012-07-24 17:45:58 -07:00
|
|
|
BACKEND_NONE = 0,
|
2011-06-24 10:41:16 -07:00
|
|
|
BACKEND_DIRECT2D,
|
|
|
|
BACKEND_COREGRAPHICS,
|
2012-07-31 08:17:43 -07:00
|
|
|
BACKEND_COREGRAPHICS_ACCELERATED,
|
2011-11-02 12:55:03 -07:00
|
|
|
BACKEND_CAIRO,
|
2012-09-24 08:02:50 -07:00
|
|
|
BACKEND_SKIA,
|
2013-07-17 05:12:22 -07:00
|
|
|
BACKEND_RECORDING,
|
|
|
|
BACKEND_DIRECT2D1_1
|
2011-06-24 10:41:16 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum FontType
|
|
|
|
{
|
2011-11-02 12:55:03 -07:00
|
|
|
FONT_DWRITE,
|
2011-11-17 20:00:37 -08:00
|
|
|
FONT_GDI,
|
2011-11-02 12:55:03 -07:00
|
|
|
FONT_MAC,
|
2012-01-10 10:26:59 -08:00
|
|
|
FONT_SKIA,
|
2012-01-09 10:54:44 -08:00
|
|
|
FONT_CAIRO,
|
|
|
|
FONT_COREGRAPHICS
|
2011-06-24 10:41:16 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum NativeSurfaceType
|
|
|
|
{
|
2012-01-09 13:50:01 -08:00
|
|
|
NATIVE_SURFACE_D3D10_TEXTURE,
|
2012-01-09 10:54:44 -08:00
|
|
|
NATIVE_SURFACE_CAIRO_SURFACE,
|
2013-08-22 21:53:53 -07:00
|
|
|
NATIVE_SURFACE_CAIRO_CONTEXT,
|
2012-07-31 08:17:43 -07:00
|
|
|
NATIVE_SURFACE_CGCONTEXT,
|
|
|
|
NATIVE_SURFACE_CGCONTEXT_ACCELERATED
|
2011-06-24 10:41:16 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum NativeFontType
|
|
|
|
{
|
2011-11-02 12:55:03 -07:00
|
|
|
NATIVE_FONT_DWRITE_FONT_FACE,
|
2011-11-17 20:00:37 -08:00
|
|
|
NATIVE_FONT_GDI_FONT_FACE,
|
2011-11-02 12:55:03 -07:00
|
|
|
NATIVE_FONT_MAC_FONT_FACE,
|
2012-01-10 10:26:59 -08:00
|
|
|
NATIVE_FONT_SKIA_FONT_FACE,
|
|
|
|
NATIVE_FONT_CAIRO_FONT_FACE
|
2011-06-24 10:41:16 -07:00
|
|
|
};
|
|
|
|
|
2012-05-16 15:30:10 -07:00
|
|
|
enum FontStyle
|
|
|
|
{
|
|
|
|
FONT_STYLE_NORMAL,
|
|
|
|
FONT_STYLE_ITALIC,
|
|
|
|
FONT_STYLE_BOLD,
|
|
|
|
FONT_STYLE_BOLD_ITALIC
|
|
|
|
};
|
|
|
|
|
2013-06-05 10:48:59 -07:00
|
|
|
enum FontHinting
|
|
|
|
{
|
|
|
|
FONT_HINTING_NONE,
|
|
|
|
FONT_HINTING_LIGHT,
|
|
|
|
FONT_HINTING_NORMAL,
|
|
|
|
FONT_HINTING_FULL
|
|
|
|
};
|
|
|
|
|
2012-12-12 12:28:17 -08:00
|
|
|
enum CompositionOp { OP_OVER, OP_ADD, OP_ATOP, OP_OUT, OP_IN, OP_SOURCE, OP_DEST_IN, OP_DEST_OUT, OP_DEST_OVER, OP_DEST_ATOP, OP_XOR,
|
|
|
|
OP_MULTIPLY, OP_SCREEN, OP_OVERLAY, OP_DARKEN, OP_LIGHTEN, OP_COLOR_DODGE, OP_COLOR_BURN, OP_HARD_LIGHT, OP_SOFT_LIGHT, OP_DIFFERENCE, OP_EXCLUSION, OP_HUE, OP_SATURATION, OP_COLOR, OP_LUMINOSITY, OP_COUNT };
|
2011-12-27 21:56:11 -08:00
|
|
|
enum ExtendMode { EXTEND_CLAMP, EXTEND_REPEAT, EXTEND_REFLECT };
|
2011-06-24 10:41:16 -07:00
|
|
|
enum FillRule { FILL_WINDING, FILL_EVEN_ODD };
|
2012-11-22 17:53:12 -08:00
|
|
|
enum AntialiasMode { AA_NONE, AA_GRAY, AA_SUBPIXEL, AA_DEFAULT };
|
2011-06-24 10:41:16 -07:00
|
|
|
enum Snapping { SNAP_NONE, SNAP_ALIGNED };
|
2013-07-31 11:46:25 -07:00
|
|
|
enum Filter { FILTER_GOOD, FILTER_LINEAR, FILTER_POINT };
|
2011-06-24 10:41:16 -07:00
|
|
|
enum PatternType { PATTERN_COLOR, PATTERN_SURFACE, PATTERN_LINEAR_GRADIENT, PATTERN_RADIAL_GRADIENT };
|
|
|
|
enum JoinStyle { JOIN_BEVEL, JOIN_ROUND, JOIN_MITER, JOIN_MITER_OR_BEVEL };
|
|
|
|
enum CapStyle { CAP_BUTT, CAP_ROUND, CAP_SQUARE };
|
2011-12-27 21:56:11 -08:00
|
|
|
enum SamplingBounds { SAMPLING_UNBOUNDED, SAMPLING_BOUNDED };
|
2011-06-24 10:41:16 -07:00
|
|
|
|
2011-09-24 08:51:29 -07:00
|
|
|
/* Color is stored in non-premultiplied form */
|
2011-06-24 10:41:16 -07:00
|
|
|
struct Color
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Color()
|
|
|
|
: r(0.0f), g(0.0f), b(0.0f), a(0.0f)
|
|
|
|
{}
|
|
|
|
Color(Float aR, Float aG, Float aB, Float aA)
|
|
|
|
: r(aR), g(aG), b(aB), a(aA)
|
|
|
|
{}
|
|
|
|
Color(Float aR, Float aG, Float aB)
|
|
|
|
: r(aR), g(aG), b(aB), a(1.0f)
|
|
|
|
{}
|
|
|
|
|
|
|
|
static Color FromABGR(uint32_t aColor)
|
|
|
|
{
|
|
|
|
Color newColor(((aColor >> 0) & 0xff) * (1.0f / 255.0f),
|
|
|
|
((aColor >> 8) & 0xff) * (1.0f / 255.0f),
|
|
|
|
((aColor >> 16) & 0xff) * (1.0f / 255.0f),
|
|
|
|
((aColor >> 24) & 0xff) * (1.0f / 255.0f));
|
|
|
|
|
|
|
|
return newColor;
|
|
|
|
}
|
|
|
|
|
2012-10-26 21:32:52 -07:00
|
|
|
uint32_t ToABGR() const
|
|
|
|
{
|
|
|
|
return uint32_t(r * 255.0f) | uint32_t(g * 255.0f) << 8 |
|
|
|
|
uint32_t(b * 255.0f) << 16 | uint32_t(a * 255.0f) << 24;
|
|
|
|
}
|
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
Float r, g, b, a;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GradientStop
|
|
|
|
{
|
2011-11-02 12:55:03 -07:00
|
|
|
bool operator<(const GradientStop& aOther) const {
|
|
|
|
return offset < aOther.offset;
|
|
|
|
}
|
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
Float offset;
|
|
|
|
Color color;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-11 06:51:39 -07:00
|
|
|
#if defined(XP_WIN) && defined(MOZ_GFX)
|
2012-05-03 12:21:52 -07:00
|
|
|
#ifdef GFX2D_INTERNAL
|
|
|
|
#define GFX2D_API __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define GFX2D_API __declspec(dllimport)
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define GFX2D_API
|
|
|
|
#endif
|
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
// Side constants for use in various places
|
|
|
|
namespace mozilla {
|
|
|
|
namespace css {
|
|
|
|
enum Side {eSideTop, eSideRight, eSideBottom, eSideLeft};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXX - These don't really belong here. But for now this is where they go.
|
|
|
|
#define NS_SIDE_TOP mozilla::css::eSideTop
|
|
|
|
#define NS_SIDE_RIGHT mozilla::css::eSideRight
|
|
|
|
#define NS_SIDE_BOTTOM mozilla::css::eSideBottom
|
|
|
|
#define NS_SIDE_LEFT mozilla::css::eSideLeft
|
|
|
|
|
|
|
|
#endif /* MOZILLA_GFX_TYPES_H_ */
|