Bug 1141979 - part5 - Add R8G8B8, B8G8R8, HSV, Lab and Depth into gfx::SurfaceFormat; r=jrmuizel
MozReview-Commit-ID: 7ZG5ooejBq9
--- a/gfx/2d/Tools.h
+++ b/gfx/2d/Tools.h
@@ -80,16 +80,24 @@ Distance(Point aA, Point aB)
static inline int
BytesPerPixel(SurfaceFormat aFormat)
{
switch (aFormat) {
case SurfaceFormat::A8:
return 1;
case SurfaceFormat::R5G6B5_UINT16:
return 2;
+ case SurfaceFormat::R8G8B8:
+ case SurfaceFormat::B8G8R8:
+ return 3;
+ case SurfaceFormat::HSV:
+ case SurfaceFormat::Lab:
+ return 3 * sizeof(float);
+ case SurfaceFormat::Depth:
+ return sizeof(uint16_t);
default:
return 4;
}
}
template<typename T, int alignment = 16>
struct AlignedArray
{
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -38,28 +38,34 @@ enum class SurfaceFormat : int8_t {
// in-memory 32-bit LE value 32-bit BE value
B8G8R8A8, // [BB, GG, RR, AA] 0xAARRGGBB 0xBBGGRRAA
B8G8R8X8, // [BB, GG, RR, 00] 0x00RRGGBB 0xBBGGRR00
R8G8B8A8, // [RR, GG, BB, AA] 0xAABBGGRR 0xRRGGBBAA
R8G8B8X8, // [RR, GG, BB, 00] 0x00BBGGRR 0xRRGGBB00
A8R8G8B8, // [AA, RR, GG, BB] 0xBBGGRRAA 0xAARRGGBB
X8R8G8B8, // [00, RR, GG, BB] 0xBBGGRR00 0x00RRGGBB
+ R8G8B8,
+ B8G8R8,
+
// The _UINT16 suffix here indicates that the name reflects the layout when
// viewed as a uint16_t value. In memory these values are stored using native
// endianness.
R5G6B5_UINT16, // 0bRRRRRGGGGGGBBBBB
// This one is a single-byte, so endianness isn't an issue.
A8,
// These ones are their own special cases.
YUV,
NV12,
YUV422,
+ HSV,
+ Lab,
+ Depth,
// This represents the unknown format.
UNKNOWN,
// The following values are endian-independent synonyms. The _UINT32 suffix
// indicates that the name reflects the layout when viewed as a uint32_t
// value.
#if MOZ_LITTLE_ENDIAN