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

Feature Proposal: Rasterization of SVGs at Runtime for Eclipse Icons #2593

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Michael5601
Copy link

See the following PR in Eclipse SWT for a detailed description of the changes.

Fixes eclipse-platform/eclipse.platform.swt#1438.

@HannesWell
Copy link
Member

I just pushed the changes I made for/in our yesterdays 1:1 meeting, mainly adapt to the change that o.e.swt.svg is a fragment.

Copy link
Contributor

github-actions bot commented Dec 17, 2024

Test Results

0 files   -  1 818  0 suites   - 1 818   0s ⏱️ - 1h 30m 14s
0 tests  -  7 739  0 ✅  -  7 511  0 💤  - 228  0 ❌ ±0 
0 runs   - 24 378  0 ✅  - 23 629  0 💤  - 749  0 ❌ ±0 

Results for commit 27e477f. ± Comparison against base commit d6af2f2.

♻️ This comment has been updated with latest results.

Comment on lines 66 to 67
try (InputStream in = getStream(tempURL)) {
if (rasterizer.isSVGFile(in)) {
Copy link
Member

Choose a reason for hiding this comment

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

If we would just check the file-extension here we would save creating an InputStream for each image to render. The latter is probably a significant performance overhead.
Furthermore it would save us from making SVGRasterizerRegistry and SVGRasterizer public.

Copy link
Author

@Michael5601 Michael5601 Dec 18, 2024

Choose a reason for hiding this comment

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

Please see my comment.

We could nevertheless change the isSVGFile() call in Platform UI to a file-extension check. This way the method can't be deleted but SVGRasterizerRegistry and SVGRasterizer could be internal.

Edit: How can we make SVGRasterizer internal? It is implemented by JSVGRasterizer so it must be visible.

Copy link
Author

Choose a reason for hiding this comment

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

I made SVGRasterizerRegistry internal and changed isSVGFile to a file-extension check.

@Michael5601
Copy link
Author

I removed the added SVGs from this PR. Please see the new PR for the SVGs if you want to test this feature.

In the meantime I locally changed all PNGs I could find in Platform UI, Platform, JDT UI and SWT for testing the Performance. I had no problems whatsoever when starting Eclipse and it was also quite easy and fast to add the SVGs and change the paths. I did not delete any PNGs in this process but changed ".png" to ".svg" in most places.

I will report the performance data soon.

@@ -236,6 +236,7 @@ private static final void declareImages() {
declareImage(ISharedImages.IMG_DEF_VIEW, PATH_EVIEW + "defaultview_misc.png", true); //$NON-NLS-1$

declareImage(IWorkbenchGraphicConstants.IMG_LCL_CLOSE_VIEW, PATH_ELOCALTOOL + "close_view.png", true); //$NON-NLS-1$
declareImage(IWorkbenchGraphicConstants.IMG_LCL_PIN_VIEW, PATH_ELOCALTOOL + "pin_view.png", true); //$NON-NLS-1$
Copy link
Member

Choose a reason for hiding this comment

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

This change seems unrelated to the topic of this PR.
If this is an unintended left-over please remove it, if it's missing please add it in a separate PR.

Suggested change
declareImage(IWorkbenchGraphicConstants.IMG_LCL_PIN_VIEW, PATH_ELOCALTOOL + "pin_view.png", true); //$NON-NLS-1$
declareImage(IWorkbenchGraphicConstants.IMG_LCL_PIN_VIEW, PATH_ELOCALTOOL + "pin_view.png", true); //$NON-NLS-1$

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.

Improving Eclipse Icon Scaling by Supporting Vectorized Icons
2 participants