From 6c80d121110e4fcc1c309bd50aabc9825dc75a93 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Fri, 26 Aug 2022 15:55:48 +0200 Subject: [PATCH] LibGPU+LibSoftGPU: Add PixelFormat::Intensity --- Userland/Libraries/LibGPU/ImageFormat.h | 2 ++ Userland/Libraries/LibSoftGPU/PixelConverter.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Userland/Libraries/LibGPU/ImageFormat.h b/Userland/Libraries/LibGPU/ImageFormat.h index 7d4dc86d11..7dc85da9b7 100644 --- a/Userland/Libraries/LibGPU/ImageFormat.h +++ b/Userland/Libraries/LibGPU/ImageFormat.h @@ -21,6 +21,7 @@ enum class PixelFormat { ColorIndex, DepthComponent, Green, + Intensity, Luminance, LuminanceAlpha, Red, @@ -77,6 +78,7 @@ static constexpr int number_of_components(PixelFormat format) case PixelFormat::ColorIndex: case PixelFormat::DepthComponent: case PixelFormat::Green: + case PixelFormat::Intensity: case PixelFormat::Luminance: case PixelFormat::Red: case PixelFormat::StencilIndex: diff --git a/Userland/Libraries/LibSoftGPU/PixelConverter.cpp b/Userland/Libraries/LibSoftGPU/PixelConverter.cpp index 5a18f28d61..a6007de5dd 100644 --- a/Userland/Libraries/LibSoftGPU/PixelConverter.cpp +++ b/Userland/Libraries/LibSoftGPU/PixelConverter.cpp @@ -45,6 +45,8 @@ static constexpr FloatVector4 decode_component_order_for_format(FloatVector4 con return { components[0], 0.f, 0.f, 0.f }; case GPU::PixelFormat::Green: return { 0.f, components[0], 0.f, 1.f }; + case GPU::PixelFormat::Intensity: + return { components[0], components[0], components[0], components[0] }; case GPU::PixelFormat::Luminance: return { components[0], components[0], components[0], 1.f }; case GPU::PixelFormat::LuminanceAlpha: @@ -72,6 +74,7 @@ static constexpr FloatVector4 encode_component_order_for_format(FloatVector4 con return { components[2], 0.f, 0.f, 0.f }; case GPU::PixelFormat::ColorIndex: case GPU::PixelFormat::DepthComponent: + case GPU::PixelFormat::Intensity: case GPU::PixelFormat::Luminance: case GPU::PixelFormat::Red: case GPU::PixelFormat::RGB: