mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
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.
This commit is contained in:
parent
00510e40d9
commit
f7fc2df8ac
Notes:
sideshowbarker
2024-07-16 19:57:55 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/f7fc2df8ac Pull-request: https://github.com/SerenityOS/serenity/pull/22684
1 changed files with 2 additions and 10 deletions
|
@ -1139,16 +1139,8 @@ PDFErrorOr<Renderer::LoadedImage> Renderer::load_image(NonnullRefPtr<StreamObjec
|
|||
sample = sample.slice(bytes_per_component);
|
||||
component_values[i] = Value { component_value_decoders[i].interpolate(component[0]) };
|
||||
}
|
||||
auto color = TRY(color_space->style(component_values));
|
||||
if (color.has<Color>()) {
|
||||
auto c = color.get<Color>();
|
||||
bitmap->set_pixel(x, y, c);
|
||||
} else {
|
||||
auto paint_style = color.get<NonnullRefPtr<Gfx::PaintStyle>>();
|
||||
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<Color>();
|
||||
bitmap->set_pixel(x, y, color);
|
||||
++x;
|
||||
if (x == width) {
|
||||
x = 0;
|
||||
|
|
Loading…
Reference in a new issue