jdk/src/java.desktop/windows/native/libfontmanager/lcdglyph.c
changeset 37687 bf6516a24734
parent 25859 3317bb8137f4
equal deleted inserted replaced
37686:1ad88c2dfacd 37687:bf6516a24734
   154     if (hMemoryDC != 0) { \
   154     if (hMemoryDC != 0) { \
   155         DeleteObject(hMemoryDC); \
   155         DeleteObject(hMemoryDC); \
   156     } \
   156     } \
   157     if (hBitmap != 0) { \
   157     if (hBitmap != 0) { \
   158         DeleteObject(hBitmap); \
   158         DeleteObject(hBitmap); \
       
   159     } \
       
   160     if (tmpBitmap != 0) { \
       
   161         DeleteObject(tmpBitmap); \
   159     } \
   162     } \
   160     if (dibImage != NULL) { \
   163     if (dibImage != NULL) { \
   161         free(dibImage); \
   164         free(dibImage); \
   162     } \
   165     } \
   163     if (glyphInfo != NULL) { \
   166     if (glyphInfo != NULL) { \
   194     int topLeftY;
   197     int topLeftY;
   195     int err;
   198     int err;
   196     int bmWidth, bmHeight;
   199     int bmWidth, bmHeight;
   197     int x, y;
   200     int x, y;
   198     HBITMAP hBitmap = NULL, hOrigBM;
   201     HBITMAP hBitmap = NULL, hOrigBM;
       
   202     HBITMAP tmpBitmap = NULL;
   199     int gamma, orient;
   203     int gamma, orient;
   200 
   204 
   201     HWND hWnd = NULL;
   205     HWND hWnd = NULL;
   202     HDC hDesktopDC = NULL;
   206     HDC hDesktopDC = NULL;
   203     HDC hMemoryDC = NULL;
   207     HDC hMemoryDC = NULL;
   247     hFont = CreateFontIndirectW(&lf);
   251     hFont = CreateFontIndirectW(&lf);
   248     if (hFont == NULL) {
   252     if (hFont == NULL) {
   249         FREE_AND_RETURN;
   253         FREE_AND_RETURN;
   250     }
   254     }
   251     oldFont = SelectObject(hMemoryDC, hFont);
   255     oldFont = SelectObject(hMemoryDC, hFont);
       
   256 
       
   257     tmpBitmap = CreateCompatibleBitmap(hDesktopDC, 1, 1);
       
   258     if (tmpBitmap == NULL) {
       
   259         FREE_AND_RETURN;
       
   260     }
       
   261     hOrigBM = (HBITMAP)SelectObject(hMemoryDC, tmpBitmap);
   252 
   262 
   253     memset(&textMetric, 0, sizeof(TEXTMETRIC));
   263     memset(&textMetric, 0, sizeof(TEXTMETRIC));
   254     err = GetTextMetrics(hMemoryDC, &textMetric);
   264     err = GetTextMetrics(hMemoryDC, &textMetric);
   255     if (err == 0) {
   265     if (err == 0) {
   256         FREE_AND_RETURN;
   266         FREE_AND_RETURN;
   332     /* Must use desktop DC to create a bitmap of that depth */
   342     /* Must use desktop DC to create a bitmap of that depth */
   333     hBitmap = CreateCompatibleBitmap(hDesktopDC, bmWidth, bmHeight);
   343     hBitmap = CreateCompatibleBitmap(hDesktopDC, bmWidth, bmHeight);
   334     if (hBitmap == NULL) {
   344     if (hBitmap == NULL) {
   335         FREE_AND_RETURN;
   345         FREE_AND_RETURN;
   336     }
   346     }
   337     hOrigBM = (HBITMAP)SelectObject(hMemoryDC, hBitmap);
   347     SelectObject(hMemoryDC, hBitmap);
   338 
   348 
   339     /* Fill in black */
   349     /* Fill in black */
   340     rect.left = 0;
   350     rect.left = 0;
   341     rect.top = 0;
   351     rect.top = 0;
   342     rect.right = bmWidth;
   352     rect.right = bmWidth;
   476 
   486 
   477     free(dibImage);
   487     free(dibImage);
   478     ReleaseDC(hWnd, hDesktopDC);
   488     ReleaseDC(hWnd, hDesktopDC);
   479     DeleteObject(hMemoryDC);
   489     DeleteObject(hMemoryDC);
   480     DeleteObject(hBitmap);
   490     DeleteObject(hBitmap);
       
   491     DeleteObject(tmpBitmap);
   481 
   492 
   482     return ptr_to_jlong(glyphInfo);
   493     return ptr_to_jlong(glyphInfo);
   483 }
   494 }