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

Commit a20309c

Browse files
committed
[Impeller] removed more golden test exemptions
1 parent 4d7ceb3 commit a20309c

File tree

2 files changed

+43
-45
lines changed

2 files changed

+43
-45
lines changed

impeller/golden_tests/golden_playground_test_mac.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ const std::unique_ptr<PlaygroundImpl>& GetSharedVulkanPlayground(
6363
// If you add a new playground test to the aiks unittests and you do not want it
6464
// to also be a golden test, then add the test name here.
6565
static const std::vector<std::string> kSkipTests = {
66-
IMP_AIKSTEST(GaussianBlurAnimatedBackdrop),
67-
IMP_AIKSTEST(CanRenderBackdropBlurInteractive),
68-
IMP_AIKSTEST(ClippedBlurFilterRendersCorrectlyInteractive),
69-
IMP_AIKSTEST(GradientStrokesRenderCorrectly),
70-
IMP_AIKSTEST(SolidStrokesRenderCorrectly),
71-
IMP_AIKSTEST(GaussianBlurRotatedAndClippedInteractive),
72-
IMP_AIKSTEST(CoverageOriginShouldBeAccountedForInSubpasses),
7366
// TextRotated is flakey and we can't seem to get it to stabilize on Skia
7467
// Gold.
7568
IMP_AIKSTEST(TextRotated),

impeller/playground/widgets.cc

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,43 @@
77
namespace impeller {
88

99
Point DrawPlaygroundPoint(PlaygroundPoint& point) {
10-
impeller::Point mouse_pos(ImGui::GetMousePos().x, ImGui::GetMousePos().y);
11-
if (!point.prev_mouse_pos.has_value()) {
12-
point.prev_mouse_pos = mouse_pos;
13-
}
10+
if (ImGui::GetCurrentContext()) {
11+
impeller::Point mouse_pos(ImGui::GetMousePos().x, ImGui::GetMousePos().y);
12+
if (!point.prev_mouse_pos.has_value()) {
13+
point.prev_mouse_pos = mouse_pos;
14+
}
1415

15-
if (ImGui::IsKeyPressed(ImGuiKey_R)) {
16-
point.position = point.reset_position;
17-
point.dragging = false;
18-
}
16+
if (ImGui::IsKeyPressed(ImGuiKey_R)) {
17+
point.position = point.reset_position;
18+
point.dragging = false;
19+
}
1920

20-
bool hovering =
21-
point.position.GetDistance(mouse_pos) < point.radius &&
22-
point.position.GetDistance(point.prev_mouse_pos.value()) < point.radius;
23-
if (!ImGui::IsMouseDown(0)) {
24-
point.dragging = false;
25-
} else if (hovering && ImGui::IsMouseClicked(0)) {
26-
point.dragging = true;
27-
}
28-
if (point.dragging) {
29-
point.position += mouse_pos - point.prev_mouse_pos.value();
30-
}
31-
ImGui::GetBackgroundDrawList()->AddCircleFilled(
32-
{point.position.x, point.position.y}, point.radius,
33-
ImColor(point.color.red, point.color.green, point.color.blue,
34-
(hovering || point.dragging) ? 0.6f : 0.3f));
35-
if (hovering || point.dragging) {
36-
ImGui::GetBackgroundDrawList()->AddText(
37-
{point.position.x - point.radius, point.position.y + point.radius + 10},
38-
ImColor(point.color.red, point.color.green, point.color.blue, 1.0f),
39-
impeller::SPrintF("x:%0.3f y:%0.3f", point.position.x, point.position.y)
40-
.c_str());
21+
bool hovering =
22+
point.position.GetDistance(mouse_pos) < point.radius &&
23+
point.position.GetDistance(point.prev_mouse_pos.value()) < point.radius;
24+
if (!ImGui::IsMouseDown(0)) {
25+
point.dragging = false;
26+
} else if (hovering && ImGui::IsMouseClicked(0)) {
27+
point.dragging = true;
28+
}
29+
if (point.dragging) {
30+
point.position += mouse_pos - point.prev_mouse_pos.value();
31+
}
32+
ImGui::GetBackgroundDrawList()->AddCircleFilled(
33+
{point.position.x, point.position.y}, point.radius,
34+
ImColor(point.color.red, point.color.green, point.color.blue,
35+
(hovering || point.dragging) ? 0.6f : 0.3f));
36+
if (hovering || point.dragging) {
37+
ImGui::GetBackgroundDrawList()->AddText(
38+
{point.position.x - point.radius,
39+
point.position.y + point.radius + 10},
40+
ImColor(point.color.red, point.color.green, point.color.blue, 1.0f),
41+
impeller::SPrintF("x:%0.3f y:%0.3f", point.position.x,
42+
point.position.y)
43+
.c_str());
44+
}
45+
point.prev_mouse_pos = mouse_pos;
4146
}
42-
point.prev_mouse_pos = mouse_pos;
4347
return point.position;
4448
}
4549

@@ -48,14 +52,15 @@ std::tuple<Point, Point> DrawPlaygroundLine(PlaygroundPoint& point_a,
4852
Point position_a = DrawPlaygroundPoint(point_a);
4953
Point position_b = DrawPlaygroundPoint(point_b);
5054

51-
auto dir = (position_b - position_a).Normalize() * point_a.radius;
52-
auto line_a = position_a + dir;
53-
auto line_b = position_b - dir;
54-
ImGui::GetBackgroundDrawList()->AddLine(
55-
{line_a.x, line_a.y}, {line_b.x, line_b.y},
56-
ImColor(point_b.color.red, point_b.color.green, point_b.color.blue,
57-
0.3f));
58-
55+
if (ImGui::GetCurrentContext()) {
56+
auto dir = (position_b - position_a).Normalize() * point_a.radius;
57+
auto line_a = position_a + dir;
58+
auto line_b = position_b - dir;
59+
ImGui::GetBackgroundDrawList()->AddLine(
60+
{line_a.x, line_a.y}, {line_b.x, line_b.y},
61+
ImColor(point_b.color.red, point_b.color.green, point_b.color.blue,
62+
0.3f));
63+
}
5964
return std::make_tuple(position_a, position_b);
6065
}
6166
//

0 commit comments

Comments
 (0)