Skip to content

Ensure DrawImage deals with scenario ImageData not linearly scaled #2250

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arunjose696
Copy link
Contributor

This change makes sure DrawImage handles the scenario where ImageData may not be linearly scaled across zooms.

Copy link
Contributor

github-actions bot commented Jun 18, 2025

Test Results

   545 files  ±0     545 suites  ±0   31m 36s ⏱️ +17s
 4 406 tests +4   4 388 ✅ +4   18 💤 ±0  0 ❌ ±0 
16 736 runs  +4  16 596 ✅ +4  140 💤 ±0  0 ❌ ±0 

Results for commit 9b0b4a0. ± Comparison against base commit f92b752.

♻️ This comment has been updated with latest results.

Comment on lines 1029 to 1032
Rectangle scaledBounds = image.getBounds(scaledImageZoom);
Rectangle unScaledBound = image.getBounds();
float scalingFactor = (float) scaledBounds.height / unScaledBound.height;
Rectangle src = DPIUtil.scaleUp(drawable, new Rectangle(srcX, srcY, srcWidth, srcHeight),(int) (scalingFactor * 100));
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought about this a bit. Isn't it possible to do the check regarding getBounds in the calling place and then pass the "correct" scaledImageZoom, so the implementation in here can stay as is and the change is in the calling place in GC?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The earlier approach was to use scaledImageZoom as before to obtain Image.win32_getHandle(), using the "correct" zoom level only for calculating the bounds. , but taking another look it would not make much difference if we get handles at either of these. I have moved this logic to the calling site when the scaledImageZoom is calculated

@arunjose696 arunjose696 force-pushed the arunjose696/313/FixDrawImageScaling branch 3 times, most recently from 573ed10 to 7ede441 Compare June 23, 2025 09:12
This change makes sure DrawImage handles the scenario where ImageData
may not be linearly scaled across zooms.
@arunjose696 arunjose696 force-pushed the arunjose696/313/FixDrawImageScaling branch from 7ede441 to 9b0b4a0 Compare June 23, 2025 09:15
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.

2 participants