Mercurial > dwindows
changeset 1442:02a329b2b0cd
Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
Only calculate the groupbox border size on the first pass.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 08 Dec 2011 21:58:02 +0000 |
parents | b9577d1f0411 |
children | 66999ff50174 |
files | mac/dw.m os2/dw.c win/dw.c |
diffstat | 3 files changed, 52 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/mac/dw.m Thu Dec 08 11:43:28 2011 +0000 +++ b/mac/dw.m Thu Dec 08 21:58:02 2011 +0000 @@ -2428,7 +2428,7 @@ if(thisbox->grouphwnd) { /* Only calculate the size on the first pass... - * used the cached values on second. + * use the cached values on second. */ if(pass == 1) {
--- a/os2/dw.c Thu Dec 08 11:43:28 2011 +0000 +++ b/os2/dw.c Thu Dec 08 21:58:02 2011 +0000 @@ -1075,29 +1075,35 @@ if(thisbox->grouphwnd) { - char *text = dw_window_get_text(thisbox->grouphwnd); - - thisbox->grouppady = 9; - - if(text) - { - if(*text) - dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady); - dw_free(text); - } - /* If the string height is less than 9... - * set it to 9 anyway since that is the minimum. + /* Only calculate the size on the first pass... + * use the cached values on second. */ - if(thisbox->grouppady < 9) + if(pass == 1) + { + char *text = dw_window_get_text(thisbox->grouphwnd); + thisbox->grouppady = 9; - if(thisbox->grouppady) - thisbox->grouppady += 3; - else - thisbox->grouppady = 6; - - thisbox->grouppadx = 6; - + if(text) + { + if(*text) + dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady); + dw_free(text); + } + /* If the string height is less than 9... + * set it to 9 anyway since that is the minimum. + */ + if(thisbox->grouppady < 9) + thisbox->grouppady = 9; + + if(thisbox->grouppady) + thisbox->grouppady += 3; + else + thisbox->grouppady = 6; + + thisbox->grouppadx = 6; + } + thisbox->minwidth += thisbox->grouppadx; thisbox->usedpadx += thisbox->grouppadx; thisbox->minheight += thisbox->grouppady;
--- a/win/dw.c Thu Dec 08 11:43:28 2011 +0000 +++ b/win/dw.c Thu Dec 08 21:58:02 2011 +0000 @@ -1142,28 +1142,34 @@ if(thisbox->grouphwnd) { - char *text = dw_window_get_text(thisbox->grouphwnd); - - thisbox->grouppady = 9; - - if(text) - { - if(*text) - dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady); - dw_free(text); - } - /* If the string height is less than 9... - * set it to 9 anyway since that is the minimum. + /* Only calculate the size on the first pass... + * use the cached values on second. */ - if(thisbox->grouppady < 9) + if(pass == 1) + { + char *text = dw_window_get_text(thisbox->grouphwnd); + thisbox->grouppady = 9; + + if(text) + { + if(*text) + dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady); + dw_free(text); + } + /* If the string height is less than 9... + * set it to 9 anyway since that is the minimum. + */ + if(thisbox->grouppady < 9) + thisbox->grouppady = 9; - if(thisbox->grouppady) - thisbox->grouppady += 3; - else - thisbox->grouppady = 6; - - thisbox->grouppadx = 6; + if(thisbox->grouppady) + thisbox->grouppady += 3; + else + thisbox->grouppady = 6; + + thisbox->grouppadx = 6; + } thisbox->minwidth += thisbox->grouppadx; thisbox->usedpadx += thisbox->grouppadx;