Hi Christian,

for half a dozen entries in a popup menu which represent mail clients I’m 
loading their app icons. This takes 3 seconds!!!

  dim thePopup as NSPopUpButtonMBS = me.NSPopUpButtonMBS
  for currentApp = 0 to numberOfMailApps - 1
    dim theItem as NSMenuItemMBS = thePopup.itemAtIndex(CurrentApp)
    theItem.Image = GetApplicationIcon(theCodes(currentApp))
  next

Private Function GetApplicationIcon(theBundleIdentifier as String) As NSImageMBS
  dim theApp as FolderItem = LaunchServicesFindApplicationForInfoMBS("", 
theBundleIdentifier,"")
  if theApp = nil then Return nil
  if RetinaScaleFactor = 0 then RetinaScaleFactor = 
globals.getRetinaScalingFactor(self.Window)
  dim theIcon as Picture
  if RetinaScaleFactor = 1 then
    theIcon = theApp.IconMBS(16)
  else
    theIcon = theApp.IconMBS(32)
  end if
  if theIcon <> nil then
    dim FinalImage as new NSImageMBS(theIcon)
    FinalImage.setSize(16, 16)
    Return FinalImage
  end if
End Function

I did a bit profiling and found out that the slow part of the code is the last 
one

  if theIcon <> nil then
    dim FinalImage as new NSImageMBS(theIcon)
    FinalImage.setSize(16, 16)
    Return FinalImage
  end if

which takes between 40 and 70 ticks each!

Do you have any idea why this is so slow?


Mit freundlichen Grüßen/Regards

Trixi Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to