Skip to content

Refactor fillGradientRectangle to avoid DPIUtil.autoScaleDown() #2284

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

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

Conversation

arunjose696
Copy link
Contributor

Summary:

This PR replaces the use of DPIUtil.autoScaleDown() with DPIUtil.scaleDown() in the fillGradientRectangle method. It also refactors the image creation logic by introducing an ImageDataProvider instead of directly creating ImageData. These changes have no visual impact. the behavior remains consistent with previous versions.

Steps to reproduce

Reaching this function on Windows is difficult, as the check usually returns true, causing the method to be bypassed. For testing purposes, this condition can be manually set to false to ensure that fillGradientRectangle is executed.

When the check is disabled, the method is invoked, for example, when using palettes in GEF. After applying this change, the gradient rectangles in the palette render identical as before.

Copy link
Contributor

github-actions bot commented Jul 4, 2025

Test Results

   545 files  ±0     545 suites  ±0   28m 30s ⏱️ -24s
 4 406 tests ±0   4 388 ✅ ±0   18 💤 ±0  0 ❌ ±0 
16 745 runs  ±0  16 603 ✅ ±0  142 💤 ±0  0 ❌ ±0 

Results for commit 3035e8f. ± Comparison against base commit 6842283.

♻️ This comment has been updated with latest results.

This PR replaces the use of DPIUtil.autoScaleDown() with
DPIUtil.scaleDown() in the fillGradientRectangle method.
Additionally, it refactors the image creation logic by using an
ImageDataProvider instead of directly creating ImageData. There is no
visual impact for the changes the behavior should remain as before.
@arunjose696 arunjose696 force-pushed the arunjose696/319/fillGradientRectangle branch from 5c3435f to 3035e8f Compare July 4, 2025 14:47
@ShahzaibIbrahim
Copy link
Contributor

The changes made here are similar to this PR about refactoring the DPIUtil. We might be working on the same thing, could you check and confirm?

@arunjose696
Copy link
Contributor Author

The changes made here are similar to this PR about refactoring the DPIUtil. We might be working on the same thing, could you check and confirm?

Yes, the changes are mostly similar. The only additional thing I'm doing is replacing Image constructors that take ImageData with ones that use an ImageDataProvider. I think this change can wait until #2281 is merged

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.

fillGradientRectangle() needs to be refactored
2 participants