comparison win/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 b9577d1f0411
children 66999ff50174
comparison
equal deleted inserted replaced
1441:b9577d1f0411 1442:02a329b2b0cd
1140 /* Reset the box sizes */ 1140 /* Reset the box sizes */
1141 thisbox->minwidth = thisbox->minheight = thisbox->usedpadx = thisbox->usedpady = thisbox->pad * 2; 1141 thisbox->minwidth = thisbox->minheight = thisbox->usedpadx = thisbox->usedpady = thisbox->pad * 2;
1142 1142
1143 if(thisbox->grouphwnd) 1143 if(thisbox->grouphwnd)
1144 { 1144 {
1145 char *text = dw_window_get_text(thisbox->grouphwnd); 1145 /* Only calculate the size on the first pass...
1146 1146 * use the cached values on second.
1147 thisbox->grouppady = 9;
1148
1149 if(text)
1150 {
1151 if(*text)
1152 dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady);
1153 dw_free(text);
1154 }
1155 /* If the string height is less than 9...
1156 * set it to 9 anyway since that is the minimum.
1157 */ 1147 */
1158 if(thisbox->grouppady < 9) 1148 if(pass == 1)
1149 {
1150 char *text = dw_window_get_text(thisbox->grouphwnd);
1151
1159 thisbox->grouppady = 9; 1152 thisbox->grouppady = 9;
1153
1154 if(text)
1155 {
1156 if(*text)
1157 dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady);
1158 dw_free(text);
1159 }
1160 /* If the string height is less than 9...
1161 * set it to 9 anyway since that is the minimum.
1162 */
1163 if(thisbox->grouppady < 9)
1164 thisbox->grouppady = 9;
1160 1165
1161 if(thisbox->grouppady) 1166 if(thisbox->grouppady)
1162 thisbox->grouppady += 3; 1167 thisbox->grouppady += 3;
1163 else 1168 else
1164 thisbox->grouppady = 6; 1169 thisbox->grouppady = 6;
1165 1170
1166 thisbox->grouppadx = 6; 1171 thisbox->grouppadx = 6;
1172 }
1167 1173
1168 thisbox->minwidth += thisbox->grouppadx; 1174 thisbox->minwidth += thisbox->grouppadx;
1169 thisbox->usedpadx += thisbox->grouppadx; 1175 thisbox->usedpadx += thisbox->grouppadx;
1170 thisbox->minheight += thisbox->grouppady; 1176 thisbox->minheight += thisbox->grouppady;
1171 thisbox->usedpady += thisbox->grouppady; 1177 thisbox->usedpady += thisbox->grouppady;