106 {
107 int min_x = 0;
108 bool min_x_set = false;
109 int min_y = 0;
110 bool min_y_set = false;
111 int max_x = 0;
112 bool max_x_set = false;
113 int max_y = 0;
114 bool max_y_set = false;
116 const vec2<int> &pt = it.first;
117 if (!min_x_set || pt.x < min_x) {
118 min_x = pt.x;
119 min_x_set = true;
120 }
121 if (!min_y_set || pt.y < min_y) {
122 min_y = pt.y;
123 min_y_set = true;
124 }
125 if (!max_x_set || pt.x > max_x) {
126 max_x = pt.x;
127 max_x_set = true;
128 }
129 if (!max_y_set || pt.y > max_y) {
130 max_y = pt.y;
131 max_y_set = true;
132 }
133 }
134 return rect<int>(min_x, min_y, max_x + 1, max_y + 1);
135 }