2012-05-21 15:12:37 +04: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/. */
|
|
|
|
|
2012-06-15 02:00:44 +04:00
|
|
|
#ifndef GFX_2D_GLUE_H
|
|
|
|
#define GFX_2D_GLUE_H
|
|
|
|
|
2011-06-24 21:41:18 +04:00
|
|
|
|
2012-05-26 08:38:17 +04:00
|
|
|
#include "gfxPlatform.h"
|
2011-06-24 21:41:18 +04:00
|
|
|
#include "gfxRect.h"
|
2012-01-05 11:17:51 +04:00
|
|
|
#include "gfxMatrix.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
|
|
|
#include "gfx3DMatrix.h"
|
2012-01-05 11:17:51 +04:00
|
|
|
#include "gfxContext.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
|
|
|
#include "mozilla/gfx/Matrix.h"
|
2011-06-24 21:41:18 +04:00
|
|
|
#include "mozilla/gfx/Rect.h"
|
2012-01-05 11:17:51 +04:00
|
|
|
#include "mozilla/gfx/2D.h"
|
2013-10-08 03:15:59 +04:00
|
|
|
#include "gfxColor.h"
|
2011-06-24 21:41:18 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
|
|
|
class SourceSurface;
|
|
|
|
class ScaledFont;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
inline Rect ToRect(const gfxRect &aRect)
|
|
|
|
{
|
|
|
|
return Rect(Float(aRect.x), Float(aRect.y),
|
|
|
|
Float(aRect.width), Float(aRect.height));
|
|
|
|
}
|
|
|
|
|
2013-10-24 18:35:29 +04:00
|
|
|
inline Rect ToRect(const nsIntRect &aRect)
|
|
|
|
{
|
|
|
|
return Rect(aRect.x, aRect.y, aRect.width, aRect.height);
|
|
|
|
}
|
|
|
|
|
2013-08-13 17:44:53 +04:00
|
|
|
inline IntRect ToIntRect(const nsIntRect &aRect)
|
|
|
|
{
|
|
|
|
return IntRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
|
|
|
}
|
|
|
|
|
2012-01-05 11:17:51 +04:00
|
|
|
inline Color ToColor(const gfxRGBA &aRGBA)
|
|
|
|
{
|
|
|
|
return Color(Float(aRGBA.r), Float(aRGBA.g),
|
|
|
|
Float(aRGBA.b), Float(aRGBA.a));
|
|
|
|
}
|
|
|
|
|
2014-06-10 10:02:22 +04:00
|
|
|
inline gfxRGBA ThebesColor(Color &aColor)
|
|
|
|
{
|
|
|
|
return gfxRGBA(aColor.r, aColor.g, aColor.b, aColor.a);
|
|
|
|
}
|
|
|
|
|
2012-01-05 11:17:51 +04:00
|
|
|
inline Matrix ToMatrix(const gfxMatrix &aMatrix)
|
|
|
|
{
|
|
|
|
return Matrix(Float(aMatrix.xx), Float(aMatrix.yx), Float(aMatrix.xy),
|
|
|
|
Float(aMatrix.yy), Float(aMatrix.x0), Float(aMatrix.y0));
|
|
|
|
}
|
|
|
|
|
2013-12-16 02:17:58 +04:00
|
|
|
inline gfxMatrix ThebesMatrix(const Matrix &aMatrix)
|
|
|
|
{
|
|
|
|
return gfxMatrix(aMatrix._11, aMatrix._12, aMatrix._21,
|
|
|
|
aMatrix._22, aMatrix._31, aMatrix._32);
|
|
|
|
}
|
|
|
|
|
2012-01-05 11:17:51 +04:00
|
|
|
inline Point ToPoint(const gfxPoint &aPoint)
|
|
|
|
{
|
|
|
|
return Point(Float(aPoint.x), Float(aPoint.y));
|
|
|
|
}
|
|
|
|
|
2014-04-02 10:45:02 +04:00
|
|
|
inline IntPoint ToIntPoint(const nsIntPoint &aPoint)
|
|
|
|
{
|
|
|
|
return IntPoint(aPoint.x, aPoint.y);
|
|
|
|
}
|
|
|
|
|
2012-01-05 11:17:51 +04:00
|
|
|
inline Size ToSize(const gfxSize &aSize)
|
|
|
|
{
|
|
|
|
return Size(Float(aSize.width), Float(aSize.height));
|
|
|
|
}
|
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
inline IntSize ToIntSize(const gfxIntSize &aSize)
|
|
|
|
{
|
|
|
|
return IntSize(aSize.width, aSize.height);
|
|
|
|
}
|
|
|
|
|
2013-10-02 01:01:19 +04:00
|
|
|
inline Filter ToFilter(GraphicsFilter aFilter)
|
2012-01-05 11:17:51 +04:00
|
|
|
{
|
|
|
|
switch (aFilter) {
|
2013-10-02 01:01:19 +04:00
|
|
|
case GraphicsFilter::FILTER_NEAREST:
|
2014-01-10 23:06:17 +04:00
|
|
|
return Filter::POINT;
|
2013-10-02 01:01:19 +04:00
|
|
|
case GraphicsFilter::FILTER_GOOD:
|
2014-01-10 23:06:17 +04:00
|
|
|
return Filter::GOOD;
|
2012-01-05 11:17:51 +04:00
|
|
|
default:
|
2014-01-10 23:06:17 +04:00
|
|
|
return Filter::LINEAR;
|
2012-01-05 11:17:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-02 01:01:19 +04:00
|
|
|
inline GraphicsFilter ThebesFilter(Filter aFilter)
|
2012-01-05 11:17:51 +04:00
|
|
|
{
|
|
|
|
switch (aFilter) {
|
2014-01-10 23:06:17 +04:00
|
|
|
case Filter::POINT:
|
2013-10-02 01:01:19 +04:00
|
|
|
return GraphicsFilter::FILTER_NEAREST;
|
2012-01-05 11:17:51 +04:00
|
|
|
default:
|
2013-10-02 01:01:19 +04:00
|
|
|
return GraphicsFilter::FILTER_BEST;
|
2012-01-05 11:17:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline ExtendMode ToExtendMode(gfxPattern::GraphicsExtend aExtend)
|
|
|
|
{
|
|
|
|
switch (aExtend) {
|
|
|
|
case gfxPattern::EXTEND_REPEAT:
|
2014-01-10 23:06:17 +04:00
|
|
|
return ExtendMode::REPEAT;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxPattern::EXTEND_REFLECT:
|
2014-01-10 23:06:17 +04:00
|
|
|
return ExtendMode::REFLECT;
|
2012-01-05 11:17:51 +04:00
|
|
|
default:
|
2014-01-10 23:06:17 +04:00
|
|
|
return ExtendMode::CLAMP;
|
2012-01-05 11:17:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline gfxPattern::GraphicsExtend ThebesExtend(ExtendMode aExtend)
|
|
|
|
{
|
|
|
|
switch (aExtend) {
|
2014-01-10 23:06:17 +04:00
|
|
|
case ExtendMode::REPEAT:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxPattern::EXTEND_REPEAT;
|
2014-01-10 23:06:17 +04:00
|
|
|
case ExtendMode::REFLECT:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxPattern::EXTEND_REFLECT;
|
|
|
|
default:
|
|
|
|
return gfxPattern::EXTEND_PAD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline gfxPoint ThebesPoint(const Point &aPoint)
|
|
|
|
{
|
|
|
|
return gfxPoint(aPoint.x, aPoint.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline gfxSize ThebesSize(const Size &aSize)
|
|
|
|
{
|
|
|
|
return gfxSize(aSize.width, aSize.height);
|
|
|
|
}
|
|
|
|
|
2012-01-27 22:09:09 +04:00
|
|
|
inline gfxIntSize ThebesIntSize(const IntSize &aSize)
|
|
|
|
{
|
|
|
|
return gfxIntSize(aSize.width, aSize.height);
|
|
|
|
}
|
|
|
|
|
2012-01-05 11:17:51 +04:00
|
|
|
inline gfxRect ThebesRect(const Rect &aRect)
|
2011-06-24 21:41:18 +04:00
|
|
|
{
|
|
|
|
return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
|
|
|
}
|
|
|
|
|
2013-08-13 17:44:53 +04:00
|
|
|
inline nsIntRect ThebesIntRect(const IntRect &aRect)
|
|
|
|
{
|
|
|
|
return nsIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
|
|
|
}
|
|
|
|
|
2012-01-05 11:17:51 +04:00
|
|
|
inline gfxRGBA ThebesRGBA(const Color &aColor)
|
|
|
|
{
|
|
|
|
return gfxRGBA(aColor.r, aColor.g, aColor.b, aColor.a);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline gfxContext::GraphicsLineCap ThebesLineCap(CapStyle aStyle)
|
|
|
|
{
|
|
|
|
switch (aStyle) {
|
2014-01-10 23:06:17 +04:00
|
|
|
case CapStyle::BUTT:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::LINE_CAP_BUTT;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CapStyle::ROUND:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::LINE_CAP_ROUND;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CapStyle::SQUARE:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::LINE_CAP_SQUARE;
|
|
|
|
}
|
2013-06-29 05:38:30 +04:00
|
|
|
MOZ_CRASH("Incomplete switch");
|
2012-01-05 11:17:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline CapStyle ToCapStyle(gfxContext::GraphicsLineCap aStyle)
|
|
|
|
{
|
|
|
|
switch (aStyle) {
|
|
|
|
case gfxContext::LINE_CAP_BUTT:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CapStyle::BUTT;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::LINE_CAP_ROUND:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CapStyle::ROUND;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::LINE_CAP_SQUARE:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CapStyle::SQUARE;
|
2012-01-05 11:17:51 +04:00
|
|
|
}
|
2013-06-29 05:38:30 +04:00
|
|
|
MOZ_CRASH("Incomplete switch");
|
2012-01-05 11:17:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline gfxContext::GraphicsLineJoin ThebesLineJoin(JoinStyle aStyle)
|
|
|
|
{
|
|
|
|
switch (aStyle) {
|
2014-01-10 23:06:17 +04:00
|
|
|
case JoinStyle::MITER:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::LINE_JOIN_MITER;
|
2014-01-10 23:06:17 +04:00
|
|
|
case JoinStyle::BEVEL:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::LINE_JOIN_BEVEL;
|
2014-01-10 23:06:17 +04:00
|
|
|
case JoinStyle::ROUND:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::LINE_JOIN_ROUND;
|
|
|
|
default:
|
|
|
|
return gfxContext::LINE_JOIN_MITER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline JoinStyle ToJoinStyle(gfxContext::GraphicsLineJoin aStyle)
|
|
|
|
{
|
|
|
|
switch (aStyle) {
|
|
|
|
case gfxContext::LINE_JOIN_MITER:
|
2014-01-10 23:06:17 +04:00
|
|
|
return JoinStyle::MITER;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::LINE_JOIN_BEVEL:
|
2014-01-10 23:06:17 +04:00
|
|
|
return JoinStyle::BEVEL;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::LINE_JOIN_ROUND:
|
2014-01-10 23:06:17 +04:00
|
|
|
return JoinStyle::ROUND;
|
2012-01-05 11:17:51 +04:00
|
|
|
}
|
2013-06-29 05:38:30 +04:00
|
|
|
MOZ_CRASH("Incomplete switch");
|
2012-01-05 11:17:51 +04:00
|
|
|
}
|
|
|
|
|
2013-09-25 00:45:13 +04:00
|
|
|
inline gfxImageFormat SurfaceFormatToImageFormat(SurfaceFormat aFormat)
|
2012-06-15 02:00:44 +04:00
|
|
|
{
|
|
|
|
switch (aFormat) {
|
2014-01-10 23:06:16 +04:00
|
|
|
case SurfaceFormat::B8G8R8A8:
|
2014-01-23 22:26:40 +04:00
|
|
|
return gfxImageFormat::ARGB32;
|
2014-01-10 23:06:16 +04:00
|
|
|
case SurfaceFormat::B8G8R8X8:
|
2014-01-23 22:26:40 +04:00
|
|
|
return gfxImageFormat::RGB24;
|
2014-01-10 23:06:16 +04:00
|
|
|
case SurfaceFormat::R5G6B5:
|
2014-01-23 22:26:40 +04:00
|
|
|
return gfxImageFormat::RGB16_565;
|
2014-01-10 23:06:16 +04:00
|
|
|
case SurfaceFormat::A8:
|
2014-01-23 22:26:40 +04:00
|
|
|
return gfxImageFormat::A8;
|
2012-06-15 02:00:44 +04:00
|
|
|
default:
|
2014-01-23 22:26:40 +04:00
|
|
|
return gfxImageFormat::Unknown;
|
2012-06-15 02:00:44 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-25 00:45:13 +04:00
|
|
|
inline SurfaceFormat ImageFormatToSurfaceFormat(gfxImageFormat aFormat)
|
2012-04-04 01:57:22 +04:00
|
|
|
{
|
|
|
|
switch (aFormat) {
|
2014-01-23 22:26:40 +04:00
|
|
|
case gfxImageFormat::ARGB32:
|
2014-01-10 23:06:16 +04:00
|
|
|
return SurfaceFormat::B8G8R8A8;
|
2014-01-23 22:26:40 +04:00
|
|
|
case gfxImageFormat::RGB24:
|
2014-01-10 23:06:16 +04:00
|
|
|
return SurfaceFormat::B8G8R8X8;
|
2014-01-23 22:26:40 +04:00
|
|
|
case gfxImageFormat::RGB16_565:
|
2014-01-10 23:06:16 +04:00
|
|
|
return SurfaceFormat::R5G6B5;
|
2014-01-23 22:26:40 +04:00
|
|
|
case gfxImageFormat::A8:
|
2014-01-10 23:06:16 +04:00
|
|
|
return SurfaceFormat::A8;
|
2012-04-04 01:57:22 +04:00
|
|
|
default:
|
2014-01-23 22:26:40 +04:00
|
|
|
case gfxImageFormat::Unknown:
|
2014-01-10 23:06:16 +04:00
|
|
|
return SurfaceFormat::B8G8R8A8;
|
2012-04-04 01:57:22 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-25 00:45:13 +04:00
|
|
|
inline gfxContentType ContentForFormat(const SurfaceFormat &aFormat)
|
2011-06-24 21:41:18 +04:00
|
|
|
{
|
|
|
|
switch (aFormat) {
|
2014-01-10 23:06:16 +04:00
|
|
|
case SurfaceFormat::R5G6B5:
|
|
|
|
case SurfaceFormat::B8G8R8X8:
|
|
|
|
case SurfaceFormat::R8G8B8X8:
|
2014-01-23 22:26:40 +04:00
|
|
|
return gfxContentType::COLOR;
|
2014-01-10 23:06:16 +04:00
|
|
|
case SurfaceFormat::A8:
|
2014-01-23 22:26:40 +04:00
|
|
|
return gfxContentType::ALPHA;
|
2014-01-10 23:06:16 +04:00
|
|
|
case SurfaceFormat::B8G8R8A8:
|
|
|
|
case SurfaceFormat::R8G8B8A8:
|
2011-06-24 21:41:18 +04:00
|
|
|
default:
|
2014-01-23 22:26:40 +04:00
|
|
|
return gfxContentType::COLOR_ALPHA;
|
2011-06-24 21:41:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-05 11:17:51 +04:00
|
|
|
inline CompositionOp CompositionOpForOp(gfxContext::GraphicsOperator aOp)
|
|
|
|
{
|
|
|
|
switch (aOp) {
|
|
|
|
case gfxContext::OPERATOR_ADD:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_ADD;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::OPERATOR_ATOP:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_ATOP;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::OPERATOR_IN:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_IN;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::OPERATOR_OUT:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_OUT;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::OPERATOR_SOURCE:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_SOURCE;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::OPERATOR_DEST_IN:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_DEST_IN;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::OPERATOR_DEST_OUT:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_DEST_OUT;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::OPERATOR_DEST_ATOP:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_DEST_ATOP;
|
2012-01-05 11:17:51 +04:00
|
|
|
case gfxContext::OPERATOR_XOR:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_XOR;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_MULTIPLY:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_MULTIPLY;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_SCREEN:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_SCREEN;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_OVERLAY:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_OVERLAY;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_DARKEN:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_DARKEN;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_LIGHTEN:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_LIGHTEN;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_COLOR_DODGE:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_COLOR_DODGE;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_COLOR_BURN:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_COLOR_BURN;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_HARD_LIGHT:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_HARD_LIGHT;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_SOFT_LIGHT:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_SOFT_LIGHT;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_DIFFERENCE:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_DIFFERENCE;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_EXCLUSION:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_EXCLUSION;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_HUE:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_HUE;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_SATURATION:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_SATURATION;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_COLOR:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_COLOR;
|
2012-12-13 00:28:17 +04:00
|
|
|
case gfxContext::OPERATOR_LUMINOSITY:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_LUMINOSITY;
|
2012-01-05 11:17:51 +04:00
|
|
|
default:
|
2014-01-10 23:06:17 +04:00
|
|
|
return CompositionOp::OP_OVER;
|
2012-01-05 11:17:51 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline gfxContext::GraphicsOperator ThebesOp(CompositionOp aOp)
|
|
|
|
{
|
|
|
|
switch (aOp) {
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_ADD:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::OPERATOR_ADD;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_ATOP:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::OPERATOR_ATOP;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_IN:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::OPERATOR_IN;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_OUT:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::OPERATOR_OUT;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_SOURCE:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::OPERATOR_SOURCE;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_DEST_IN:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::OPERATOR_DEST_IN;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_DEST_OUT:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::OPERATOR_DEST_OUT;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_DEST_ATOP:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::OPERATOR_DEST_ATOP;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_XOR:
|
2012-01-05 11:17:51 +04:00
|
|
|
return gfxContext::OPERATOR_XOR;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_MULTIPLY:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_MULTIPLY;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_SCREEN:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_SCREEN;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_OVERLAY:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_OVERLAY;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_DARKEN:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_DARKEN;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_LIGHTEN:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_LIGHTEN;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_COLOR_DODGE:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_COLOR_DODGE;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_COLOR_BURN:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_COLOR_BURN;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_HARD_LIGHT:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_HARD_LIGHT;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_SOFT_LIGHT:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_SOFT_LIGHT;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_DIFFERENCE:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_DIFFERENCE;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_EXCLUSION:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_EXCLUSION;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_HUE:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_HUE;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_SATURATION:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_SATURATION;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_COLOR:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_COLOR;
|
2014-01-10 23:06:17 +04:00
|
|
|
case CompositionOp::OP_LUMINOSITY:
|
2012-12-13 00:28:17 +04:00
|
|
|
return gfxContext::OPERATOR_LUMINOSITY;
|
2012-01-05 11:17:51 +04:00
|
|
|
default:
|
|
|
|
return gfxContext::OPERATOR_OVER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
inline void
|
|
|
|
ToMatrix4x4(const gfx3DMatrix& aIn, Matrix4x4& aOut)
|
|
|
|
{
|
|
|
|
aOut._11 = aIn._11;
|
|
|
|
aOut._12 = aIn._12;
|
|
|
|
aOut._13 = aIn._13;
|
|
|
|
aOut._14 = aIn._14;
|
|
|
|
aOut._21 = aIn._21;
|
|
|
|
aOut._22 = aIn._22;
|
|
|
|
aOut._23 = aIn._23;
|
|
|
|
aOut._24 = aIn._24;
|
|
|
|
aOut._31 = aIn._31;
|
|
|
|
aOut._32 = aIn._32;
|
|
|
|
aOut._33 = aIn._33;
|
|
|
|
aOut._34 = aIn._34;
|
|
|
|
aOut._41 = aIn._41;
|
|
|
|
aOut._42 = aIn._42;
|
|
|
|
aOut._43 = aIn._43;
|
|
|
|
aOut._44 = aIn._44;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
To3DMatrix(const Matrix4x4& aIn, gfx3DMatrix& aOut)
|
|
|
|
{
|
|
|
|
aOut._11 = aIn._11;
|
|
|
|
aOut._12 = aIn._12;
|
|
|
|
aOut._13 = aIn._13;
|
|
|
|
aOut._14 = aIn._14;
|
|
|
|
aOut._21 = aIn._21;
|
|
|
|
aOut._22 = aIn._22;
|
|
|
|
aOut._23 = aIn._23;
|
|
|
|
aOut._24 = aIn._24;
|
|
|
|
aOut._31 = aIn._31;
|
|
|
|
aOut._32 = aIn._32;
|
|
|
|
aOut._33 = aIn._33;
|
|
|
|
aOut._34 = aIn._34;
|
|
|
|
aOut._41 = aIn._41;
|
|
|
|
aOut._42 = aIn._42;
|
|
|
|
aOut._43 = aIn._43;
|
|
|
|
aOut._44 = aIn._44;
|
|
|
|
}
|
|
|
|
|
2011-06-24 21:41:18 +04:00
|
|
|
}
|
|
|
|
}
|
2012-06-15 02:00:44 +04:00
|
|
|
|
|
|
|
#endif
|