Skip to content

[Win32] Fix width check in Image.HandleAtSize.isReusable#3242

Open
HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
HeikoKlare:fix-image-isReusable-width-check
Open

[Win32] Fix width check in Image.HandleAtSize.isReusable#3242
HeikoKlare wants to merge 1 commit intoeclipse-platform:masterfrom
HeikoKlare:fix-image-isReusable-width-check

Conversation

@HeikoKlare
Copy link
Copy Markdown
Contributor

@HeikoKlare HeikoKlare commented Apr 16, 2026

Summary

  • Fix copy-paste error in HandleAtSize.isReusable() where handleContainer.height() was compared against width instead of using handleContainer.width()
  • This caused unnecessary image handle recreation for non-square images, as the second condition in the || could only match when height == width

Details

In Image.java (Win32), the isReusable() method's fallback condition checked:

handleContainer.height() == height && handleContainer.height() == width

The second comparison should use handleContainer.width() instead.

Test plan

  • Verify non-square images reuse handles correctly when the container dimensions match
  • Verify square images continue to work as before
  • Run SWT test suite

🤖 Generated with Claude Code

The second condition in isReusable() compared handleContainer.height()
against both height and width due to a copy-paste error. This caused
unnecessary image handle recreation for non-square images. Use
handleContainer.width() for the width comparison.
@github-actions
Copy link
Copy Markdown
Contributor

Test Results (win32)

   30 files  ±0     30 suites  ±0   4m 45s ⏱️ +7s
4 675 tests ±0  4 602 ✅ ±0  73 💤 ±0  0 ❌ ±0 
1 209 runs  ±0  1 185 ✅ ±0  24 💤 ±0  0 ❌ ±0 

Results for commit b32583a. ± Comparison against base commit 855fff4.

@HeikoKlare HeikoKlare marked this pull request as ready for review April 16, 2026 15:21
@HeikoKlare HeikoKlare changed the title Fix width check in Image.HandleAtSize.isReusable on Win32 [Win32] Fix width check in Image.HandleAtSize.isReusable Apr 16, 2026
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.

1 participant