Bug 1638136 [wpt PR 23617] - Clipboard API Tests: Move permissions tests to WPT....
[gecko.git] / gfx / 2d / Swizzle.h
blobb797d7af96e76fb0b55561bafb33932f7156a4f4
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef MOZILLA_GFX_SWIZZLE_H_
8 #define MOZILLA_GFX_SWIZZLE_H_
10 #include "Point.h"
12 namespace mozilla {
13 namespace gfx {
15 /**
16 * Premultiplies source and writes it to destination. Source and destination may
17 * be the same to premultiply in-place. The source format must have an alpha
18 * channel.
20 GFX2D_API bool PremultiplyData(const uint8_t* aSrc, int32_t aSrcStride,
21 SurfaceFormat aSrcFormat, uint8_t* aDst,
22 int32_t aDstStride, SurfaceFormat aDstFormat,
23 const IntSize& aSize);
25 /**
26 * Unpremultiplies source and writes it to destination. Source and destination
27 * may be the same to unpremultiply in-place. Both the source and destination
28 * formats must have an alpha channel.
30 GFX2D_API bool UnpremultiplyData(const uint8_t* aSrc, int32_t aSrcStride,
31 SurfaceFormat aSrcFormat, uint8_t* aDst,
32 int32_t aDstStride, SurfaceFormat aDstFormat,
33 const IntSize& aSize);
35 /**
36 * Swizzles source and writes it to destination. Source and destination may be
37 * the same to swizzle in-place.
39 GFX2D_API bool SwizzleData(const uint8_t* aSrc, int32_t aSrcStride,
40 SurfaceFormat aSrcFormat, uint8_t* aDst,
41 int32_t aDstStride, SurfaceFormat aDstFormat,
42 const IntSize& aSize);
44 /**
45 * Swizzles source and writes it to destination. Source and destination may be
46 * the same to swizzle in-place.
48 typedef void (*SwizzleRowFn)(const uint8_t* aSrc, uint8_t* aDst,
49 int32_t aLength);
51 /**
52 * Get a function pointer to perform premultiplication between two formats.
54 GFX2D_API SwizzleRowFn PremultiplyRow(SurfaceFormat aSrcFormat,
55 SurfaceFormat aDstFormat);
57 /**
58 * Get a function pointer to perform unpremultiplication between two formats.
60 GFX2D_API SwizzleRowFn UnpremultiplyRow(SurfaceFormat aSrcFormat,
61 SurfaceFormat aDstFormat);
63 /**
64 * Get a function pointer to perform swizzling between two formats.
66 GFX2D_API SwizzleRowFn SwizzleRow(SurfaceFormat aSrcFormat,
67 SurfaceFormat aDstFormat);
69 } // namespace gfx
70 } // namespace mozilla
72 #endif /* MOZILLA_GFX_SWIZZLE_H_ */