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

CSSTUDIO-2749 Add configuration option 'org.csstudio.display.builder.representation/svg_rendering_resolution_factor' #3197

Closed
wants to merge 2 commits into from

Conversation

abrahamwolk
Copy link
Collaborator

This pull request adds the configuration option org.csstudio.display.builder.representation/svg_rendering_resolution_factor to Phoebus.

Setting this option to a value greater than 0.0 scales the resolution that SVGs are rendered at both horizontally and vertically by that factor, at the expense of significant memory consumption: the memory consumption of rendered SVGs scales as the square of org.csstudio.display.builder.representation/svg_rendering_resolution_factor: when org.csstudio.display.builder.representation/svg_rendering_resolution_factor=1.9, then the memory consumption will be (approximately) 3.61 times larger than the memory consumption when org.csstudio.display.builder.representation/svg_rendering_resolution_factor=1.0.

The motivation for the functionality is to enable sharper rendering of SVGs when zooming in.

By default, org.csstudio.display.builder.representation/svg_rendering_resolution_factor is set to 1.0.

…representation/svg_rendering_resolution_factor'.
@@ -53,11 +54,20 @@ public class SVGHelper {
*/
public static Image loadSVG(String imageFileName, double width, double height) {
String cachedSVGFileName = imageFileName + "_" + width + "_" + height;

double svg_rendering_resolution_factor;
if (!Double.isNaN(Preferences.svg_rendering_resolution_factor) && Preferences.svg_rendering_resolution_factor > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make sense to enforce a minimum value of 1.0 instead of 0.0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would it make sense to enforce a minimum value of 1.0 instead of 0.0?

It would certainly be possible. I implemented it like this since values greater than 0 (e.g., 0.5) are meaningful: then SVGs will not appear sharp unless one zooms out.

@georgweiss
Copy link
Collaborator

Seems the scaling factor applies globally to all SVGs -> increased memory usage even if zooming is not used?

@abrahamwolk
Copy link
Collaborator Author

Seems the scaling factor applies globally to all SVGs -> increased memory usage even if zooming is not used?

Yes, this is correct.

@georgweiss
Copy link
Collaborator

ESS makes extensive (extensive!) use of SVGs. I would prefer the scaling factor to be applied only upon zoom actions.

@abrahamwolk
Copy link
Collaborator Author

I would prefer the scaling factor to be applied only upon zoom actions.

I will try to implement and evaluate this alternative approach.

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.

3 participants