mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibGfx: Add a XYZ->XYZNumber conversion constructor
This is useful for converting XYZs back to the on-disk format.
This commit is contained in:
parent
0ca620a286
commit
0ab3f45135
Notes:
sideshowbarker
2024-07-17 02:29:45 +09:00
Author: https://github.com/nico
Commit: 0ab3f45135
Pull-request: https://github.com/SerenityOS/serenity/pull/17506
Reviewed-by: https://github.com/ADKaster
1 changed files with 10 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <LibGfx/ICC/DistinctFourCC.h>
|
||||
#include <LibGfx/ICC/Profile.h>
|
||||
#include <LibGfx/ICC/TagTypes.h>
|
||||
#include <math.h>
|
||||
|
||||
namespace Gfx::ICC {
|
||||
|
||||
|
@ -36,6 +37,15 @@ struct XYZNumber {
|
|||
BigEndian<s15Fixed16Number> y;
|
||||
BigEndian<s15Fixed16Number> z;
|
||||
|
||||
XYZNumber() = default;
|
||||
|
||||
XYZNumber(XYZ const& xyz)
|
||||
: x(round(xyz.x * 0x1'0000))
|
||||
, y(round(xyz.y * 0x1'0000))
|
||||
, z(round(xyz.z * 0x1'0000))
|
||||
{
|
||||
}
|
||||
|
||||
operator XYZ() const
|
||||
{
|
||||
return XYZ { x / (double)0x1'0000, y / (double)0x1'0000, z / (double)0x1'0000 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue