else if (type == SvgParserLengthType::Horizontal) parsedValue = (parsedValue / 100.0) * svgParse->global.w;
else //if other then it's radius
{
- float max = svgParse->global.w;
+ float max = (float)svgParse->global.w;
if (max < svgParse->global.h)
- max = svgParse->global.h;
+ max = (float)svgParse->global.h;
parsedValue = (parsedValue / 100.0) * max;
}
}
*
* https://www.w3.org/TR/2015/WD-SVG2-20150915/coords.html
*/
- if (type == SvgParserLengthType::Vertical) max = svgParse->global.h;
- else if (type == SvgParserLengthType::Horizontal) max = svgParse->global.w;
+ if (type == SvgParserLengthType::Vertical) max = (float)svgParse->global.h;
+ else if (type == SvgParserLengthType::Horizontal) max = (float)svgParse->global.w;
else if (type == SvgParserLengthType::Other) max = sqrtf(pow(svgParse->global.h, 2) + pow(svgParse->global.w, 2)) / sqrtf(2.0);
if (strstr(str, "%")) parsedValue = parsedValue / 100.0;
if (_parseNumber(&value, &doc->vy)) {
if (_parseNumber(&value, &doc->vw)) {
_parseNumber(&value, &doc->vh);
- loader->svgParse->global.h = doc->vh;
+ loader->svgParse->global.h = (uint32_t)doc->vh;
}
- loader->svgParse->global.w = doc->vw;
+ loader->svgParse->global.w = (uint32_t)doc->vw;
}
- loader->svgParse->global.y = doc->vy;
+ loader->svgParse->global.y = (int)doc->vy;
}
- loader->svgParse->global.x = doc->vx;
+ loader->svgParse->global.x = (int)doc->vx;
} else if (!strcmp(key, "preserveAspectRatio")) {
if (!strcmp(value, "none")) doc->preserveAspect = false;
} else if (!strcmp(key, "style")) {
if (loader->svgParse->global.w == 0) {
if (doc->w < FLT_EPSILON) loader->svgParse->global.w = 1;
- else loader->svgParse->global.w = doc->w;
+ else loader->svgParse->global.w = (uint32_t)doc->w;
}
if (loader->svgParse->global.h == 0) {
if (doc->h < FLT_EPSILON) loader->svgParse->global.h = 1;
- else loader->svgParse->global.h =doc->h;
+ else loader->svgParse->global.h = (uint32_t)doc->h;
}
return loader->svgParse->node;
REQUIRE(shape->close() == Result::Success);
REQUIRE(shape->moveTo(100, 100) == Result::Success);
- REQUIRE(shape->moveTo(99999999, -99999999) == Result::Success);
+ REQUIRE(shape->moveTo(99999999.0f, -99999999.0f) == Result::Success);
REQUIRE(shape->moveTo(0, 0) == Result::Success);
REQUIRE(shape->lineTo(120, 140) == Result::Success);
- REQUIRE(shape->lineTo(99999999, -99999999) == Result::Success);
+ REQUIRE(shape->lineTo(99999999.0f, -99999999.0f) == Result::Success);
REQUIRE(shape->lineTo(0, 0) == Result::Success);
REQUIRE(shape->cubicTo(0, 0, 0, 0, 0, 0) == Result::Success);
- REQUIRE(shape->cubicTo(0, 0, 99999999, -99999999, 0, 0) == Result::Success);
- REQUIRE(shape->cubicTo(0, 0, 99999999, -99999999, 99999999, -99999999) == Result::Success);
- REQUIRE(shape->cubicTo(99999999, -99999999, 99999999, -99999999, 99999999, -99999999) == Result::Success);
+ REQUIRE(shape->cubicTo(0, 0, 99999999.0f, -99999999.0f, 0, 0) == Result::Success);
+ REQUIRE(shape->cubicTo(0, 0, 99999999.0f, -99999999.0f, 99999999.0f, -99999999.0f) == Result::Success);
+ REQUIRE(shape->cubicTo(99999999.0f, -99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, -99999999.0f) == Result::Success);
REQUIRE(shape->close() == Result::Success);
REQUIRE(shape->lineTo(120, 140) == Result::Success);
REQUIRE(shape->appendRect(0, 0, 0, 0, 0, 0) == Result::Success);
- REQUIRE(shape->appendRect(0, 0,99999999, -99999999, 0, 0) == Result::Success);
- REQUIRE(shape->appendRect(0, 0, 0, 0, -99999999, 99999999) == Result::Success);
- REQUIRE(shape->appendRect(99999999, -99999999, 99999999, -99999999, 99999999, -99999999) == Result::Success);
+ REQUIRE(shape->appendRect(0, 0,99999999.0f, -99999999.0f, 0, 0) == Result::Success);
+ REQUIRE(shape->appendRect(0, 0, 0, 0, -99999999.0f, 99999999.0f) == Result::Success);
+ REQUIRE(shape->appendRect(99999999.0f, -99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, -99999999.0f) == Result::Success);
REQUIRE(shape->appendCircle(0, 0, 0, 0) == Result::Success);
- REQUIRE(shape->appendCircle(-99999999, 99999999, 0, 0) == Result::Success);
- REQUIRE(shape->appendCircle(-99999999, 99999999, -99999999, 99999999) == Result::Success);
+ REQUIRE(shape->appendCircle(-99999999.0f, 99999999.0f, 0, 0) == Result::Success);
+ REQUIRE(shape->appendCircle(-99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f) == Result::Success);
REQUIRE(shape->appendArc(0, 0, 0, 0, 0, false) == Result::Success);
REQUIRE(shape->appendArc(0, 0, 0, 0, 0, true) == Result::Success);
- REQUIRE(shape->appendArc(-99999999, 99999999, 0, 0, 0, false) == Result::Success);
- REQUIRE(shape->appendArc(-99999999, 99999999, 0, 0, 0, true) == Result::Success);
- REQUIRE(shape->appendArc(-99999999, 99999999, -99999999, 99999999, 0, false) == Result::Success);
- REQUIRE(shape->appendArc(-99999999, 99999999, -99999999, 99999999, 0, true) == Result::Success);
- REQUIRE(shape->appendArc(-99999999, 99999999, -99999999, 99999999, -400, false) == Result::Success);
- REQUIRE(shape->appendArc(-99999999, 99999999, -99999999, 99999999, 400, true) == Result::Success);
+ REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, 0, 0, 0, false) == Result::Success);
+ REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, 0, 0, 0, true) == Result::Success);
+ REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, 0, false) == Result::Success);
+ REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, 0, true) == Result::Success);
+ REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, -400, false) == Result::Success);
+ REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, 400, true) == Result::Success);
}
TEST_CASE("Appending Pathes", "[tvgShape]")