diff --git a/core/2d/AutoPolygon.cpp b/core/2d/AutoPolygon.cpp index a77ae4a20ca3..fae9e6717dba 100644 --- a/core/2d/AutoPolygon.cpp +++ b/core/2d/AutoPolygon.cpp @@ -202,8 +202,6 @@ Vec2 AutoPolygon::findFirstNoneTransparentPixel(const Rect& rect, float threshol Vec2 i; for (i.y = rect.origin.y; i.y < rect.origin.y + rect.size.height; i.y++) { - if (found) - break; for (i.x = rect.origin.x; i.x < rect.origin.x + rect.size.width; i.x++) { auto alpha = getAlphaByPos(i); @@ -213,6 +211,8 @@ Vec2 AutoPolygon::findFirstNoneTransparentPixel(const Rect& rect, float threshol break; } } + if (found) + break; } AXASSERT(found, "image is all transparent!"); return i;