Bug 1141979 - part4.1 - Add HSV, Lab and Depth into gfx::SurfaceFormat; r?roc draft
authorKaku Kuo <tkuo@mozilla.com>
Mon, 14 Mar 2016 19:36:00 +0800
changeset 341988 419ee2c1aaefb6bd9ac22f5df529b69d802bf550
parent 341987 6b48689920aa04e11dc3378ff569ba33036bde5d
child 341989 c9f199e7199568a6f2d63e48b54ed00280924683
push id13340
push usertkuo@mozilla.com
push dateFri, 18 Mar 2016 09:53:30 +0000
reviewersroc
bugs1141979
milestone48.0a1
Bug 1141979 - part4.1 - Add HSV, Lab and Depth into gfx::SurfaceFormat; r?roc MozReview-Commit-ID: 7ZG5ooejBq9
gfx/2d/Tools.h
gfx/2d/Types.h
--- a/gfx/2d/Tools.h
+++ b/gfx/2d/Tools.h
@@ -83,16 +83,21 @@ 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::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
@@ -50,16 +50,19 @@ enum class SurfaceFormat : int8_t {
 
   // 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