mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:27:45 +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
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);
|
sample = sample.slice(bytes_per_component);
|
||||||
component_values[i] = Value { component_value_decoders[i].interpolate(component[0]) };
|
component_values[i] = Value { component_value_decoders[i].interpolate(component[0]) };
|
||||||
}
|
}
|
||||||
auto color = TRY(color_space->style(component_values));
|
auto color = TRY(color_space->style(component_values)).get<Color>();
|
||||||
if (color.has<Color>()) {
|
bitmap->set_pixel(x, y, 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)));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
++x;
|
++x;
|
||||||
if (x == width) {
|
if (x == width) {
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue