bamaer commented on PR #8945: URL: https://github.com/apache/hop/pull/8945#issuecomment-6192757417
Thanks @williamWEWEevan for picking this up. The `SwtGc` change looks like the actual fix: the source and destination rectangles are now the same size, so SWT on Windows no longer chooses a different image zoom as the note is resized. Two things I'd change before merging: **Should fix** 1. **The minimum size makes images wider than the note.** In `NoteImageSupport.fit()` (`NoteImageSupport.java:205`), the `MIN_RENDERED_SIZE` step scales up without checking the max box. `fit(1200, 60, 100, 200)` now gives 160×8 in a note 100 wide, and `fit(2000, 20, 300, 200)` gives 800×8. Note content isn't clipped, so these draw past the note's edge. The new test asserts this too: `fit(2000, 100, 20, 200)` returns 160 wide for a box 20 wide. A 1px-tall result is a valid size for `drawImage`. I'd drop the minimum-size step and keep only the upper bound. 2. **Images now shrink without smoothing.** `ImageData.scaledTo()` uses nearest-neighbour scaling. Before this PR, the GC did the downscale with interpolation. A screenshot shrunk to fit a note will therefore look more jagged on every platform. On HiDPI screens the 100% bitmap is also enlarged again, so the image gets blocky. Suggested fix: build each zoom level from the original data at the target size, for example `zoom -> data.scaledTo(Math.max(1, w * zoom / 100), Math.max(1, h * zoom / 100))`, and keep `drawImage(img, 0, 0, w, h, x, y, w, h)`. Source and destination still match, and HiDPI gets the full number of pixels. For smoother results, scale with AWT bicubic and convert with `SwtUniversalImage.toImageData()`. Did you reproduce the disappearing image on Windows before and after the change? @mattcasters, could you give it a quick try on your machine? We reviewed the code and ran `fit()` on the sizes above, but haven't run the GUI. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
