Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | svgnano return width or height of 0 is an error and is true for some png images. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | tip-545-svg-options |
Files: | files | file ages | folders |
SHA3-256: |
4faf68ed2c16e4cedfee8f0ef1ede8cb |
User & Date: | oehhar 2019-06-09 12:51:50.201 |
Context
2019-06-10
| ||
11:53 | Minor changes in the new tests check-in: c4b7a751 user: fvogel tags: tip-545-svg-options | |
2019-06-09
| ||
12:51 | svgnano return width or height of 0 is an error and is true for some png images. check-in: 4faf68ed user: oehhar tags: tip-545-svg-options | |
2019-06-07
| ||
18:46 | Merge trunk check-in: c4aca028 user: oehhar tags: tip-545-svg-options | |
Changes
Changes to generic/tkImgSVGnano.c.
︙ | ︙ | |||
135 136 137 138 139 140 141 | /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); return 0; } data = Tcl_GetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); Tcl_DecrRefCount(dataObj); | | > > > > > > > > > > | | | | | | | | | < < | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); return 0; } data = Tcl_GetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); Tcl_DecrRefCount(dataObj); if (nsvgImage == NULL) { return 0; } /* * Width and Height equal zero is an svgnano error case and must be errored * out. Valid png images give width and height 0 as result */ if ((nsvgImage->width <= 0.0) || (nsvgImage->height <= 0.0)) { nsvgDelete(nsvgImage); return 0; } GetScaleFromParameters( nsvgImage, &ropts, widthPtr, heightPtr); if (!CacheSVG(interp, chan, formatObj, nsvgImage, &ropts)) { nsvgDelete(nsvgImage); } return 1; } /* *---------------------------------------------------------------------- * * FileReadSVG -- * |
︙ | ︙ | |||
239 240 241 242 243 244 245 | const char *data; RastOpts ropts; NSVGimage *nsvgImage; CleanCache(interp); data = Tcl_GetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); | | > > > > > > > > > > | | | | | | | | | < < | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | const char *data; RastOpts ropts; NSVGimage *nsvgImage; CleanCache(interp); data = Tcl_GetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); if (nsvgImage == NULL) { return 0; } /* * Width and Height equal zero is an svgnano error case and must be errored * out. Valid png images give width and height 0 as result */ if ((nsvgImage->width <= 0.0) || (nsvgImage->height <= 0.0)) { nsvgDelete(nsvgImage); return 0; } GetScaleFromParameters( nsvgImage, &ropts, widthPtr, heightPtr); if (!CacheSVG(interp, dataObj, formatObj, nsvgImage, &ropts)) { nsvgDelete(nsvgImage); } return 1; } /* *---------------------------------------------------------------------- * * StringReadSVG -- * |
︙ | ︙ | |||
595 596 597 598 599 600 601 | RastOpts *ropts, int *widthPtr, int *heightPtr) { double scale; int width, height; /* | < < | < < < < | | < < < | | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | RastOpts *ropts, int *widthPtr, int *heightPtr) { double scale; int width, height; /* * nsvgImage->width and nsvgImage->height are greater than 0. * Equal to 0 is an svgnano error case. */ if (ropts->scaleToHeight > 0) { /* * Fix height */ height = ropts->scaleToHeight; scale = height / nsvgImage->height; width = (int) ceil(nsvgImage->width * scale); } else if (ropts->scaleToWidth > 0) { |
︙ | ︙ |