Fixed conic verb bug in eraser

This commit is contained in:
Yousef Khadadeh 2026-05-27 06:34:43 +03:00
parent c3fa1deee9
commit 54fb48cec7
7 changed files with 133 additions and 63 deletions

View file

@ -20,6 +20,7 @@
#include "../CoordSpaceHelper.hpp"
#include <include/core/SkPathBuilder.h>
#include "../InputManager.hpp"
#include <clipper2/clipper.h>
class DrawingProgram;
@ -31,6 +32,7 @@ struct MeshShapeData {
};
namespace BrushComponentCode {
constexpr float CLIPPER_SIMPLIFY_EPSILON = 0.1;
struct BrushPoint {
Vector2f pos;
float width;
@ -47,6 +49,12 @@ namespace BrushComponentCode {
CoordSpaceHelper coords;
};
void skpath_to_clipper2_pathsd(Clipper2Lib::PathsD& clipperPath, const SkPath& skPath);
bool clipper2_polygon_to_skpath_builder(SkPathBuilder& skPathBuilder, const Clipper2Lib::PathD& clipperPath);
void sort_clipper_polytreed_into_skpaths(std::vector<SkPath>& paths, const Clipper2Lib::PolyTreeD& tree);
void clipper2_polygons_to_skpath_builder(SkPathBuilder& skPathBuilder, const Clipper2Lib::PathsD& clipperPath);
std::optional<SkPath> skpath_simplify_only_lines(const SkPath& skPath);
SkPath brush_stroke_to_skpath(const std::vector<BrushPoint>& brushPoints, bool hasRoundCaps);
SkPath create_triangles(const std::vector<BrushPoint>& regularPoints, const std::vector<BrushPoint>& smoothedPoints, bool hasRoundCaps);
std::vector<size_t> get_wedge_indices(const std::vector<BrushPoint>& points);