summaryrefslogtreecommitdiff
path: root/src/createcalls.cpp
diff options
context:
space:
mode:
authorFox Caminiti <fox@foxcam.net>2023-01-06 17:44:22 -0500
committerFox Caminiti <fox@foxcam.net>2023-01-06 17:44:22 -0500
commit84d04d391bc4bf9481106d4f5ac4d3dd8f27ed87 (patch)
treeba91aaf8a4245b939b4d04aca66cd0c5bb5687c0 /src/createcalls.cpp
parent1de48570b220acc1ca7063e2a9cda1e89178c0f9 (diff)
round edges
Diffstat (limited to 'src/createcalls.cpp')
-rw-r--r--src/createcalls.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/createcalls.cpp b/src/createcalls.cpp
index cd8f3d5..4334dc8 100644
--- a/src/createcalls.cpp
+++ b/src/createcalls.cpp
@@ -627,6 +627,18 @@ Project_ShapeLayer_New(project_data *File, project_state *State, memory *Memory)
Layer->Frame_End = MainComp->Frame_End;
Layer_Select(Memory, State, Memory_Block_LazyIndexAtAddress(Memory, F_Layers, Layer));
+ shape_layer *Shape = &File->UI.Shape;
+ v2 Min = {}, Max = {};
+ void *Data = Memory_PushScratch(Memory, sizeof(nvg_point) * 128);
+ layer_transforms T = {};
+ NVG_FlattenPath(Memory, Shape, (nvg_point *)Data, State, T, 0, 0, 0, 0, 0, &Min, &Max);
+ Memory_PopScratch(Memory, sizeof(nvg_point) * 128);
+ Shape->Width = Max.x - Min.x;
+ Shape->Height = Max.y - Min.y;
+ Layer->x.CurrentValue = Min.x + (Shape->Width / 2);
+ Layer->y.CurrentValue = Min.y + (Shape->Height / 2);
+
+ /*
v2 Min = V2(10000, 10000);
v2 Max = V2(-10000, -10000);
shape_layer *Shape = &File->UI.Shape;
@@ -644,6 +656,7 @@ Project_ShapeLayer_New(project_data *File, project_state *State, memory *Memory)
v2 ShapeSize = (Max - Min);
Layer->x.CurrentValue = Min.x + (ShapeSize.x / 2);
Layer->y.CurrentValue = Min.y + (ShapeSize.y / 2);
+ */
for (int i = 0; i < Shape->Point_Count; i++) {
bezier_point *Point = Bezier_LookupAddress(Memory, Shape->Block_Bezier_Index, i, 1);
Point->Pos[0] = Point->Pos[0] - Min;