Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Hooks up framework wide gamut to engine wide gamut #54567

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion impeller/display_list/aiks_dl_vertices_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "flutter/display_list/dl_color.h"
#include "flutter/display_list/dl_paint.h"
#include "flutter/testing/testing.h"
#include "impeller/display_list/dl_dispatcher.h"
#include "impeller/display_list/dl_image_impeller.h"

namespace impeller {
Expand Down Expand Up @@ -375,7 +376,10 @@ TEST_P(AiksTest, DrawVerticesWithInvalidIndices) {
builder.DrawRect(SkRect::MakeLTRB(0, 0, 400, 400), paint);
builder.DrawVertices(vertices, flutter::DlBlendMode::kSrc, paint);

ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
AiksContext renderer(GetContext(), nullptr);
std::shared_ptr<Texture> image =
DisplayListToTexture(builder.Build(), {1024, 768}, renderer);
EXPECT_TRUE(image);
}

// All four vertices should form a solid red rectangle with no gaps.
Expand Down
13 changes: 5 additions & 8 deletions lib/ui/painting/paint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,11 @@ DlColor ReadColor(const tonic::DartByteData& byte_data) {
// Invert alpha so 0 initialized buffer has default value;
float alpha = 1.f - float_data[kColorAlphaIndex];
uint32_t colorspace = uint_data[kColorSpaceIndex];
(void)colorspace;
uint32_t encoded_color =
static_cast<uint8_t>(std::round(alpha * 255.f)) << 24 | //
static_cast<uint8_t>(std::round(red * 255.f)) << 16 | //
static_cast<uint8_t>(std::round(green * 255.f)) << 8 | //
static_cast<uint8_t>(std::round(blue * 255.f)) << 0;
// TODO(gaaclarke): Pass down color info to DlColor.
return DlColor(encoded_color);

DlColor dl_color(alpha, red, green, blue,
static_cast<DlColorSpace>(colorspace));

return dl_color.withColorSpace(DlColorSpace::kExtendedSRGB);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you also need the gradient conversions too, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're jumping ahead, that happens in #54748.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conversion happens in a different place for gradients. It was easier to do it in dart for them. We can reevaluate after we get our integration tests landed. It's ideal to do the conversion in c++.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you need to move it into the engine eventually so that we can handle android, which may have a displayP3 color space and not an extended srgb space.

}
} // namespace

Expand Down
3 changes: 0 additions & 3 deletions testing/impeller_golden_tests_output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,6 @@ impeller_Play_AiksTest_DrawVerticesTextureCoordinatesWithFragmentShaderNonZeroOr
impeller_Play_AiksTest_DrawVerticesTextureCoordinatesWithFragmentShader_Metal.png
impeller_Play_AiksTest_DrawVerticesTextureCoordinatesWithFragmentShader_OpenGLES.png
impeller_Play_AiksTest_DrawVerticesTextureCoordinatesWithFragmentShader_Vulkan.png
impeller_Play_AiksTest_DrawVerticesWithInvalidIndices_Metal.png
impeller_Play_AiksTest_DrawVerticesWithInvalidIndices_OpenGLES.png
impeller_Play_AiksTest_DrawVerticesWithInvalidIndices_Vulkan.png
impeller_Play_AiksTest_EmptySaveLayerIgnoresPaint_Metal.png
impeller_Play_AiksTest_EmptySaveLayerIgnoresPaint_OpenGLES.png
impeller_Play_AiksTest_EmptySaveLayerIgnoresPaint_Vulkan.png
Expand Down