static int32 LayerIterate_TestSelection(project_state *State, memory *Memory, uint32 PrincipalIndex, layer_transforms ExtraT, v2 Center, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, bool32 BelowOnly); // TODO(fox);: Incorporate sorting for non-continuous shapes. static uint32 Bezier_Shape_Sort(memory *Memory, shape_layer *Shape, bezier_point *PointData, project_state *State, layer_transforms T, int Width, int Height, int CompWidth, int CompHeight, real32 Radius, bool32 Interact); static void Property_AddKeyframe_AllSelected(project_data *File, project_state *State, memory *Memory, memory_table_list TableName, sorted_layer_array *SortedLayerArray, sorted_comp_array *SortedCompArray, uint16 *SortedKeyframeArray, uint16 Idx, int Frame); static int32 Bezier_CheckSameX(memory *Memory, memory_table_list TableName, uint16 *Block_Bezier_Index, uint16 KeyframeCount, uint16 *ArrayLocation, real32 ValX); static void Property_AddKeyframe(memory *Memory, memory_table_list TableName, uint16 *ArrayLocation, property_channel *Property, int Frame); static bezier_point * Bezier_LookupAddress(memory *Memory, uint16 *Block_Bezier_Index, uint16 Index, bool32 AssertExists = 1); static void Bezier_Interact_Evaluate(project_state *State, bezier_point *PointAddress, v2 *Pos, real32 GraphZoomHeight = 1, real32 Y_Increment = 1); static void Bezier_Delete(memory *Memory, memory_table_list TableName, uint16 *Block_Bezier_Index, uint16 *PointCount, uint16 *ArrayLocation); static void Bezier_Add(memory *Memory, memory_table_list TableName, uint16 *Block_Bezier_Index, uint16 *Block_Bezier_Count, uint16 *PointCount, bezier_point PointData); // return all points static void Bezier_CubicCalcPointsCasteljauStep(void *Data, uint32 Size, uint32 *Increment, real32 x1, real32 y1, real32 x2, real32 y2, real32 x3, real32 y3, real32 x4, real32 y4, real32 tess_tol, int level); void * Bezier_CubicCalcPoints(v2 p1, v2 p2, v2 p3, v2 p4, void *Data, uint32 Size); v2 Bezier_LineDist(v2 a, v2 b, v2 p); v2 Bezier_LineClosestPoint(v2 a, v2 b, v2 p); // The ratio here is just the dot product divided by the squared length. v2 Bezier_LineClosestPointR(v2 a, v2 b, v2 p, real32 *ratio); static void Bezier_CubicBoxCasteljauStep(v2 Min, v2 Max, v2 *p_closest, v2 *p_last, real32 *p_closest_dist2, real32 x1, real32 y1, real32 x2, real32 y2, real32 x3, real32 y3, real32 x4, real32 y4, real32 tess_tol, int level); static void Bezier_BoxTest(v2 p1, v2 p2, v2 p3, v2 p4, v2 Min, v2 Max, v2 *p_closest); real32 Bezier_CubicRatioOfPoint(v2 p1, v2 p2, v2 p3, v2 p4, v2 p); // finds the min/max bounds of the curve static void Bezier_CubicMinMaxCasteljauStep(v2 *p_min, v2 *p_max, real32 x1, real32 y1, real32 x2, real32 y2, real32 x3, real32 y3, real32 x4, real32 y4, real32 tess_tol, int level); real32 Bezier_CubicRatioOfPoint(v2 p1, v2 p2, v2 p3, v2 p4, v2 p); static void File_LoadDirectory(project_data *File, project_state *State, memory *Memory, char *DirString); static bool32 File_Open(project_data *File, project_state *State, memory *Memory, char *Filename); static bool32 IO_Save(project_data *File, project_state *State, memory *Memory, char *Filename); static void File_SaveAs(project_data *File, project_state *State, memory *Memory, char *Filename); static void Playhead_Increment(int32 *Frame_Current, int32 Frame_Start, int32 Frame_End, int32 Increment); static uint16 Source_Generate_Blank(project_data *File, project_state *State, memory *Memory, uint16 Width, uint16 Height, uint16 BytesPerPixel); static void Source_Delete(project_data *File, memory *Memory, uint32 Index); static int16 Source_Generate(project_data *File, project_state *State, memory *Memory, void *TempString); static void Property_AddKeyframe_AllSelected(project_data *File, project_state *State, memory *Memory, memory_table_list TableName, sorted_layer_array *SortedLayerArray, sorted_comp_array *SortedCompArray, uint16 *SortedKeyframeArray, uint16 Idx, int Frame); static block_composition * Precomp_Init(project_data *File, memory *Memory, block_composition *DupeComp = NULL); static uint32 Effect_Init(project_state *State, memory *Memory, uint32 EffectEntryIndex, int EffectCount); static void Effect_Add(project_data *File, project_state *State, memory *Memory, uint32 EffectEntryIndex); void Source_DeselectAll(project_data *File, memory *Memory); // NOTE(fox);: This won't work with precomps! void Clipboard_Paste(project_data *File, project_state *State, memory *Memory, sorted_comp_array *SortedCompStart, sorted_layer_array *SortedLayerStart, uint16 *SortedKeyframeArray); void Clipboard_Store(project_data *File, project_state *State, memory *Memory, sorted_comp_array *SortedCompStart, sorted_layer_array *SortedLayerStart, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray); void Property_MinMax_X(memory *Memory, project_state *State, property_channel *Property, uint16 *ArrayLocation, real32 *Min, real32 *Max); void Property_MinMax_Y(memory *Memory, project_state *State, property_channel *Property, sorted_property_array *PropertyStart, real32 *Min, real32 *Max, bool32 Evaluate = 1); inline property_channel * Effect_Property(memory *Memory, block_effect *Effect, int Offset); inline v2 Effect_V2(memory *Memory, block_effect *Effect, int Offset); // TODO(fox);: Merge with other sorting code. void Effect_Curves_Sort(memory *Memory, block_effect *Effect, uint16 *SortedPointStart, uint16 Which); static void Interact_Evaluate_Layer(memory *Memory, project_state *State, uint16 Layer_Index_Physical, sorted_comp_array SortedCompStart, sorted_layer_array *SortedLayerStart, int32 *Frame_Start, int32 *Frame_End, int *Frame_Offset); void File_DeselectAllKeyframes(project_data *File, project_state *State, memory *Memory, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray); static void Project_Layer_Delete(project_data *File, project_state *State, memory *Memory); static bool32 Property_IsGraphSelected(memory *Memory, uint16 *Block_Bezier_Index, uint16 *ArrayLocation, uint16 KeyframeCount); static void Project_Layer_Duplicate(project_data *File, project_state *State, memory *Memory, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, v2 Offset, bool32 NewPrecomp); static void Project_ShapeLayer_New(project_data *File, project_state *State, memory *Memory); static void Project_PaintLayer_New(project_data *File, project_state *State, memory *Memory); void Source_UICreateButton(project_data *File, project_state *State, memory *Memory); void Precomp_UIDuplicate(project_data *File, project_state *State, memory *Memory, uint16 CompIndex, sorted_comp_array SortedCompStart, sorted_layer_array *SortedLayerStart); void Precomp_UIDelete(project_data *File, project_state *State, memory *Memory, uint16 CompIndex, sorted_comp_array SortedCompStart, sorted_layer_array *SortedLayerStart); void Precomp_UICreateButton(project_data *File, project_state *State, memory *Memory, uint16 CompIndex, sorted_comp_array SortedCompStart, sorted_layer_array *SortedLayerStart); // TODO(fox);: Make separate full-size bitmap that gets scaled on the GPU instead of this static void State_BindBrushTexture(memory *Memory, brush_state *Brush, uint32 BytesPerPixel); static void Brush_CalcBitmapAlphaFromSize(memory *Memory, brush_state *Brush, uint32 BytesPerPixel); // Imported bitmaps are stored in linear, and all ops are also done in linear. static void Bitmap_SRGBToLinear(void *Buffer, uint16 Width, uint16 Height, uint16 BytesPerPixel, bool32 ToLinear); static void Brush_Info(brush_info *B, brush_state *Brush, block_source *Source, void *SourceBuffer, v2 LayerPos, v4 Color); void Bitmap_SwapData(uint8 *Address_0, uint8 *Address_1, uint64 Size, uint16 BytesPerPixel); static void PaintTest(brush_info B, void *CacheBuffer, rectangle RenderRegion); static void RenderQueue_AddBrush(project_state *State, v2 LayerPos); static void RenderQueue_AddBlit(project_state *State); static void Effect_GaussianBlur(real32 *Data, int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, uint16 ShaderProgram); static void Effect_Curves_Init(block_effect *Effect, property_channel *Property); static void Effect_Levels(real32 *Data, int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, uint16 ShaderProgram); static void Effect_Curves(real32 *Data, int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, uint16 ShaderProgram); static void Effect_EndEntry(project_state *State); static void Effect_AddProperty_Real(project_state *State, char *Name, real32 DefaultValue, real32 MinVal = -999999, real32 MaxVal = 999999, property_display_type DisplayType = property_display_type_standard); static void Effect_AddProperty_Col(project_state *State, char *Name, v4 DefaultValue); static void Effect_AddProperty_Blendmode(project_state *State, char *Name, blend_mode DefaultValue); static header_effect* Effect_EntryFromID(project_state *State, char *ID); static void Effect_InitEntries(project_state *State); void Effect_GL_DrawColor(int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, uint16 ShaderProgram, v4 Color); void Effect_GL_GaussianBlur(int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, uint16 ShaderProgram, real32 Radius); void Effect_GL_Levels(int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, uint16 ShaderProgram, real32 Min, real32 Mid, real32 Max, v4 ColMin, v4 ColMid, v4 ColMax); static void CurvesSolver(real32 *LUT, v2 Point_P1, v2 Point_P2, v2 m1, v2 m2, int i); static void Effect_Software_Curves(int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, v2 *PointData, real32 PointCount, v4 PointCount_Col); bool32 AV_TryFrame(av_info *AV, AVCodecContext *CodecContext, int32 *err, bool32 *EndOfFile, int StreamIndex = -1); // Widgets not involving drawing UI. static v2 ImGui_ScreenPointToCompUV(ImVec2 ViewportMin, ImVec2 CompPos, ImVec2 CompZoom, ImVec2 MousePos); static void ImGui_WarpMouseFinish(project_state *State, ImVec2 MousePos); static ImVec2 ImGui_Brush_CalcMousePos(project_state *State, ImGuiIO &io, ImVec2 MouseDelta, int32 i, real32 DeltaDistance, real32 DeltaSlope); static bool32 ImGui_TestBoxSelection_Point(ImVec2 Pos, ImGuiIO &io, bool32 *Test); static void Layer_TestBoxSelect(memory *Memory, project_state *State, ui *UI, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, uint16 PrincipalIndex, layer_transforms ExtraT, v2 MinPos, v2 MaxPos); static void Sort_OffsetDupes(memory *Memory, sorted_layer_array *SortedLayerStart, block_layer *StartLayer, sorted_layer_array *StartSortEntry, int i, int FauxIncrement, int LayerCount, int Mode); void AV_IsFileSupported(char *filename, bool32 *IsVideo, bool32 *HasAudio); void AV_Dealloc(av_info *AV); void AV_InitStream(av_stream_info *Stream); // The duration isn't always reported in AVStream, but seeking towards the end // and advancing until we hit EOF seems to be accurate. void AV_GetDuration(av_info *AV, av_stream_info *Stream, uint64 *Duration, real32 *SecondCount); void AV_Init(block_source *Source, av_info *AV, memory *Memory); uint32 AV_AudioTest(av_info *AV, void *Data, uint32 Size, real32 FPS, int32 InitialFrameToSeek); void AV_SeekAudio(av_info *AV, real32 FPS, int32 FrameToSeek); void AV_LoadVideoFrame(memory *Memory, block_source *Source, av_info *AV, int32 FrameToSeek, void *Buffer); void GL_GenAndBindTexture(GLuint *GLTexture, int Width, int Height, int BytesPerPixel, void *BufferAddress); static void GL_BindDefaultVertexArrays(); void GL_InitHWBuffer(gl_effect_layer *Test); void GL_DeleteHWBuffer(gl_effect_layer *Test); void GL_UpdateTexture(gl_effect_layer *Test, void *Data, uint16 Width, uint16 Height, uint16 BytesPerPixel, bool32 Multisample); static uint16 Effect_GL_InitShader(const char *FragmentShaderEffectSource); static void ImGui_WarpMouse(project_state *State, ImVec2 MousePos, ImVec2 Min, ImVec2 Max, int Direction = 3); static bool32 ImGui_TestBoxSelection_Point(ImVec2 Pos, ImGuiIO &io, bool32 *Test); static void ImGui_ColorPanel(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io); static void ImGui_KeybindUI(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io); static void ImGui_Popups(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io); static void ImGui_ProcessInputs(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, sorted_file Sorted); static void ImGui_Menu(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io); static void ImGui_EffectsPanel(project_data *File, project_state *State, memory *Memory, ui *UI, ImGuiIO io); static void ImGui_DebugRenderQueue(project_state *State); static void ImGui_DebugUndoTree(memory *Memory, project_state *State); static void ImGui_Properties_Slider(project_state *State, memory *Memory, property_channel *Property, ImGuiIO &io, ImVec2 WindowMinAbs, ImVec2 WindowMaxAbs, memory_table_list Table); static void ImGui_Properties_CurvesUI(project_state *State, memory *Memory, ImGuiIO io, block_effect *Effect, property_channel *PropertyStart, uint16 *SortedPointStart); static void ImGui_SD_Prompt(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray); static void ImGui_Timeline_HorizontalIncrementDraw(project_state *State, ui *UI, ImDrawList *draw_list, ImVec2 TimelineSizeWithBorder, ImVec2 TimelineAbsolutePos, block_composition MainComp, ImVec2 TimelineZoomSize, ImVec2 TimelineMoveSize); static void ImGui_Timeline(project_data *File, project_state *State, memory *Memory, ui *UI, ImGuiIO io, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray); static void ImGui_Viewport_ShapeUI(project_state *State, memory *Memory, ui *UI, ImGuiIO &io, block_layer *Layer, int Width, int Height, shape_layer *Shape, block_composition *MainComp, ImDrawList *draw_list); static void ImGui_Viewport_BrushUI(project_state *State, memory *Memory, ImVec2 ViewportMin, ImVec2 ViewportMax, ImVec2 CompZoom, ImGuiIO io, uint16 Width, uint16 Height); static void ImGui_Viewport_TransformUI(project_data *File, project_state *State, memory *Memory, ui *UI, ImGuiIO &io, ImDrawList *draw_list, interact_transform *Interact, ImVec2 ViewportMin, uint32 CompWidth, uint32 CompHeight, uint16 *SortedKeyframeArray); static void ImGui_Viewport_SelectedLayerUI(project_state *State, memory *Memory, ui *UI, ImGuiIO &io, ImDrawList *draw_list, block_composition *MainComp, uint32 CompIndex, block_layer *ParentLayer[4], uint32 Recursions, v2 *Min, v2 *Max, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray); static void ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, GLuint textureID, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray); static void IO_ReadFromStream(void *Address, uint64 SizeToRead, SDL_RWops *File); // lots of cleanup... static void Layer_Delete(project_data *File, project_state *State, memory *Memory, uint32 Index); static int Layer_GetTopOffset(project_data *File, memory *Memory); static void Layer_ToggleChannel(project_data *File, memory *Memory, int32 a); static void Layer_Select(memory *Memory, project_state *State, int32 i); static void Layer_Select_RecurseUp(memory *Memory, project_state *State, int32 i, int16 RecursionIdx[MAX_PRECOMP_RECURSIONS], uint32 Recursions); static void Layer_Select_Traverse(uint16 PrincipalCompIndex, memory *Memory, project_state *State, int32 IndexToFind, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, int16 RecursionIdx[MAX_PRECOMP_RECURSIONS], int32 *Recursions); static void Layer_GetDimensions(memory *Memory, block_layer *Layer, int *Width, int *Height); static v2 Layer_TraverseForPoint(project_data *File, project_state *State, memory *Memory, v2 PrincipalCompUV, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, uint16 LayerIndex); static bool32 Shape_TestBoxSelect(v2 Min, v2 Max, bezier_point *BezierPointData, uint32 BezierCount); static int32 LayerIterate_TestSelection(project_state *State, memory *Memory, uint32 PrincipalIndex, layer_transforms ExtraT, v2 Center, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, bool32 BelowOnly); static bool32 Transform_TestBox(block_layer *Layer, uint32 Width, uint32 Height, v2 Min, v2 Max); static void Layer_RecursiveDeselect(memory *Memory, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, uint16 TargetIndex, uint16 PrincipalIndex); static bool32 Main_InputTest(project_data *File, project_state *State, memory *Memory, sorted_file Sorted, ui *UI, SDL_Window *window, GLuint textureID); static void Render_Main(project_data *File, project_state *State, memory *Memory, sorted_file Sorted, ui *UI, SDL_Window *window, GLuint textureID, void *Data, void *OutputBuffer, render_type RenderType, rectangle RenderRegion); static void Layer_UpdateAllKeyframes(project_data *File, project_state *State, memory *Memory, block_layer *Layer, uint16 Index_Physical, sorted_property_array *SortedProperty, uint16 *SortedKeyframe, uint16 Frame_Current); static av_info * AV_Retrieve(project_state *State, memory *Memory, uint32 SourceIndex); struct gl_data; struct gl_viewport_data; static void GL_Test(const ImDrawList* parent_list, const ImDrawCmd* cmd); static void Render_Paint(project_data *File, project_state *State, memory *Memory, sorted_file Sorted, ui *UI, SDL_Window *window, GLuint textureID, ImGuiIO io, v2 LayerPos); static void Render_Blit(project_data *File, project_state *State, memory *Memory, sorted_file Sorted, ui *UI, SDL_Window *window, GLuint textureID, ImGuiIO io, v2 LayerPos); static void Main_Renderer(project_data *File, project_state *State, memory *Memory, sorted_file Sorted, ui *UI, SDL_Window *window, GLuint textureID, ImGuiIO io); static uint32 Memory_Block_AllocateNew(memory *Memory, memory_table_list TableName); static void * Memory_Block_AddressAtIndex(memory *Memory, memory_table_list TableName, uint32 Index, bool32 AssertExists = 1); static uint16 Memory_Block_LazyIndexAtAddress(memory *Memory, memory_table_list TableName, void *Address); static void * Memory_Block_AllocateAddress(memory *Memory, memory_table_list TableName); // IMPORTANT(fox);: All block data structs have to start with a uint8 Occupied variable! static bool32 Block_Loop(memory *Memory, memory_table_list TableName, uint32 TotalCount, int *HasIncremented, int *CurrentCount, int *Index); static bool32 Block_Loop(memory *Memory, property_channel *Property, uint32 TotalCount, int *HasIncremented, int *CurrentCount, int *Index); static uint32 Memory_Block_PrincipalBitmap_AllocateNew(project_data *File, project_state *State, memory *Memory); static uint32 Memory_Block_Bitmap_AllocateNew(project_state *State, memory *Memory, cache_entry Entry, uint64 NewSize); static void Memory_Cache_Purge(project_data *File, project_state *State, memory *Memory, int32 SingleFrame = -1); static cache_entry * Memory_Cache_Search(project_state *State, memory *Memory, cache_entry_type Type, uint32 TypeInfo, uint32 TypeInfo_Sub); static void * Memory_Block_Bitmap_AddressAtIndex(memory *Memory, uint32 Index); static void * Memory_AddressAtOffset(memory *Memory, memory_table_list TableName, uint64 Offset); void Memory_Copy(uint8 *Address_Write, uint8 *Address_Read, uint64 Size); void Memory_Fill(uint8 *Address_Write, uint8 *Address_Read, uint64 WriteSize, uint64 ReadSize); void Arbitrary_Zero(uint8 *Address_Write, uint64 Size); void Arbitrary_SwapData(memory *Memory, uint8 *Address_0, uint8 *Address_1, uint64 Size); static void * Memory_PushScratch(memory *Memory, uint64 Size); static void Memory_PopScratch(memory *Memory, uint64 Size); static void Arbitrary_ShiftData(uint8 *Address_Start, uint8 *Address_End, uint64 ShiftAmount, int32 Direction); static uint64 Data_Compress(memory *Memory, void *DataSource, uint64 DataSize, void *DataBuffer, uint64 DataBufferSize, int CompressionLevel); static void Data_Decompress(memory *Memory, void *CompressedLocation, uint64 CompressedSize, void *BitmapLocation, uint64 ExpectedSize); static uint32 NVG_FlattenPath(memory *Memory, shape_layer *Shape, shape_options ShapeOpt, nvg_point *PointData, project_state *State, layer_transforms T, int Width, int Height, int CompWidth, int CompHeight, bool32 Interact, v2 *Min, v2 *Max, bool32 IsConcave); static real32 * NVG_Point(real32 *StrokeData, real32 x, real32 y, real32 u, real32 v); static void NVG_ChooseBevel(int bevel, nvg_point *p0, nvg_point *p1, float w, float* x0, float* y0, float* x1, float* y1); static real32 * NVG_RoundCap(nvg_point * Point, real32 *StrokeData, float dx, float dy, float w, int ncap, float u0, float u1, int Mode); static real32 * NVG_ButtCap(nvg_point *Point, real32 *StrokeData, float dx, float dy, float w, float d, float u0, float u1, int Mode); static void NVG_ExpandFill(void *Memory, int NumberOfVerts, nvg_point *PointData, real32 *FillData); static v2 T_CompUVToLayerUV(layer_transforms T, uint32 FileWidth, uint32 FileHeight, uint32 SourceWidth, uint32 SourceHeight, v2 CompUV); static v2 T_CompPosToLayerPos(layer_transforms T, uint32 FileWidth, uint32 FileHeight, uint32 SourceWidth, uint32 SourceHeight, real32 X, real32 Y); static layer_transforms Transform_TestInteracts(project_state *State, block_layer *Layer, sorted_layer_array SortEntry, layer_transforms T); static layer_transforms Transform_Add(layer_transforms T, layer_transforms ExtraT, real32 Width, real32 Height); static uint8 * Render_UI(project_data *File, project_state *State, memory *Memory, ui *UI, ImDrawList *draw_list, uint8 *PointBuffer, gl_viewport_data *RenderData, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, layer_transforms ExtraT, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray, uint32 CompIndex, int32 Frame_Current); static v2 Transform_ScreenSpaceToLocal(layer_transforms T, uint32 FileWidth, uint32 FileHeight, uint32 SourceWidth, uint32 SourceHeight, ImVec2 CompPos, ImVec2 CompZoom, ImVec2 ViewportMin, ImVec2 Point); // Transform given data based on state's Interact data. static void Transform_ApplyInteractive(interact_transform Interact, real32 *OutputX, real32 *OutputY, real32 *OutputRotation, real32 *OutputScale); static void LayerIterate(project_state *State, memory *Memory, uint32 CompIndex, layer_transforms ExtraT, v2 Center, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray); static void Transform_IterateOuterBounds(block_layer *Layer, uint32 Width, uint32 Height, real32 *MinX, real32 *MinY, real32 *MaxX, real32 *MaxY); static void Transform_Recurse(project_state *State, memory *Memory, block_composition *MainComp, uint32 CompIndex, block_layer *ParentLayer[4], uint32 Recursions, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, real32 *MinX, real32 *MinY, real32 *MaxX, real32 *MaxY); inline void ImGui_DrawCenteredRect(ImDrawList *draw_list, ImVec2 Point, real32 Width, uint32 col); static bool32 Layer_TestForPoint(memory *Memory, project_state *State, ui *UI, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, uint16 CompIndex, v2 CompPos, layer_transforms ExtraT); static v2 TransformPoint(layer_transforms T, real32 Width, real32 Height, v2 Point); static layer_transforms Transform_Inverse(layer_transforms T); static ImVec2 Layer_LocalToScreenSpace(project_state *State, memory *Memory, block_layer *Layer, ui *UI, uint32 PrincipalCompIndex, v2 Point); static void Renderer_Start(void *Data, void *OutputBuffer, render_type RenderType, rectangle RenderRegion); static void Renderer_Check(bool32 *Test, render_type RenderType); static void Fallback_RenderLayer(transform_info T, void *OutputBuffer, rectangle RenderRegion); inline uint16 * Property_GetSortedArray(uint16 *SortedKeyframeArray, int i, int h); static sorted_layer_array * Sorted_GetLayerStart(sorted_layer_array *LayerArrayStart, sorted_comp_array *SortedCompStart, uint32 TargetComp); static void Layer_Sort_CheckPrev(memory *Memory, int i, int Direction, sorted_layer_array *SortedLayerStart, sorted_comp_array SortedCompStart, int *EntriesPassed, sorted_layer_array *LayerEntry, bool32 AltMethod); void LayerProperty_SortAll(project_data *File, project_state *State, memory *Memory, sorted_layer_array *LayerArrayStart, sorted_comp_array *CompStart, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray, uint32 CompCount); static void TempSource_SortAll(project_data *File, project_state *State, memory *Memory, uint16 *SourceArrayStart, uint16 *TempSourceCount); static sorted_file File_Sort_Push(project_data *File, project_state *State, memory *Memory); static void File_Sort_Pop(memory *Memory, uint64 Layer_SortSize, uint64 Property_SortSize, uint64 Source_SortSize); #if STABLE struct curl_data; static size_t dumbcurlcallback(void *data, size_t size, size_t nmemb, void *userp); static void SD_JSONToSource(project_data *File, project_state *State, memory *Memory, void *JSONResponse, int Height, int Width); static void SD_ParseProgress(project_state *State, char *JSONInfo); static void SD_AssembleJSON(sd_state *SD, char *JSONPayload, void *Base64Bitmap = NULL); struct curl_state; static void Curl_Free(curl_state *Handle); static void Curl_StopAll(project_state *State, curl_state *ProgHandle, curl_state *MainHandle); static int Curl_Check(curl_state *Handle); static void Curl_Prog_Init(curl_state *C, void *OutputData); static void Curl_Main(project_data *File, project_state *State, memory *Memory, curl_state *MainHandle, curl_state *ProgHandle); #endif static void CopyStrings(void *Dest, void *Data); static uint16 String_AddToFile(memory *Memory, char *Char, bool32 NoUndo = 1); static bool32 String_Compare(char *String1, char *String2, uint32 Length); static uint32 String_Length(char *Char); static void String_Copy(char *String1, char *String2, uint32 Length); static void String_Append(char *String1, char *String2, uint32 Length); static void String_PathToLayerName(char *Path, char *Dest); static int TestThread(void *ptr); static bool32 Threading_IsActive(render_type RenderType); static void Threading_BitmapOp(void *Data, void *OutputBuffer, render_type RenderType, rectangle InitialRenderRegion); static uint64 History_GetActionSize(history_entry_list *History, int i); void History_Entry_Commit(memory *Memory, char *Name); void History_Entry_End(memory *Memory); static void History_Action_Shift(memory *Memory, memory_table_list TableName, void *Address0, void *Address1, uint64 Amount, int16 Direction); static void History_Action_Block_Swap(memory *Memory, memory_table_list TableName, void *Address_Data); static void History_Action_Swap(memory *Memory, memory_table_list TableName, uint64 Size, void *Address_Data);