-
Notifications
You must be signed in to change notification settings - Fork 187
[Refactoring] Streamline calls to Image#adaptImageDataIfDisabledOrGray() #2795
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
base: master
Are you sure you want to change the base?
[Refactoring] Streamline calls to Image#adaptImageDataIfDisabledOrGray() #2795
Conversation
4c8ed71 to
2f08cde
Compare
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.
2f08cde to
91c9747
Compare
| case SWT.IMAGE_DISABLE: | ||
| case SWT.IMAGE_GRAY: { | ||
| for (ImageHandle imageHandle : srcImage.zoomLevelToImageHandle.values()) { | ||
| Rectangle rect = imageHandle.getBounds(); | ||
| ImageData data = srcImage.getImageData(imageHandle.zoom); | ||
| ImageData newData = applyGrayImageData(data, rect.height, rect.width); | ||
| init (newData, imageHandle.zoom); | ||
| srcImage.getImageData(imageHandle.zoom); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we only need to reload the data for other handle if exist in order to apply gray or disable image data.
| ImageData imageData = image.getImageData(targetZoom); | ||
| drawer.postProcess(imageData); | ||
| ImageData newData = adaptImageDataIfDisabledOrGray(imageData); | ||
| ImageData newData = adaptImageDataIfDisabledOrGray(imageData, styleFlag); |
There was a problem hiding this comment.
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.
|
@akoch-yatta @HeikoKlare Please review the PR and comments, It might not be in final shape but here I could use some suggestions. |
Test Results 111 files ±0 111 suites ±0 17m 48s ⏱️ +7s 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. |
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
Snippet382with following VM Argument:swt.autoScale.updateOnRuntime=trueThis 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.