From 78d849bce227479b5773607562dbc3c3df0f6b01 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 17 Feb 2023 11:15:21 -0500 Subject: [PATCH] LibGfx: Make ICCHeader use RenderingIntent enum No behavior change. --- Userland/Libraries/LibGfx/ICC/BinaryFormat.h | 2 +- Userland/Libraries/LibGfx/ICC/Profile.cpp | 13 +++++-------- Userland/Libraries/LibGfx/ICC/Profile.h | 10 +++++----- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Userland/Libraries/LibGfx/ICC/BinaryFormat.h b/Userland/Libraries/LibGfx/ICC/BinaryFormat.h index 4e6771b67c..0eb5956c00 100644 --- a/Userland/Libraries/LibGfx/ICC/BinaryFormat.h +++ b/Userland/Libraries/LibGfx/ICC/BinaryFormat.h @@ -64,7 +64,7 @@ struct ICCHeader { BigEndian device_manufacturer; BigEndian device_model; BigEndian device_attributes; - BigEndian rendering_intent; + BigEndian rendering_intent; XYZNumber pcs_illuminant; diff --git a/Userland/Libraries/LibGfx/ICC/Profile.cpp b/Userland/Libraries/LibGfx/ICC/Profile.cpp index 993b96484a..dc2f52c81e 100644 --- a/Userland/Libraries/LibGfx/ICC/Profile.cpp +++ b/Userland/Libraries/LibGfx/ICC/Profile.cpp @@ -249,14 +249,11 @@ ErrorOr parse_rendering_intent(ICCHeader const& header) { // ICC v4, 7.2.15 Rendering intent field switch (header.rendering_intent) { - case 0: - return RenderingIntent::Perceptual; - case 1: - return RenderingIntent::MediaRelativeColorimetric; - case 2: - return RenderingIntent::Saturation; - case 3: - return RenderingIntent::ICCAbsoluteColorimetric; + case RenderingIntent::Perceptual: + case RenderingIntent::MediaRelativeColorimetric: + case RenderingIntent::Saturation: + case RenderingIntent::ICCAbsoluteColorimetric: + return header.rendering_intent; } return Error::from_string_literal("ICC::Profile: Invalid rendering intent"); } diff --git a/Userland/Libraries/LibGfx/ICC/Profile.h b/Userland/Libraries/LibGfx/ICC/Profile.h index 7767512dd9..df922e6070 100644 --- a/Userland/Libraries/LibGfx/ICC/Profile.h +++ b/Userland/Libraries/LibGfx/ICC/Profile.h @@ -96,11 +96,11 @@ enum class PrimaryPlatform : u32 { StringView primary_platform_name(PrimaryPlatform); // ICC v4, 7.2.15 Rendering intent field -enum class RenderingIntent { - Perceptual, - MediaRelativeColorimetric, - Saturation, - ICCAbsoluteColorimetric, +enum class RenderingIntent : u32 { + Perceptual = 0, + MediaRelativeColorimetric = 1, + Saturation = 2, + ICCAbsoluteColorimetric = 3, }; StringView rendering_intent_name(RenderingIntent);