From f7fc2df8acceed3ba722871a32fcbedd8671f680 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 8 Jan 2024 22:26:40 -0500 Subject: [PATCH] LibPDF: Simplify load_image() a tiny bit Images can't use Pattern color spaces, so we'll always have a Color. No behavior (or perf) change. --- Userland/Libraries/LibPDF/Renderer.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index 88f1b3e0f95..15047dc66f9 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -1139,16 +1139,8 @@ PDFErrorOr Renderer::load_image(NonnullRefPtrstyle(component_values)); - if (color.has()) { - auto c = color.get(); - bitmap->set_pixel(x, y, c); - } else { - auto paint_style = color.get>(); - paint_style->paint(bitmap->rect(), [&](auto sample) { - bitmap->set_pixel(x, y, sample(Gfx::IntPoint(x, y))); - }); - } + auto color = TRY(color_space->style(component_values)).get(); + bitmap->set_pixel(x, y, color); ++x; if (x == width) { x = 0;