提交 5584668a 编写于 作者: A aivanov

8146035: Windows - With LCD antialiasing, some glyphs are not rendered correctly

Reviewed-by: serb, prr
Contributed-by: NDmitry Batrak <dmitry.batrak@jetbrains.com>
上级 95d1c9ec
...@@ -157,6 +157,9 @@ JNIEXPORT jboolean JNICALL ...@@ -157,6 +157,9 @@ JNIEXPORT jboolean JNICALL
if (hBitmap != 0) { \ if (hBitmap != 0) { \
DeleteObject(hBitmap); \ DeleteObject(hBitmap); \
} \ } \
if (tmpBitmap != 0) { \
DeleteObject(tmpBitmap); \
} \
if (dibImage != NULL) { \ if (dibImage != NULL) { \
free(dibImage); \ free(dibImage); \
} \ } \
...@@ -196,6 +199,7 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows ...@@ -196,6 +199,7 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows
int bmWidth, bmHeight; int bmWidth, bmHeight;
int x, y; int x, y;
HBITMAP hBitmap = NULL, hOrigBM; HBITMAP hBitmap = NULL, hOrigBM;
HBITMAP tmpBitmap = NULL;
int gamma, orient; int gamma, orient;
HWND hWnd = NULL; HWND hWnd = NULL;
...@@ -250,6 +254,12 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows ...@@ -250,6 +254,12 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows
} }
oldFont = SelectObject(hMemoryDC, hFont); oldFont = SelectObject(hMemoryDC, hFont);
tmpBitmap = CreateCompatibleBitmap(hDesktopDC, 1, 1);
if (tmpBitmap == NULL) {
FREE_AND_RETURN;
}
hOrigBM = (HBITMAP)SelectObject(hMemoryDC, tmpBitmap);
memset(&textMetric, 0, sizeof(TEXTMETRIC)); memset(&textMetric, 0, sizeof(TEXTMETRIC));
err = GetTextMetrics(hMemoryDC, &textMetric); err = GetTextMetrics(hMemoryDC, &textMetric);
if (err == 0) { if (err == 0) {
...@@ -334,7 +344,7 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows ...@@ -334,7 +344,7 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows
if (hBitmap == NULL) { if (hBitmap == NULL) {
FREE_AND_RETURN; FREE_AND_RETURN;
} }
hOrigBM = (HBITMAP)SelectObject(hMemoryDC, hBitmap); SelectObject(hMemoryDC, hBitmap);
/* Fill in black */ /* Fill in black */
rect.left = 0; rect.left = 0;
...@@ -478,6 +488,7 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows ...@@ -478,6 +488,7 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows
ReleaseDC(hWnd, hDesktopDC); ReleaseDC(hWnd, hDesktopDC);
DeleteObject(hMemoryDC); DeleteObject(hMemoryDC);
DeleteObject(hBitmap); DeleteObject(hBitmap);
DeleteObject(tmpBitmap);
return ptr_to_jlong(glyphInfo); return ptr_to_jlong(glyphInfo);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册