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

Commit f31a13b

Browse files
committed
Hooks up framework wide gamut to engine wide gamut (#54567)
issue: flutter/flutter#127855 integration test: #54415 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent eff1b76 commit f31a13b

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

impeller/display_list/aiks_dl_vertices_unittests.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "flutter/display_list/dl_color.h"
1313
#include "flutter/display_list/dl_paint.h"
1414
#include "flutter/testing/testing.h"
15+
#include "impeller/display_list/dl_dispatcher.h"
1516
#include "impeller/display_list/dl_image_impeller.h"
1617

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

378-
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
379+
AiksContext renderer(GetContext(), nullptr);
380+
std::shared_ptr<Texture> image =
381+
DisplayListToTexture(builder.Build(), {1024, 768}, renderer);
382+
EXPECT_TRUE(image);
379383
}
380384

381385
// All four vertices should form a solid red rectangle with no gaps.

lib/ui/painting/paint.cc

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,11 @@ DlColor ReadColor(const tonic::DartByteData& byte_data) {
7171
// Invert alpha so 0 initialized buffer has default value;
7272
float alpha = 1.f - float_data[kColorAlphaIndex];
7373
uint32_t colorspace = uint_data[kColorSpaceIndex];
74-
(void)colorspace;
75-
uint32_t encoded_color =
76-
static_cast<uint8_t>(std::round(alpha * 255.f)) << 24 | //
77-
static_cast<uint8_t>(std::round(red * 255.f)) << 16 | //
78-
static_cast<uint8_t>(std::round(green * 255.f)) << 8 | //
79-
static_cast<uint8_t>(std::round(blue * 255.f)) << 0;
80-
// TODO(gaaclarke): Pass down color info to DlColor.
81-
return DlColor(encoded_color);
74+
75+
DlColor dl_color(alpha, red, green, blue,
76+
static_cast<DlColorSpace>(colorspace));
77+
78+
return dl_color.withColorSpace(DlColorSpace::kExtendedSRGB);
8279
}
8380
} // namespace
8481

testing/impeller_golden_tests_output.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,6 @@ impeller_Play_AiksTest_DrawVerticesTextureCoordinatesWithFragmentShaderNonZeroOr
614614
impeller_Play_AiksTest_DrawVerticesTextureCoordinatesWithFragmentShader_Metal.png
615615
impeller_Play_AiksTest_DrawVerticesTextureCoordinatesWithFragmentShader_OpenGLES.png
616616
impeller_Play_AiksTest_DrawVerticesTextureCoordinatesWithFragmentShader_Vulkan.png
617-
impeller_Play_AiksTest_DrawVerticesWithInvalidIndices_Metal.png
618-
impeller_Play_AiksTest_DrawVerticesWithInvalidIndices_OpenGLES.png
619-
impeller_Play_AiksTest_DrawVerticesWithInvalidIndices_Vulkan.png
620617
impeller_Play_AiksTest_EmptySaveLayerIgnoresPaint_Metal.png
621618
impeller_Play_AiksTest_EmptySaveLayerIgnoresPaint_OpenGLES.png
622619
impeller_Play_AiksTest_EmptySaveLayerIgnoresPaint_Vulkan.png

0 commit comments

Comments
 (0)