Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move colors and their handling in own translation unit and refactor them slightly #16

Merged
merged 3 commits into from
Apr 17, 2024

Conversation

markuspg
Copy link
Contributor

This pull request moves the handling of colors out of the callbacks translation unit into an own screentest_colors one, since it seemed to not really fit there.

As an experiment all heap-allocated data structures got moved to the stack. On one hand this simplifies memory handling, but on the other hand it's against the common usage pattern of GTK, so I'm a bit in doubt if this is a smart idea or not.

Lastly I added a Doxyfile for Doxygen. I don't intend to document the entire codebase, but still having it around shouldn't do harm.

Just as information on my general intention: my plan is to work on #2 and #3 and maybe attempt to migrate to GTK 4 too. I stumbled across this blog post and since I like working on and reviving old codebases, I thought I'd tackle this challenge. I'm not keen on becoming a maintainer, but just want to make screentest fit for the next "20 years".

@markuspg markuspg force-pushed the markuspg/refactor_color_handling branch 2 times, most recently from d45a56e to 8fa66b7 Compare March 27, 2024 23:10
Doxyfile Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This Doxyfile is fairly standard. The second commit gives an overview of the deviations from the default configuration.

callbacks.c Outdated
grays[i].red = grays[i].green = grays[i].blue = i / (float)(GRAYS_MAX - 1);
grays[i].alpha = 1.0;
}
screentest_colors_init();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe it's a bit overkill, but I started to namespace identifiers with this pull request.

@markuspg markuspg force-pushed the markuspg/refactor_color_handling branch 2 times, most recently from 66e6955 to 86977eb Compare March 28, 2024 10:11
{1.0, 1.0, 0.0, 1.0},
// BLACK
{0.0, 0.0, 0.0, 1.0}};
GdkRGBA bg_col = fgcolors[SCREENTEST_COLORS_BLACK];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clang does not seem to allow this. I tried to get rid of any initialization at runtime. I'll have to see if I can work around this somehow or this step needs to be executed somewhere in main or so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I adjusted the code to initialize the bg_col and fg_col static variables with explicit values (leaving the respective reference to fgcolors as an appended comment still).

@markuspg markuspg force-pushed the markuspg/refactor_color_handling branch from 86977eb to 3f99bfb Compare March 28, 2024 17:19
@TobiX
Copy link
Owner

TobiX commented Mar 28, 2024

Interesting that GStreamer's videotestsrc contains a bunch of static test pattern which would also fit nicely with Screentest... (See https://gstreamer.freedesktop.org/documentation/videotestsrc/index.html?gi-language=c#GstVideoTestSrcPattern)

@markuspg markuspg force-pushed the markuspg/refactor_color_handling branch from 3f99bfb to 184c5b7 Compare March 28, 2024 22:19
@TobiX TobiX merged commit f30e3fc into TobiX:main Apr 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants