From 3903fac0670f8389c5c4fab17212a25a0cdcd42c Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 4 Oct 2018 09:47:57 +0000 Subject: [PATCH] Bug 1495025 - P4. Add COLOR_16 type r=nical Depends on D7296 Differential Revision: https://phabricator.services.mozilla.com/D7316 --- gfx/2d/Tools.h | 9 +++++++++ gfx/2d/Types.h | 1 + gfx/webrender_bindings/WebRenderTypes.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/gfx/2d/Tools.h b/gfx/2d/Tools.h index 5fbb07646a2d..cdd2ff08ae45 100644 --- a/gfx/2d/Tools.h +++ b/gfx/2d/Tools.h @@ -118,6 +118,7 @@ SurfaceFormatForColorDepth(ColorDepth aColorDepth) break; case ColorDepth::COLOR_10: case ColorDepth::COLOR_12: + case ColorDepth::COLOR_16: format = SurfaceFormat::A16; break; case ColorDepth::UNKNOWN: @@ -139,6 +140,9 @@ BitDepthForColorDepth(ColorDepth aColorDepth) case ColorDepth::COLOR_12: depth = 12; break; + case ColorDepth::COLOR_16: + depth = 16; + break; case ColorDepth::UNKNOWN: MOZ_ASSERT_UNREACHABLE("invalid color depth value"); } @@ -158,6 +162,9 @@ ColorDepthForBitDepth(uint8_t aBitDepth) case 12: depth = ColorDepth::COLOR_12; break; + case 16: + depth = ColorDepth::COLOR_16; + break; default: MOZ_ASSERT_UNREACHABLE("invalid color depth value"); } @@ -179,6 +186,8 @@ RescalingFactorForColorDepth(ColorDepth aColorDepth) case ColorDepth::COLOR_12: factor = 16; break; + case ColorDepth::COLOR_16: + break; case ColorDepth::UNKNOWN: MOZ_ASSERT_UNREACHABLE("invalid color depth value"); } diff --git a/gfx/2d/Types.h b/gfx/2d/Types.h index 1ace3d81820c..6c791def8bde 100644 --- a/gfx/2d/Types.h +++ b/gfx/2d/Types.h @@ -106,6 +106,7 @@ enum class ColorDepth : uint8_t { COLOR_8, COLOR_10, COLOR_12, + COLOR_16, UNKNOWN }; diff --git a/gfx/webrender_bindings/WebRenderTypes.h b/gfx/webrender_bindings/WebRenderTypes.h index 32eb6b1b8b93..7cf82eb539c8 100644 --- a/gfx/webrender_bindings/WebRenderTypes.h +++ b/gfx/webrender_bindings/WebRenderTypes.h @@ -864,6 +864,8 @@ static inline wr::WrColorDepth ToWrColorDepth(gfx::ColorDepth aColorDepth) { 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."); }