diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 8f2c1343..f5f60042 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -553,7 +553,7 @@ static void _updateRect(LottieGroup* parent, LottieObject** child, float frameNo } -static void _appendCircle(Shape* shape, float cx, float cy, float rx, float ry, Matrix* transform) +static void _appendCircle(Shape* shape, float cx, float cy, float rx, float ry, Matrix* transform, bool clockwise) { auto rxKappa = rx * PATH_KAPPA; auto ryKappa = ry * PATH_KAPPA; @@ -565,13 +565,21 @@ static void _appendCircle(Shape* shape, float cx, float cy, float rx, float ry, }; constexpr int ptsCnt = 13; - Point points[ptsCnt] = { - {cx, cy - ry}, //moveTo - {cx + rxKappa, cy - ry}, {cx + rx, cy - ryKappa}, {cx + rx, cy}, //cubicTo - {cx + rx, cy + ryKappa}, {cx + rxKappa, cy + ry}, {cx, cy + ry}, //cubicTo - {cx - rxKappa, cy + ry}, {cx - rx, cy + ryKappa}, {cx - rx, cy}, //cubicTo - {cx - rx, cy - ryKappa}, {cx - rxKappa, cy - ry}, {cx, cy - ry} //cubicTo - }; + Point points[ptsCnt]; + + if (clockwise) { + points[0] = {cx, cy - ry}; //moveTo + points[1] = {cx + rxKappa, cy - ry}; points[2] = {cx + rx, cy - ryKappa}; points[3] = {cx + rx, cy}; //cubicTo + points[4] = {cx + rx, cy + ryKappa}; points[5] = {cx + rxKappa, cy + ry}; points[6] = {cx, cy + ry}; //cubicTo + points[7] = {cx - rxKappa, cy + ry}; points[8] = {cx - rx, cy + ryKappa}; points[9] = {cx - rx, cy}; //cubicTo + points[10] = {cx - rx, cy - ryKappa}; points[11] = {cx - rxKappa, cy - ry}; points[12] = {cx, cy - ry}; //cubicTo + } else { + points[0] = {cx, cy - ry}; //moveTo + points[1] = {cx - rxKappa, cy - ry}; points[2] = {cx - rx, cy - ryKappa}; points[3] = {cx - rx, cy}; //cubicTo + points[4] = {cx - rx, cy + ryKappa}; points[5] = {cx - rxKappa, cy + ry}; points[6] = {cx, cy + ry}; //cubicTo + points[7] = {cx + rxKappa, cy + ry}; points[8] = {cx + rx, cy + ryKappa}; points[9] = {cx + rx, cy}; //cubicTo + points[10] = {cx + rx, cy - ryKappa}; points[11] = {cx + rxKappa, cy - ry}; points[12] = {cx, cy - ry}; //cubicTo + } if (transform) { for (int i = 0; i < ptsCnt; ++i) { @@ -592,11 +600,11 @@ static void _updateEllipse(LottieGroup* parent, LottieObject** child, float fram if (!ctx->repeaters.empty()) { auto path = Shape::gen(); - _appendCircle(path.get(), position.x, position.y, size.x * 0.5f, size.y * 0.5f, ctx->transform); + _appendCircle(path.get(), position.x, position.y, size.x * 0.5f, size.y * 0.5f, ctx->transform, ellipse->clockwise); _repeat(parent, std::move(path), ctx); } else { _draw(parent, ctx); - _appendCircle(ctx->merging, position.x, position.y, size.x * 0.5f, size.y * 0.5f, ctx->transform); + _appendCircle(ctx->merging, position.x, position.y, size.x * 0.5f, size.y * 0.5f, ctx->transform, ellipse->clockwise); } } diff --git a/src/loaders/lottie/tvgLottieParser.cpp b/src/loaders/lottie/tvgLottieParser.cpp index 72cf36b0..1f0debef 100644 --- a/src/loaders/lottie/tvgLottieParser.cpp +++ b/src/loaders/lottie/tvgLottieParser.cpp @@ -1088,8 +1088,7 @@ void LottieParser::parseTimeRemap(LottieLayer* layer) uint8_t LottieParser::getDirection() { - auto v = getInt(); - if (v == 3) return false; + if (getInt() == 3) return false; return true; }