Ticket #22 (closed defect)

Opened 8 years ago

Last modified 8 years ago

GetWidth() & GetHeight() always return 32 on wxIcon?

Reported by: anonymous Owned by: vadz
Priority: high Milestone:
Component: wxMSW Version:
Keywords: Cc: vadz
Blocked By: Patch: no
Blocking:

Description

Bug#: 80
Product: .wxWindows
Version: 2.2.0
Platform: wxGTK
OS/Version: Linux - RedHat
Status: NEW
Resolution:
Severity: normal
Priority: P2
Component: wxGTK
AssignedTo: ???
ReportedBy: stuff@…
URL:
Summary: GetWidth() & GetHeight() always return 32 on wxIcon?

It appears that GetWidth() and GetHeight() always return 32 on a
wxIcon object? This appears to be the case on wxGTK as well as
wxMSW. I noticed this when substituting icons for the TreeCtrl sample
program. In MyTreeCtrl::CreateImageList(), the call to
icon[i].GetWidth() always returns 32 causing the imagelist to add
wxImage(icons[i]).Rescale(16,16).ConvertToBitMap() on an icon that is
already 16x16. Am I missing something here?


I have found the problem to be the use of LoadIcon in the gdiimage.cpp to load
the icon. I believe this will always return a 32 x 32 icon that was scaled
from the closest match in the ico file ( in this case, the 16X16), and then
wxWindows will scale it back to 16 X 16 (or whatever the specified scale is to
be). Is this acceptable / intended?

Change History

Changed 8 years ago by vadz

wxIcon in wxMSW should now load the image in the correct size if you ask for it (otherwise you will still get 32x32 one)

Note: See TracTickets for help on using tickets.