mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27:45 +00:00
LibGfx: Commonize functions in P*MLoader class implementations
Problem: - Functions are duplicated in [PBM,PGM,PPM]Loader class implementations. They are functionally equivalent. This does not follow the DRY (Don't Repeat Yourself) principle. Solution: - Factor out the common functions into a separate file. - Refactor common code to generic functions. - Change `PPM_DEBUG` macro to be `PORTABLE_IMAGE_LOADER_DEBUG` to work with all the supported types. This requires adding the image type to the debug log messages for easier debugging.
This commit is contained in:
parent
6fac1abac4
commit
a95d230a3e
6 changed files with 367 additions and 685 deletions
|
@ -101,19 +101,19 @@ public:
|
|||
m_value |= value << 24;
|
||||
}
|
||||
|
||||
void set_red(u8 value)
|
||||
constexpr void set_red(u8 value)
|
||||
{
|
||||
m_value &= 0xff00ffff;
|
||||
m_value |= value << 16;
|
||||
}
|
||||
|
||||
void set_green(u8 value)
|
||||
constexpr void set_green(u8 value)
|
||||
{
|
||||
m_value &= 0xffff00ff;
|
||||
m_value |= value << 8;
|
||||
}
|
||||
|
||||
void set_blue(u8 value)
|
||||
constexpr void set_blue(u8 value)
|
||||
{
|
||||
m_value &= 0xffffff00;
|
||||
m_value |= value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue