On 3/22/2016 8:36 AM, Hendrik Schreiber wrote:


On Mar 21, 2016, at 22:07, Alexandr Scherbatiy <alexandr.scherba...@oracle.com <mailto:alexandr.scherba...@oracle.com>> wrote:

On 3/18/2016 6:09 AM, Hendrik Schreiber wrote:
On Mar 16, 2016, at 06:25, Alexandr Scherbatiy <alexandr.scherba...@oracle.com> wrote:


The JDK fixes should be pushed to the JDK 9 first and then be back-ported to JDK 8.

  Could you prepare the fix for JDK 9?

Hi Alexandr,

I've created a patch for JDK9. You can find it at http://cr.openjdk.java.net/~hschreiber/8151385/webrev.00/ (I hope, I created the webrev the right way). It contains a suitable test.

This patch also contains the changes I suggested in https://bugs.openjdk.java.net/browse/JDK-8149453 (because the fixes overlap to a degree). I made sure they compile, but didn’t do any further testing (lack of time). Perhaps, since you are already working on this, you can try it out and, if you deem it appropriate, add a test for the upFolder/newFolder etc. buttons.
For some reasons the native getIconBits() method returns size 16 for both small and large icons which leads to the AOBE in the BufferedImage.setRGB() methods.
   I will try to investigate it deeper.

I got the IOBE running the simple JFileChooser (new JFileChooser().showOpenDialog(null));

I created an application in Visual Studio and try to check the returned icon size. It returns the same size 16 for both IDB_VIEW_SMALL_COLOR and IDB_VIEW_LARGE_COLOR.

Here is the code which I used (without any error handling):
----------------
    WPARAM size = (WPARAM)IDB_VIEW_LARGE_COLOR;

    int iconIndex = VIEW_NEWFOLDER;
    HWND hWndToolbar = ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
        0, 0, 0, 0, 0,
        NULL, NULL, NULL, NULL);
    SendMessage(hWndToolbar, TB_LOADIMAGES, size, (LPARAM)HINST_COMMCTRL);
HIMAGELIST hImageList = (HIMAGELIST)SendMessage(hWndToolbar, TB_GETIMAGELIST, 0, 0);

HICON hIcon = ImageList_GetIcon(hImageList, iconIndex, ILD_TRANSPARENT);

    BITMAP bmp;
    memset(&bmp, 0, sizeof(BITMAP));

    ICONINFO iconInfo;
    GetIconInfo((HICON)hIcon, &iconInfo);
    HDC dc = GetDC(NULL);
    GetObject(iconInfo.hbmColor, sizeof(bmp), &bmp);

    TCHAR     str[MAX_LOADSTRING];
    wsprintf(str, L"Icon size: [%d, %d]", bmp.bmWidth, bmp.bmHeight);
    MessageBox(NULL, str, L"TEST", MB_OK);
----------------

The other thing that I noticed that icons on JOptionPane have twice bigger size than expected.

Thanks,
Alexandr.
Thanks.

-hendrik

Reply via email to