summaryrefslogtreecommitdiff
path: root/src/layer.cpp
diff options
context:
space:
mode:
authorFox Caminiti <fox@foxcam.net>2023-01-04 18:30:56 -0500
committerFox Caminiti <fox@foxcam.net>2023-01-04 18:30:56 -0500
commiteebbdd012b0d156e9e92369585c6ad82ed3de371 (patch)
treebbaeec7569de49f68bf853158a95c095878cf825 /src/layer.cpp
parenta37ea807e93886e6a6ebc22a878a5649e97f015a (diff)
shapes; remove stencil buffer?
Diffstat (limited to 'src/layer.cpp')
-rw-r--r--src/layer.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/layer.cpp b/src/layer.cpp
index c3d3d16..93db19d 100644
--- a/src/layer.cpp
+++ b/src/layer.cpp
@@ -107,16 +107,20 @@ Layer_UpdateMasksEffects(project_state *State, block_layer *Layer, memory *Memor
GL_UpdateTexture(&TestM, EffectBitmapAddress, Width, Height, BytesPerPixel, 1);
if (Layer->IsShapeLayer) {
- block_bezier *Bezier = (block_bezier *)Memory_Block_AddressAtIndex(Memory, F_Bezier, Layer->Shape.Block_Bezier_Index[0]);
+ shape_layer *Shape = &Layer->Shape;
void *Data = Memory_PushScratch(Memory, sizeof(nvg_point) * 128);
- uint32 NumberOfVerts = NVG_FlattenPath(Memory, Bezier, 3, (nvg_point *)Data, L_Width, L_Height);
- void *Data2 = Memory_PushScratch(Memory, sizeof(real32) * 3 * 256);
- uint32 GL_PointCount = NVG_ExpandStroke(Memory, Bezier, NumberOfVerts, (nvg_point *)Data, (real32 *)Data2);
+ uint32 NumberOfVerts = NVG_FlattenPath(Memory, Shape, (nvg_point *)Data, L_Width, L_Height);
+ void *Data_Stroke = Memory_PushScratch(Memory, sizeof(real32) * 4 * 256);
+ uint32 StrokeCount = NVG_ExpandStroke(Memory, NumberOfVerts, Shape->Opt.StrokeWidth, Shape->IsClosed, (nvg_point *)Data, (real32 *)Data_Stroke);
+ void *Data_Fill = Memory_PushScratch(Memory, sizeof(real32) * 4 * NumberOfVerts);
+ NVG_ExpandFill(Memory, NumberOfVerts, (nvg_point *)Data, (real32 *)Data_Fill);
layer_transforms T = Layer_GetTransforms(Layer);
- GL_RasterizeShape(&TestL, &TestM, Data2, GL_PointCount, T, Width, Height, BytesPerPixel, EffectBitmapAddress, *L_Width, *L_Height);
+ GL_RasterizeShape(&TestL, &TestM, Data_Stroke, Data_Fill, StrokeCount, NumberOfVerts, T,
+ Width, Height, BytesPerPixel, EffectBitmapAddress, *L_Width, *L_Height, Layer->Shape.Opt.StrokeCol, Shape->Opt.Visibility);
- Memory_PopScratch(Memory, sizeof(real32) * 3 * 256);
+ Memory_PopScratch(Memory, sizeof(real32) * 4 * NumberOfVerts);
+ Memory_PopScratch(Memory, sizeof(real32) * 4 * 256);
Memory_PopScratch(Memory, sizeof(nvg_point) * 128);
// Bitmap_StencilAlpha(SourceBitmapAddress, EffectBitmapAddress, Source->BytesPerPixel, Size);
@@ -350,7 +354,7 @@ Layer_TestSelection(memory *Memory, project_state *State, ui *UI, sorted_comp_ar
block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, Index_Physical);
block_source *Source = (block_source *)Memory_Block_AddressAtIndex(Memory, F_Sources, Layer->Block_Source_Index);
layer_transforms T = Layer_GetTransforms(Layer);
- v2 UV = T_CompUVToLayerUV(T, Comp->Width, Comp->Height, Source->Width, Source->Height, State->TempZoomRatio);
+ v2 UV = T_CompUVToLayerUV(T, Comp->Width, Comp->Height, Source->Width, Source->Height, State->LastClickedPoint);
if (UV.x <= 1.0f && UV.x >= 0.0f && UV.y <= 1.0f && UV.y >= 0.0f && Layer->IsSelected)
{
SelectionCount++;
@@ -364,7 +368,7 @@ Layer_TestSelection(memory *Memory, project_state *State, ui *UI, sorted_comp_ar
block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, Index_Physical);
block_source *Source = (block_source *)Memory_Block_AddressAtIndex(Memory, F_Sources, Layer->Block_Source_Index);
layer_transforms T = Layer_GetTransforms(Layer);
- v2 UV = T_CompUVToLayerUV(T, Comp->Width, Comp->Height, Source->Width, Source->Height, State->TempZoomRatio);
+ v2 UV = T_CompUVToLayerUV(T, Comp->Width, Comp->Height, Source->Width, Source->Height, State->LastClickedPoint);
if (UV.x <= 1.0f && UV.x >= 0.0f && UV.y <= 1.0f && UV.y >= 0.0f && !Layer->IsSelected)
{
if (SelectionCount == 1) {