mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibGfx: Allow images to report that they are originally grayscale
...and implement it in JPEGLoader. Since it's easy to get the grayscale data off a Bitmap, don't add a grayscale_frame() accessor.
This commit is contained in:
parent
239da5132d
commit
d8ada20bae
Notes:
sideshowbarker
2024-07-17 11:30:54 +09:00
Author: https://github.com/nico
Commit: d8ada20bae
Pull-request: https://github.com/SerenityOS/serenity/pull/22650
Reviewed-by: https://github.com/LucasChollet ✅
2 changed files with 6 additions and 1 deletions
|
@ -2010,7 +2010,11 @@ NaturalFrameFormat JPEGImageDecoderPlugin::natural_frame_format() const
|
|||
if (m_context->state == JPEGLoadingContext::State::Error)
|
||||
return NaturalFrameFormat::RGB;
|
||||
VERIFY(m_context->state >= JPEGLoadingContext::State::HeaderDecoded);
|
||||
return m_context->components.size() == 4 ? NaturalFrameFormat::CMYK : NaturalFrameFormat::RGB;
|
||||
if (m_context->components.size() == 1)
|
||||
return NaturalFrameFormat::Grayscale;
|
||||
if (m_context->components.size() == 4)
|
||||
return NaturalFrameFormat::CMYK;
|
||||
return NaturalFrameFormat::RGB;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<CMYKBitmap>> JPEGImageDecoderPlugin::cmyk_frame()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue