-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dashing wasn't incrementing index for dash and could get stuck if 0 length dash was provided. This will leave an empty path if it finds an impossible dashing condition. Diffs= b06e05dc1 Fix dash increment (#8038) Co-authored-by: Luigi Rosso <[email protected]>
- Loading branch information
1 parent
33a51d0
commit dc59953
Showing
3 changed files
with
57 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5c312867e32d4a347e5483dca9798b1dd3dd30d1 | ||
b06e05dc18248d218807e00779d35c94bdfb8efe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "rive/shapes/paint/dash_path.hpp" | ||
#include "utils/no_op_factory.hpp" | ||
#include <catch.hpp> | ||
#include <cstdio> | ||
|
||
class _TestDasher : public rive::PathDasher | ||
{ | ||
|
||
public: | ||
rive::RenderPath* dash(const rive::RawPath& source, | ||
rive::Dash offset, | ||
rive::Span<rive::Dash> dashes) | ||
{ | ||
rive::NoOpFactory noOpFactory; | ||
return rive::PathDasher::dash(source, &noOpFactory, offset, dashes); | ||
} | ||
}; | ||
|
||
TEST_CASE("0 length dashes don't cause a crash", "[dashing]") | ||
{ | ||
rive::RawPath rawPath; | ||
rawPath.addRect({1, 1, 5, 6}); | ||
|
||
_TestDasher dasher; | ||
std::vector dashes = {rive::Dash(0.0f, false), rive::Dash(0.0f, false)}; | ||
|
||
rive::Dash offset(0.0f, false); | ||
dasher.dash(rawPath, offset, dashes); | ||
} |