Huw Davies : riched20: Move the range clamping to the helper now that the range isn' t used later on.

Alexandre Julliard julliard at winehq.org
Fri Feb 15 11:19:17 CST 2013


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Feb 15 16:13:39 2013 +0000

riched20: Move the range clamping to the helper now that the range isn't used later on.

---

 dlls/riched20/paint.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 06026df..9937ec7 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -304,7 +304,8 @@ static void draw_space( ME_Context *c, ME_Run *run, int x, int y,
 
 static void get_selection_rect( ME_Context *c, ME_Run *run, int from, int to, int cy, RECT *r )
 {
-
+    from = max( 0, from );
+    to = min( run->len, to );
     r->left = ME_PointFromCharContext( c, run, from );
     r->top = 0;
     r->right = ME_PointFromCharContext( c, run, to );
@@ -349,8 +350,6 @@ static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, LPCWS
 
   if (selected)
   {
-    nSelFrom = max( 0, nSelFrom );
-    nSelTo = min( run->len, nSelTo );
     get_selection_rect( c, run, nSelFrom, nSelTo, cy, &sel_rect );
     OffsetRect( &sel_rect, x, ymin );
 




More information about the wine-cvs mailing list