ICC: Move a lambda up a bit
No behavior change.
This commit is contained in:
parent
42e9dfedc2
commit
6b4da8680d
Notes:
sideshowbarker
2024-07-17 00:49:59 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/6b4da8680d Pull-request: https://github.com/SerenityOS/serenity/pull/21257 Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 8 additions and 8 deletions
|
@ -1428,6 +1428,14 @@ ErrorOr<FloatVector3> Profile::to_pcs(ReadonlyBytes color) const
|
|||
// "d) Use TRCs (redTRCTag, greenTRCTag, blueTRCTag, or grayTRCTag) and colorants
|
||||
// (redMatrixColumnTag, greenMatrixColumnTag, blueMatrixColumnTag) when tags in a), b), and c) are not
|
||||
// used."
|
||||
auto evaluate_curve = [this](TagSignature curve_tag, float f) {
|
||||
auto const& trc = *m_tag_table.get(curve_tag).value();
|
||||
VERIFY(trc.type() == CurveTagData::Type || trc.type() == ParametricCurveTagData::Type);
|
||||
if (trc.type() == CurveTagData::Type)
|
||||
return static_cast<CurveTagData const&>(trc).evaluate(f);
|
||||
return static_cast<ParametricCurveTagData const&>(trc).evaluate(f);
|
||||
};
|
||||
|
||||
if (data_color_space() == ColorSpace::Gray) {
|
||||
// ICC v4, F.2 grayTRCTag
|
||||
// FIXME
|
||||
|
@ -1447,14 +1455,6 @@ ErrorOr<FloatVector3> Profile::to_pcs(ReadonlyBytes color) const
|
|||
// [connection_X] = [redMatrixColumn_X greenMatrixColumn_X blueMatrixColumn_X] [ linear_r ]
|
||||
// [connection_Y] = [redMatrixColumn_Y greenMatrixColumn_Y blueMatrixColumn_Y] * [ linear_g ]
|
||||
// [connection_Z] = [redMatrixColumn_Z greenMatrixColumn_Z blueMatrixColumn_Z] [ linear_b ]"
|
||||
auto evaluate_curve = [this](TagSignature curve_tag, float f) {
|
||||
auto const& trc = *m_tag_table.get(curve_tag).value();
|
||||
VERIFY(trc.type() == CurveTagData::Type || trc.type() == ParametricCurveTagData::Type);
|
||||
if (trc.type() == CurveTagData::Type)
|
||||
return static_cast<CurveTagData const&>(trc).evaluate(f);
|
||||
return static_cast<ParametricCurveTagData const&>(trc).evaluate(f);
|
||||
};
|
||||
|
||||
float linear_r = evaluate_curve(redTRCTag, color[0] / 255.f);
|
||||
float linear_g = evaluate_curve(greenTRCTag, color[1] / 255.f);
|
||||
float linear_b = evaluate_curve(blueTRCTag, color[2] / 255.f);
|
||||
|
|
Loading…
Add table
Reference in a new issue