Skip to content

[Win32] Store 100% handle when drawing single-zoom bitmap#3429

Open
HeikoKlare wants to merge 1 commit into
eclipse-platform:masterfrom
HeikoKlare:issue-3419
Open

[Win32] Store 100% handle when drawing single-zoom bitmap#3429
HeikoKlare wants to merge 1 commit into
eclipse-platform:masterfrom
HeikoKlare:issue-3419

Conversation

@HeikoKlare

Copy link
Copy Markdown
Contributor

The GC.drawImage() operations use an Image mechanism that creates temporary handles for the requested size in case the image can be rendered at precisely the requested size or if no existing handle with a fitting size is found.
While it is reasonable to not store persistent handles for arbitrary zooms, this may not be the optimal decision when requesting the 100% version of the image. For example, an image for which just a single bitmap exists, such that it can only be reasonably used at 100% scale, it is not beneficial to not persist the handle for its 100% version, as the next request will definitely request that same size again.

This change thus improves the image loading mechanism for GC.drawImage() operations by persisting the 100% handle in case the image is requested at exactly 100% for that drawImage() operation.

Fixes #3419

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Test Results (win32)

   33 files  ±0     33 suites  ±0   5m 44s ⏱️ + 1m 28s
4 718 tests ±0  4 642 ✅ ±0  76 💤 ±0  0 ❌ ±0 
1 247 runs  ±0  1 223 ✅ ±0  24 💤 ±0  0 ❌ ±0 

Results for commit 31fd805. ± Comparison against base commit 28ddc85.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare requested a review from Copilot July 8, 2026 19:17
The GC.drawImage() operations use an Image mechanism that creates
temporary handles for the requested size in case the image can be
rendered at precisely the requested size or if no existing handle with a
fitting size is found.
While it is reasonable to not store persistent handles for arbitrary
zooms, this may not be the optimal decision when requesting the 100%
version of the image. For example, an image for which just a single
bitmap exists, such that it can only be reasonably used at 100% scale,
it is not beneficial to not persist the handle for its 100% version, as
the next request will definitely request that same size again.

This change thus improves the image loading mechanism for GC.drawImage()
operations by persisting the 100% handle in case the image is requested
at exactly 100% for that drawImage() operation.

Fixes eclipse-platform#3419

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Improves Win32 GC.drawImage() performance by ensuring the 100% image handle is persisted (instead of repeatedly creating temporary handles) when an image is requested at exactly 100% scale.

Changes:

  • Persist the 100% handle when getOrCreateImageHandleAtClosestSize(...) computes imageZoom == 100.
  • Refactor handle retrieval logic into a shared private helper (getHandleInternal(...)) and delegate getHandle(...) to it.

@HeikoKlare HeikoKlare marked this pull request as ready for review July 8, 2026 19:21
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.

SWT drawImage Performance Regression On Windows

2 participants