Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 93466 Details for
Bug 223944
Win32 TreeItem#setImage may be eligible for optimization
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Attempts to suggest optimizations for Win32 Tree#setImage
004-Tree#setImage.patch (text/plain), 2.68 KB, created by
Lubomir Marinov
on 2008-03-25 14:46:14 EDT
(
hide
)
Description:
Attempts to suggest optimizations for Win32 Tree#setImage
Filename:
MIME Type:
Creator:
Lubomir Marinov
Created:
2008-03-25 14:46:14 EDT
Size:
2.68 KB
patch
obsolete
>For 102342 invocations of TreeItem#setImage on Windows: > > time (ms) >unpatched 1923 >patched 786 > >--- Tree.java.original 2008-03-25 19:19:34.419600000 +0200 >+++ Tree.java 2008-03-25 19:19:28.808600000 +0200 >@@ -3526,13 +3526,19 @@ > > int imageIndex (Image image, int index) { > if (image == null) return OS.I_IMAGENONE; >+ boolean updateImageList; > if (imageList == null) { > Rectangle bounds = image.getBounds (); > imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height); >+ updateImageList = true; >+ } else { >+ updateImageList = false; > } > int imageIndex = imageList.indexOf (image); >- if (imageIndex == -1) imageIndex = imageList.add (image); >- if (hwndHeader == 0 || OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) == index) { >+ if (imageIndex == -1) { >+ imageIndex = imageList.add (image); >+ } >+ if (updateImageList && (hwndHeader == 0 || OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) == index)) { > int /*long*/ hImageList = imageList.getHandle (); > int /*long*/ hOldImageList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0); > if (hOldImageList != hImageList) { >--- TreeItem.java.original 2008-03-25 19:19:45.379600000 +0200 >+++ TreeItem.java 2008-03-25 19:19:41.316600000 +0200 >@@ -1634,7 +1634,14 @@ > * @since 3.1 > */ > public void setImage (Image [] images) { >- checkWidget(); >+ >+ /* >+ * It doesn't make sense to checkWidget() here because the method just >+ * delegates to another method and doesn't use the instance state before >+ * doing so i.e. if checkWidget() is at all necessary, it will be performed >+ * by the called method. >+ */ >+ // checkWidget(); > if (images == null) error (SWT.ERROR_NULL_ARGUMENT); > for (int i=0; i<images.length; i++) { > setImage (i, images [i]); >@@ -1684,12 +1691,11 @@ > images [index] = image; > } > if ((parent.style & SWT.VIRTUAL) != 0) cached = true; >- >- /* Ensure that the image list is created */ >- //TODO - items that are not in column zero don't need to be in the image list >- parent.imageIndex (image, index); >- >+ > if (index == 0) { >+ /* Ensure that the image list is created */ >+ parent.imageIndex (image, index); >+ > if ((parent.style & SWT.VIRTUAL) == 0 &&!cached && !parent.painted) { > return; > } >@@ -1714,7 +1720,13 @@ > } > > public void setImage (Image image) { >- checkWidget (); >+ >+ /* >+ * It doesn't make sense to checkWidget() here because the method just >+ * delegates to another method i.e. if checkWidget() is at all necessary, it >+ * will be performed by the called method. >+ */ >+ // checkWidget (); > setImage (0, image); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 223944
: 93466 |
94521
|
94629