DrawTextEx - honor clipping for underscores

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vitaliy Margolen

changelog:
  DrawTextEx - honor clipping for underscores
Index: dlls/user/text.c
===================================================================
RCS file: /home/wine/wine/dlls/user/text.c,v
retrieving revision 1.45
diff -u -r1.45 text.c
--- dlls/user/text.c	2 Apr 2003 01:23:44 -0000	1.45
+++ dlls/user/text.c	26 May 2003 18:16:19 -0000
@@ -792,9 +792,10 @@
  *                   (logical coordinates)
  *   str        [in] The text of the line segment
  *   offset     [in] The offset of the underscored character within str
+ *   rect       [in] Clipping rectangle (if not NULL)
  */
 
-static void TEXT_DrawUnderscore (HDC hdc, int x, int y, const WCHAR *str, int offset)
+static void TEXT_DrawUnderscore (HDC hdc, int x, int y, const WCHAR *str, int offset, LPRECT rect)
 {
     int prefix_x;
     int prefix_end;
@@ -808,6 +809,15 @@
     prefix_end = x + size.cx - 1;
     /* The above method may eventually be slightly wrong due to kerning etc. */
 
+    /* Check for clipping */
+    if (rect){
+	if (prefix_x > rect->right || prefix_end < rect->left || y < rect->top || y > rect->bottom)
+	    return; /* Completely outside */
+	/* Partially outside */
+	if (prefix_x   < rect->left ) prefix_x   = rect->left;
+	if (prefix_end > rect->right) prefix_end = rect->right;
+    }
+    
     hpen = CreatePen (PS_SOLID, 1, GetTextColor (hdc));
     oldPen = SelectObject (hdc, hpen);
     MoveToEx (hdc, prefix_x, y, NULL);
@@ -939,7 +949,7 @@
                                  rect, str, len_seg, NULL ))  return 0;
                 if (prefix_offset != -1 && prefix_offset < len_seg)
                 {
-                    TEXT_DrawUnderscore (hdc, xseg, y + tm.tmAscent + 1, str, prefix_offset);
+                    TEXT_DrawUnderscore (hdc, xseg, y + tm.tmAscent + 1, str, prefix_offset, (flags & DT_NOCLIP) ? NULL : rect);
                 }
                 len -= len_seg;
                 str += len_seg;


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux