fixbug: lost DT_CALCRECT attribute when DT_CENTER set

This commit is contained in:
Vincent Wei
2018-06-01 12:07:28 +08:00
parent 0599227023
commit df627ee3b1
2 changed files with 4 additions and 5 deletions
-3
View File
@@ -1569,7 +1569,6 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
break;
/*
case SCANCODE_BACKSPACE:
{
int del;
@@ -1584,8 +1583,6 @@ static int sleKeyDown (HWND hWnd, WPARAM wParam, LPARAM lParam)
sleInsertText (hWnd, sled, NULL, del);
}
break;
*/
case SCANCODE_A:
{
+4 -2
View File
@@ -552,7 +552,9 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount,
/* convert to the start point on baseline. */
_gdi_get_baseline_point(pdc, &ctxt.x, &ctxt.y);
if(nFormat & DT_CENTER){
if (nFormat & DT_CENTER){
BOOL old_set = ctxt.only_extent;
/* only get text extent.*/
ctxt.only_extent = TRUE;
_gdi_reorder_text_break (pdc, pline, line_len,
@@ -564,7 +566,7 @@ int DrawTextEx2 (HDC hdc, const char* pText, int nCount,
x = rcDraw.left + ((RECTW (rcDraw) - ctxt.advance) >> 1);
ctxt.x = x + line_x;
ctxt.advance = 0;
ctxt.only_extent = FALSE;
ctxt.only_extent = old_set;
if((nFormat & DT_CALCRECT) && (pRect->left > ctxt.x))
pRect->left = ctxt.x;
_gdi_reorder_text_break (pdc, pline, line_len,