Avoid Rectangle allocation on every mouse move in CTabFolder#3225
Open
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
Open
Avoid Rectangle allocation on every mouse move in CTabFolder#3225vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
Conversation
Replace item.getBounds().contains(x, y) calls in onMouse() with a static containsPoint() helper that checks CTabItem fields directly, avoiding Rectangle allocation on every MouseMove, MouseDown, and MouseUp event. See eclipse-platform#3219 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
merks
reviewed
Apr 12, 2026
| Rectangle bounds = tabItem.getBounds(); | ||
| if (bounds.contains(x, y)){ | ||
| if (containsPoint(tabItem, x, y)){ | ||
| item = tabItem; |
Contributor
There was a problem hiding this comment.
I wonder, should there maybe be a break after this? I assume only one item can contain the point...
merks
reviewed
Apr 12, 2026
| * Returns whether the given point (px, py) is contained within the bounds | ||
| * of the given CTabItem, without allocating a Rectangle object. | ||
| */ | ||
| static boolean containsPoint(CTabItem item, int px, int py) { |
Contributor
There was a problem hiding this comment.
Is this used elsewhere that you've made it package private and not private?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replace item.getBounds().contains(x, y) calls in onMouse() with a static containsPoint() helper that checks CTabItem fields directly, avoiding Rectangle allocation on every MouseMove, MouseDown, and MouseUp event.
See #3219