diff options
author | Fox Caminiti <fox@foxcam.net> | 2023-01-03 16:40:57 -0500 |
---|---|---|
committer | Fox Caminiti <fox@foxcam.net> | 2023-01-03 16:40:57 -0500 |
commit | a37ea807e93886e6a6ebc22a878a5649e97f015a (patch) | |
tree | c5af6ddc8544d97e38276bc1b83dbf1b29a8180b /src/layer.cpp | |
parent | 375c120d30456738897c4bd775e38aa1db7d239c (diff) |
shape layer work
Diffstat (limited to 'src/layer.cpp')
-rw-r--r-- | src/layer.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/layer.cpp b/src/layer.cpp index 41b52cc..c3d3d16 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -94,7 +94,7 @@ Layer_GetTopOffset(project_data *File, memory *Memory) static void Layer_UpdateMasksEffects(project_state *State, block_layer *Layer, memory *Memory, void *EffectBitmapAddress, - int Width, int Height, int BytesPerPixel) + int Width, int Height, int BytesPerPixel, int *L_Width, int *L_Height) { uint64 Size = Width*Height*BytesPerPixel; @@ -106,6 +106,22 @@ Layer_UpdateMasksEffects(project_state *State, block_layer *Layer, memory *Memor GL_UpdateTexture(&TestL, EffectBitmapAddress, Width, Height, BytesPerPixel, 0); 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]); + 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); + + layer_transforms T = Layer_GetTransforms(Layer); + GL_RasterizeShape(&TestL, &TestM, Data2, GL_PointCount, T, Width, Height, BytesPerPixel, EffectBitmapAddress, *L_Width, *L_Height); + + Memory_PopScratch(Memory, sizeof(real32) * 3 * 256); + Memory_PopScratch(Memory, sizeof(nvg_point) * 128); + + // Bitmap_StencilAlpha(SourceBitmapAddress, EffectBitmapAddress, Source->BytesPerPixel, Size); + } + for (int i = 0; i < Layer->Block_Effect_Count; i++) { block_effect Effect = *(block_effect *)Memory_Block_AddressAtIndex(Memory, F_Effects, Layer->Block_Effect_Index[i]); @@ -140,20 +156,6 @@ Layer_UpdateMasksEffects(project_state *State, block_layer *Layer, memory *Memor Memory_PopScratch(Memory, Size); } } - /* - if (Layer->NumberOfMasks) { - for (int i = 0; i < Layer->NumberOfMasks; i++) { - file_mask_header *MaskHeader = (file_mask_header *)((uint8 *)Layer + sizeof(file_layer) + MaskOffset); - if (MaskHeader->IsClosed && MaskHeader->IsToggled) { - mask_point *Point = (mask_point *)((uint8 *)MaskHeader + sizeof(file_mask_header)); - Mask_TriangulateAndRasterize(TestM, TestL, Memory, MaskHeader, Point, Source->Width, Source->Height, Source->BytesPerPixel, EffectBitmapAddress); - } - } - Bitmap_StencilAlpha(SourceBitmapAddress, EffectBitmapAddress, Source->BytesPerPixel, Size); - } - - Layer->OutputBitmapLocation = EffectBitmapAddress; - */ GL_DeleteHWBuffer(&TestL); GL_DeleteHWBuffer(&TestM); |