286 {
287 u16 min_x = 0;
288 bool min_x_set = false;
289 u16 min_y = 0;
290 bool min_y_set = false;
291 u16 max_x = 0;
292 bool max_x_set = false;
293 u16 max_y = 0;
294 bool max_y_set = false;
296 const vec2<u16> &pt = it.first;
297 if (!min_x_set || pt.x < min_x) {
298 min_x = pt.x;
299 min_x_set = true;
300 }
301 if (!min_y_set || pt.y < min_y) {
302 min_y = pt.y;
303 min_y_set = true;
304 }
305 if (!max_x_set || pt.x > max_x) {
306 max_x = pt.x;
307 max_x_set = true;
308 }
309 if (!max_y_set || pt.y > max_y) {
310 max_y = pt.y;
311 max_y_set = true;
312 }
313 }
314 return rect<u16>(min_x, min_y, max_x + 1, max_y + 1);
315 }