-
Notifications
You must be signed in to change notification settings - Fork 147
Replacing custom logic in Help>Search results to disable icons, with Image constructor call #1889
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
Replacing custom logic in Help>Search results to disable icons, with Image constructor call #1889
Conversation
8ff7cb9
to
b1470f4
Compare
b1470f4
to
750c010
Compare
750c010
to
0ec2941
Compare
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 winder why SWT.IMAGE_DISABLE
was not used from the beginning (as it seems to have already existed when the code was introduced). The result of the disablement is obviously a bit different from the existing visualization. I am not sure whether it's acceptable to change it. Couldn't we just keep the existing visualization in a HiDPI-aware way? For example: create an image based on an ImageGcDrawer
, which, on demand, draws the original image onto the GC in the requested size and then adapts the image data (in the same ways as now) in a postProcess()
implementation of the ImageGcDrawer
.
ua/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineResultSection.java
Outdated
Show resolved
Hide resolved
0ec2941
to
27f01ed
Compare
I don't see a good reason to not simplify it. Neither in the original ticket, nor the commit nor the code/javadoc I see a proper explanation, why this look was necessary. UX wise I would argue, if you use the exact image to visualize an active entry, you should use the disabled image to visualize an disabled entry. But therefor I would propose to use SWT.IMAGE_DISABLE instead of SWT.IMAGE_GRAY. This looks more similar.
I would assume that would work, yes, but as stated above I would propose to use IMAGE_DISABLE as it looks good to me and doesn't have this overcomplicated pixel manipulation logic. |
I agree that we lack proper knowledge of why it was done like this. But note that this code is not about showing a disabled entry but about showing a potential search match. In my understanding, exact search matches are shown with the original image and _ potential_ search matches are shown with a grayed and slightly transparent one. The risk I see with using the disabled (or grayed) image is that in case the shown image is already gray, you will not see a different. You could of course argue that the argument holds for every use case of the disabled/grayed image options but the difference I see is that in this case the given image is "dynamic", i.e., one may hook any image in here for which you need to find a representation that looks different to indicate the potential match. In the examples we have seen, always the default "help search icon" is used, but in my understanding this icon can also be customized: Lines 56 to 68 in a0e851b
My guess it that that's the reason why this more complex manipulation using transparency was used as it will produce a distinguishable result for every kind of input image (other than with the disabled/grayed options). But I may also be wrong. And it may also be fine to just assume that whatever image may be passed in, the gray/disabled option is even sufficient (in particular since the algorithm for calculating the disabled image has just been improved). @akurtakov do you have any knowledge whether it this pixel manipulation to create an image for showing potential help search results is necessary or whether we may just move to simply using the |
@akurtakov, Could you share your insights on whether the pixel-level manipulation for creating the “potential hit” disabled icons is still necessary? Or would it be okay to simplify by just using SWT’s disabled image flag as proposed? |
TBH, it's first time I see this code. For me this PR is just fine as the difference is not that big and majority of the users would not make a difference unless they are explicitly pointed to the subtle detail. |
Just as a pointer if someone is interested in pursue such idea more https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/DecorationOverlayIcon.html |
473aab7
to
f22e8ac
Compare
I get this error in my CI builds, is this some flaky test?
|
…Image constructor call For the results displayed in Help>Search, Previously, icons for disabled search hits were created by custom pixel-level manipulation using ImageData. This approach, at high zoom levels (e.g., 225%), causes icons to appear slightly distorted, as scaling of ImageData is a destructive operation. This logic has now been replaced by a call to the Image constructor with the flag set to disabled.
f22e8ac
to
597d7d1
Compare
Thank you for the valuable feedback! Then let's go with the proposal. |
Summary
For the results displayed in
Help>Search
, Previously, icons for disabled search hits were created by custom pixel-level manipulation usingImageData
. This approach, at high zoom levels (e.g., 225%), causes icons to appear slightly distorted, as scaling ofImageData
is a destructive operation. This logic has now been replaced by a call to theImage
constructor with the flag set to disabled.Screenshots at 225%
Current Behaviour
With This Change
Steps to reproduce
Testing this change directly in the runtime workspace is complicated due to conditional logic that disables icons only when the corresponding search hit is considered a potential hit — and a potential hit is defined as one without any filters applied.
To simulate the change for the purposes of this PR, the following line can be temporarily modified:
File:
EngineResultSection.java
Related Issue
Contributes to: vi-eclipse/Eclipse-Platform#199