Mercurial > dwindows
diff os2/dw.c @ 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 | 09fa437d6a5f |
children | 914ac25f7d37 |
line wrap: on
line diff
--- 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;