Skip to content

Conversation

@ShahzaibIbrahim
Copy link
Contributor

@ShahzaibIbrahim ShahzaibIbrahim commented Nov 19, 2025

Enabling a consistent pattern to apply disablement or graying of an Image. They are applied whenever a handle is being created from init method. Ensuring streamline usage and avoid double calls to this method.


How to test

  • Run the Snippet382 with following VM Argument: swt.autoScale.updateOnRuntime=true
  • Move the shell between different zoom levels (100,125,150,175,200,250)
  • The snippet tests different kind of image providers to create an Image.
  • Expected result would be that we don't lose disabled or grayed image attributes.
image

This adaption is made on the basis of this comment: #2737 (comment)

Instead of calling the adaptImageDataIfDisabledOrGray method from init method (which could be executed even when temporary handle is created) we will now call it only when data is loaded for the first time. So instead of calling loadImageData, all providers must call loadImageDataWithGrayOrDisablement and also provide loadImageData implementation of its own. In this way we can achieve one common place to call adaptImageDataIfDisabledOrGray from.

@ShahzaibIbrahim ShahzaibIbrahim marked this pull request as draft November 19, 2025 13:27
@ShahzaibIbrahim ShahzaibIbrahim force-pushed the master-496-new-tech branch 2 times, most recently from 2f08cde to 91c9747 Compare November 19, 2025 13:36
ImageData imageData = image.getImageData(targetZoom);
drawer.postProcess(imageData);
ImageData newData = adaptImageDataIfDisabledOrGray(imageData);
ImageData newData = adaptImageDataIfDisabledOrGray(imageData, styleFlag);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still have to keep it because a new image is created here with plainImageDataProvider which loads the data directly from handle. I am open to suggestions here.

@ShahzaibIbrahim
Copy link
Contributor Author

@akoch-yatta @HeikoKlare Please review the PR and comments, It might not be in final shape but here I could use some suggestions.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 19, 2025

Test Results

  111 files  ±0    111 suites  ±0   17m 48s ⏱️ +7s
4 597 tests ±0  4 582 ✅ +1  14 💤  - 1  1 ❌ ±0 
  282 runs  ±0    281 ✅ ±0   1 💤 ±0  0 ❌ ±0 

For more details on these failures, see this check.

Results for commit eb0405c. ± Comparison against base commit 63d5582.

♻️ This comment has been updated with latest results.

@ShahzaibIbrahim
Copy link
Contributor Author

@akoch-yatta can you please have a look/review if you got time?

Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

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

Can you please explain the underlying pattern where the application of gray/disablement is supposed to be done now? The PR description states:

In this way we can achieve one common place to call adaptImageDataIfDisabledOrGray from.

But I see calls of that method from at least:

  • initializeHandleFromSource
  • newImageData
  • getOrCreateImageHandleAtClosestSize

To assess if this is a good concept/systematics where to apply gray/disablement, it would be helpful to have a description of that concept.

In addition to that, the PR seems to contain unnecessary changes (e.g., addition of unused parameters, duplicate application of adaptImageDataIfDisabledOrGray) and also seems to remove crucial code (handle initialization in copy constructor).

@ShahzaibIbrahim ShahzaibIbrahim force-pushed the master-496-new-tech branch 2 times, most recently from b00be8c to 958016e Compare December 23, 2025 14:15
@github-actions
Copy link
Contributor

github-actions bot commented Dec 23, 2025

Test Results (win32)

   27 files   -  7     27 suites   - 7   4m 45s ⏱️ +4s
4 571 tests  - 57  4 500 ✅  - 55  70 💤  - 3  1 ❌ +1 
  110 runs   - 57    110 ✅  - 54   0 💤  - 3  0 ❌ ±0 

For more details on these failures, see this check.

Results for commit ee581d6. ± Comparison against base commit 47e2587.

This pull request removes 57 tests.
AllWin32Tests ImageWin32Tests ‑ testDisposeDrawnImageBeforeRequestingTargetForOtherZoom
AllWin32Tests ImageWin32Tests ‑ testDrawImageAtDifferentZooms(boolean)[1] true
AllWin32Tests ImageWin32Tests ‑ testDrawImageAtDifferentZooms(boolean)[2] false
AllWin32Tests ImageWin32Tests ‑ testImageDataForDifferentFractionalZoomsShouldBeDifferent
AllWin32Tests ImageWin32Tests ‑ testImageShouldHaveDimesionAsPerZoomLevel
AllWin32Tests ImageWin32Tests ‑ testRetrieveImageDataAtDifferentZooms(boolean)[1] true
AllWin32Tests ImageWin32Tests ‑ testRetrieveImageDataAtDifferentZooms(boolean)[2] false
AllWin32Tests ImageWin32Tests ‑ test_getImageData_fromCopiedImage
AllWin32Tests ImageWin32Tests ‑ test_getImageData_fromImageForImageDataFromImage
AllWin32Tests TestTreeColumn ‑ test_ColumnOrder
…

♻️ This comment has been updated with latest results.

Enabling a consistent pattern to apply disablement or graying of an
Image. They are applied whenever a handle is being created from init
method. Ensuring streamline usage and avoid double calls to this method.
@ShahzaibIbrahim ShahzaibIbrahim marked this pull request as ready for review December 23, 2025 14:48
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.

Streamline calls to Image#adaptImageDataIfDisabledOrGray()

2 participants