Felix Nawothnig : comctl32: Fix visual glitches with TVS_HASLINES.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 13 16:56:47 CDT 2007


Module: wine
Branch: master
Commit: 6a514819db7430c167c86ba743713da55d007d9f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6a514819db7430c167c86ba743713da55d007d9f

Author: Felix Nawothnig <flexo at holycrap.org>
Date:   Mon Mar 12 20:43:16 2007 +0100

comctl32: Fix visual glitches with TVS_HASLINES.

---

 dlls/comctl32/treeview.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 676e56a..8ababc9 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -1730,6 +1730,11 @@ TREEVIEW_NaturalHeight(TREEVIEW_INFO *infoPtr)
         height = tm.tmHeight + tm.tmExternalLeading + TVHEIGHT_FONT_ADJUST;
     if (height < infoPtr->normalImageHeight)
         height = infoPtr->normalImageHeight;
+
+    /* Round down, unless we support odd ("non even") heights. */
+    if (!(infoPtr->dwStyle & TVS_NONEVENHEIGHT))
+        height &= ~1;
+
     return height;
 }
 
@@ -2325,14 +2330,16 @@ TREEVIEW_DrawItemLines(TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
 	HTREEITEM parent;
         LOGBRUSH lb;
 
-	/*
-	 * Get a dotted grey pen
-	 */
+	/* Get a dotted grey pen */
         lb.lbStyle = BS_SOLID;
         lb.lbColor = infoPtr->clrLine;
         hNewPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &lb, 0, NULL);
 	hOldPen = SelectObject(hdc, hNewPen);
 
+        /* Make sure the center is on a dot (using +2 instead
+         * of +1 gives us pixel-by-pixel compat with native) */
+        centery = (centery + 2) & ~1;
+
 	MoveToEx(hdc, item->stateOffset, centery, NULL);
 	LineTo(hdc, centerx - 1, centery);
 




More information about the wine-cvs mailing list