< prev index next >
src/java.desktop/windows/native/libawt/windows/awt_TrayIcon.cpp
Print this page
*** 999,1027 ****
HBITMAP hMask = ::CreateBitmap(nW, nH, 1, 1, (BYTE *)andMaskPtr);
// ::GdiFlush();
delete[] andMaskPtr;
! jint *intRasterDataPtr = NULL;
HBITMAP hColor = NULL;
try {
! intRasterDataPtr = (jint *)env->GetPrimitiveArrayCritical(intRasterData, 0);
! if (intRasterDataPtr == NULL) {
! ::DeleteObject(hMask);
! return;
! }
hColor = AwtTrayIcon::CreateBMP(NULL, (int *)intRasterDataPtr, nSS, nW, nH);
} catch (...) {
! if (intRasterDataPtr != NULL) {
! env->ReleasePrimitiveArrayCritical(intRasterData, intRasterDataPtr, 0);
! }
::DeleteObject(hMask);
throw;
}
!
! env->ReleasePrimitiveArrayCritical(intRasterData, intRasterDataPtr, 0);
! intRasterDataPtr = NULL;
HICON hIcon = NULL;
if (hMask && hColor) {
ICONINFO icnInfo;
--- 999,1023 ----
HBITMAP hMask = ::CreateBitmap(nW, nH, 1, 1, (BYTE *)andMaskPtr);
// ::GdiFlush();
delete[] andMaskPtr;
! /* Copy the raster data because GDI may fail on some Java heap
! * allocated memory.
! */
! length = env->GetArrayLength(intRasterData);
! jint *intRasterDataPtr = new jint[length];
HBITMAP hColor = NULL;
try {
! env->GetIntArrayRegion(intRasterData, 0, length, intRasterDataPtr);
hColor = AwtTrayIcon::CreateBMP(NULL, (int *)intRasterDataPtr, nSS, nW, nH);
} catch (...) {
! delete[] intRasterDataPtr;
::DeleteObject(hMask);
throw;
}
! delete[] intRasterDataPtr;
HICON hIcon = NULL;
if (hMask && hColor) {
ICONINFO icnInfo;
< prev index next >