Bug 1495025 - P4. Add COLOR_16 type r=nical
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 04 Oct 2018 09:47:57 +0000
changeset 495700 9818fa498ba5a3c914d0e1a83ca6756c85dc8f16
parent 495699 5e7ea76f73f3f4673408c252fbd896ceb841578b
child 495701 b88586cb4fddc5d67b0321408e259e198894abde
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1495025
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1495025 - P4. Add COLOR_16 type r=nical Depends on D7296 Differential Revision: https://phabricator.services.mozilla.com/D7316
gfx/2d/Tools.h
gfx/2d/Types.h
gfx/webrender_bindings/WebRenderTypes.h
--- a/gfx/2d/Tools.h
+++ b/gfx/2d/Tools.h
@@ -113,16 +113,17 @@ static inline SurfaceFormat
 SurfaceFormatForColorDepth(ColorDepth aColorDepth)
 {
   SurfaceFormat format = SurfaceFormat::A8;
   switch (aColorDepth) {
     case ColorDepth::COLOR_8:
       break;
     case ColorDepth::COLOR_10:
     case ColorDepth::COLOR_12:
+    case ColorDepth::COLOR_16:
       format = SurfaceFormat::A16;
       break;
     case ColorDepth::UNKNOWN:
       MOZ_ASSERT_UNREACHABLE("invalid color depth value");
   }
   return format;
 }
 
@@ -134,16 +135,19 @@ BitDepthForColorDepth(ColorDepth aColorD
     case ColorDepth::COLOR_8:
       break;
     case ColorDepth::COLOR_10:
       depth = 10;
       break;
     case ColorDepth::COLOR_12:
       depth = 12;
       break;
+    case ColorDepth::COLOR_16:
+      depth = 16;
+      break;
     case ColorDepth::UNKNOWN:
       MOZ_ASSERT_UNREACHABLE("invalid color depth value");
   }
   return depth;
 }
 
 static inline ColorDepth
 ColorDepthForBitDepth(uint8_t aBitDepth)
@@ -153,16 +157,19 @@ ColorDepthForBitDepth(uint8_t aBitDepth)
     case 8:
       break;
     case 10:
       depth = ColorDepth::COLOR_10;
       break;
     case 12:
       depth = ColorDepth::COLOR_12;
       break;
+    case 16:
+      depth = ColorDepth::COLOR_16;
+      break;
     default:
       MOZ_ASSERT_UNREACHABLE("invalid color depth value");
   }
   return depth;
 }
 
 // 10 and 12 bits color depth image are using 16 bits integers for storage
 // As such we need to rescale the value from 10 or 12 bits to 16.
@@ -174,16 +181,18 @@ RescalingFactorForColorDepth(ColorDepth 
     case ColorDepth::COLOR_8:
       break;
     case ColorDepth::COLOR_10:
       factor = 64;
       break;
     case ColorDepth::COLOR_12:
       factor = 16;
       break;
+    case ColorDepth::COLOR_16:
+      break;
     case ColorDepth::UNKNOWN:
       MOZ_ASSERT_UNREACHABLE("invalid color depth value");
   }
   return factor;
 }
 
 static inline bool
 IsOpaqueFormat(SurfaceFormat aFormat) {
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -101,16 +101,17 @@ inline bool IsOpaque(SurfaceFormat aForm
     return false;
   }
 }
 
 enum class ColorDepth : uint8_t {
   COLOR_8,
   COLOR_10,
   COLOR_12,
+  COLOR_16,
   UNKNOWN
 };
 
 enum class FilterType : int8_t {
   BLEND = 0,
   TRANSFORM,
   MORPHOLOGY,
   COLOR_MATRIX,
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -859,16 +859,18 @@ static inline wr::WrYuvColorSpace ToWrYu
 static inline wr::WrColorDepth ToWrColorDepth(gfx::ColorDepth aColorDepth) {
   switch (aColorDepth) {
     case gfx::ColorDepth::COLOR_8:
       return wr::WrColorDepth::Color8;
     case gfx::ColorDepth::COLOR_10:
       return wr::WrColorDepth::Color10;
     case gfx::ColorDepth::COLOR_12:
       return wr::WrColorDepth::Color12;
+    case gfx::ColorDepth::COLOR_16:
+      return wr::WrColorDepth::Color16;
     default:
       MOZ_ASSERT_UNREACHABLE("Tried to convert invalid color depth value.");
   }
   return wr::WrColorDepth::Color8;
 }
 
 static inline wr::SyntheticItalics DegreesToSyntheticItalics(float aDegrees) {
   wr::SyntheticItalics synthetic_italics;