Skip to content

Commit 802ee03

Browse files
authored
Clipper2 1.5.4 (#2563)
This release fixes a bug that very occasionally caused an endless loop (see GitHub issues #735 & #979)
1 parent f4855f6 commit 802ee03

File tree

3 files changed

+43
-10
lines changed

3 files changed

+43
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifndef CLIPPER_VERSION_H
22
#define CLIPPER_VERSION_H
33

4-
constexpr auto CLIPPER2_VERSION = "1.5.3";
4+
constexpr auto CLIPPER2_VERSION = "1.5.4";
55

66
#endif // CLIPPER_VERSION_H

3rdparty/clipper2/src/clipper.engine.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* Author : Angus Johnson *
3-
* Date : 4 May 2025 *
3+
* Date : 30 May 2025 *
44
* Website : https://www.angusj.com *
55
* Copyright : Angus Johnson 2010-2025 *
66
* Purpose : This is the main polygon clipping module *
@@ -2119,10 +2119,9 @@ namespace Clipper2Lib {
21192119
e->prev_in_sel = e->prev_in_ael;
21202120
e->next_in_sel = e->next_in_ael;
21212121
e->jump = e->next_in_sel;
2122-
if (e->join_with == JoinWith::Left)
2123-
e->curr_x = e->prev_in_ael->curr_x; // also avoids complications
2124-
else
2125-
e->curr_x = TopX(*e, top_y);
2122+
// it is safe to ignore 'joined' edges here because
2123+
// if necessary they will be split in IntersectEdges()
2124+
e->curr_x = TopX(*e, top_y);
21262125
e = e->next_in_ael;
21272126
}
21282127
}

tests/cpp-tests/Source/BugsTest/Bug-350.cpp

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,44 @@ bool Bug350Layer::init()
3535
{
3636
if (BugsTestBase::init())
3737
{
38-
auto size = Director::getInstance()->getWinSize();
39-
auto background = Sprite::create("Hello.png");
40-
background->setPosition(size.width / 2, size.height / 2);
41-
addChild(background);
38+
// auto size = Director::getInstance()->getWinSize();
39+
// auto background = Sprite::create("Hello.png");
40+
// background->setPosition(size.width / 2, size.height / 2);
41+
// addChild(background);
42+
43+
auto visibleSize = Director::getInstance()->getVisibleSize();
44+
Vec2 origin = Director::getInstance()->getVisibleOrigin();
45+
46+
// https: // rezghob.com/different-sprite-types/
47+
48+
auto spriteCache = SpriteFrameCache::getInstance();
49+
// spriteCache->addSpriteFramesWithFile("sprites_quad.plist");
50+
spriteCache->addSpriteFramesWithFile("sprites_poly.plist");
51+
52+
for (int i = 0; i < 10000; i++)
53+
{
54+
auto sprite1 = Sprite::createWithSpriteFrameName("PolySprite1.png");
55+
// sprite1->setPosition(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2);
56+
sprite1->setPosition(50*AXRANDOM_MINUS1_1() + origin.x + visibleSize.width / 2,
57+
50*AXRANDOM_MINUS1_1() + origin.y + visibleSize.height / 2);
58+
sprite1->setScale(5);
59+
sprite1->setColor(Color3B::RED);
60+
this->addChild(sprite1);
61+
62+
auto sprite2 = Sprite::createWithSpriteFrameName("PolySprite2.png");
63+
sprite2->setPosition(origin.x + visibleSize.width / 4, origin.y + visibleSize.height / 2);
64+
sprite2->setScale(5);
65+
sprite2->setTexture(sprite1->getTexture());
66+
// sprite2->setColor(Color3B::BLUE);
67+
this->addChild(sprite2);
68+
69+
auto sprite3 = Sprite::createWithSpriteFrameName("PolySprite3.png");
70+
sprite3->setPosition(origin.x + visibleSize.width / 1.3, origin.y + visibleSize.height / 2);
71+
sprite3->setScale(5);
72+
sprite3->setColor(Color3B::BLUE);
73+
this->addChild(sprite3);
74+
}
75+
4276
return true;
4377
}
4478

0 commit comments

Comments
 (0)