-
Notifications
You must be signed in to change notification settings - Fork 143
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 the usage of getBoundsInPixels with getBounds #1385
Draft
ShahzaibIbrahim
wants to merge
1
commit into
eclipse-platform:master
Choose a base branch
from
ShahzaibIbrahim:master-105
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3
−3
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7293,7 +7293,7 @@ LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long lParam) { | |
if (pinfo.iSubItem != 0) x -= gridWidth; | ||
Image image = item.getImage (pinfo.iSubItem); | ||
if (image != null) { | ||
Rectangle rect = image.getBoundsInPixels (); | ||
Rectangle rect = image.getBoundsInPixels(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it intended that this is only a formatting change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. formatting leftover |
||
RECT imageRect = item.getBounds (pinfo.iItem, pinfo.iSubItem, false, true, false, false, hDC); | ||
Point size = imageList == null ? new Point (rect.width, rect.height) : imageList.getImageSize (); | ||
int y = imageRect.top + Math.max (0, (imageRect.bottom - imageRect.top - size.y) / 2); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This modifies the behavior, doesn't it?
Let's assume
getBoundsInPixels()
returned(100, 100, 100, 100)
and let's assume thatdata.nativeZoom=125
. ThengetBounds(data.nativeZoom)
will scale up from 100 to 125, i.e., it will return(125, 125, 125, 125)
. Do I miss something?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.
Depends what the native zoom of the image is. If the native zoom of the image is 125, then it will return (100, 100, 100, 100). If the native zoom of the image is 100, then yes. Probably would be good to look out for a snippet, where this is used and play around with that.
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 do not understand that. Why should it return (100, 100, 100, 100) when the native zoom of the image is 125? Within
getBounds(int)
, the "corrected" zoom is used according toDPIUtil.getZoomForAutoscaleProperty(initialNativeZoom)
, so even if the native zoom of the image is 125, a value of 100 is used for scaling, isn't it?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.
So you mean the call should be getBounds(getZoom()) to be in the same zoom restrictions as Image uses internally?
That is definetly correct
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.
What I meant for example is the scenario was with mode exact or quarter, where the Image was e.g. created on the primary monitor with 125%. Then getBounds(125) would be equal to getZoom() from the image, so it would return (100, 100, 100, 100)
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.
That's true. I had the "default" case in mind (i.e., scaling mode
integer200
) in which I still think that the behavior might change.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.
You are right, the behavior changes. I tested it with the snippet 215, where image.getBoundsInPixels() returns Rectangle {0, 0, 5120, 1440} but later scaled due to native zoom (which is 200) to final value image.getBounds(data.nativeZoom) : Rectangle {0, 0, 10240, 2880}