| 4222 | } |
| 4223 | |
| 4224 | void takeXformBounds(NSVGshape *shape, float *xform, float *bounds) |
| 4225 | { |
| 4226 | float newBounds[8]; //(x1, y1), (x2, y2), (x2, y1), (x1, y2) |
| 4227 | nsvg__xformPoint(&newBounds[0], &newBounds[1], shape->bounds[0], shape->bounds[1], xform); |
| 4228 | nsvg__xformPoint(&newBounds[2], &newBounds[3], shape->bounds[2], shape->bounds[3], xform); |
| 4229 | nsvg__xformPoint(&newBounds[4], &newBounds[5], shape->bounds[2], shape->bounds[1], xform); |
| 4230 | nsvg__xformPoint(&newBounds[6], &newBounds[7], shape->bounds[0], shape->bounds[3], xform); |
| 4231 | //we have to take into account all points, as x1 can be > x2 etc. |
| 4232 | bounds[0] = nsvg__minf(bounds[0], newBounds[0]); |
| 4233 | bounds[0] = nsvg__minf(bounds[0], newBounds[2]); |
| 4234 | bounds[0] = nsvg__minf(bounds[0], newBounds[4]); |
| 4235 | bounds[0] = nsvg__minf(bounds[0], newBounds[6]); |
| 4236 | |
| 4237 | bounds[1] = nsvg__minf(bounds[1], newBounds[1]); |
| 4238 | bounds[1] = nsvg__minf(bounds[1], newBounds[3]); |
| 4239 | bounds[1] = nsvg__minf(bounds[1], newBounds[5]); |
| 4240 | bounds[1] = nsvg__minf(bounds[1], newBounds[7]); |
| 4241 | |
| 4242 | bounds[2] = nsvg__maxf(bounds[2], newBounds[0]); |
| 4243 | bounds[2] = nsvg__maxf(bounds[2], newBounds[2]); |
| 4244 | bounds[2] = nsvg__maxf(bounds[2], newBounds[4]); |
| 4245 | bounds[2] = nsvg__maxf(bounds[2], newBounds[6]); |
| 4246 | |
| 4247 | bounds[3] = nsvg__maxf(bounds[3], newBounds[1]); |
| 4248 | bounds[3] = nsvg__maxf(bounds[3], newBounds[3]); |
| 4249 | bounds[3] = nsvg__maxf(bounds[3], newBounds[5]); |
| 4250 | bounds[3] = nsvg__maxf(bounds[3], newBounds[7]); |
| 4251 | } |
| 4252 | //image bounds for a shape group |
| 4253 | //bounds inited before use, called from nsvgParse |
| 4254 | //assumed each shape already has bounds calculated. |
no test coverage detected