From 6298837d4b5fbff561e3d7e6a3361bd64e432960 Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Fri, 20 Jan 2023 23:24:37 -0500 Subject: box selection working --- src/createcalls.cpp | 8 +++ src/imgui_ui_timeline.cpp | 2 +- src/imgui_ui_viewport.cpp | 92 +++++++++++++++------------ src/include/all.h | 10 +++ src/include/main.h | 3 + src/include/my_math.h | 2 +- src/layer.cpp | 154 ++++++++++++++++++++++++++-------------------- 7 files changed, 163 insertions(+), 108 deletions(-) diff --git a/src/createcalls.cpp b/src/createcalls.cpp index 2a344a0..800dd49 100644 --- a/src/createcalls.cpp +++ b/src/createcalls.cpp @@ -636,6 +636,14 @@ Project_Layer_Duplicate(project_data *File, project_state *State, memory *Memory History_Action_Block_Swap(Memory, F_Layers, NewLayer); *NewLayer = *Layer; NewLayer->IsSelected = true; + NewLayer->Vertical_Offset--; + + for (int a = i+2; a < LayerCount; a++) { + sorted_layer_array NextSortEntry = SortedLayerStart[a]; + uint32 NextIndex_Physical = NextSortEntry.Block_Layer_Index; + block_layer *NextLayer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, NextIndex_Physical); + NextLayer->Vertical_Offset--; + } Assert(!NewLayer->x.Keyframe_Count); Assert(!NewLayer->y.Keyframe_Count); diff --git a/src/imgui_ui_timeline.cpp b/src/imgui_ui_timeline.cpp index c8ebcc4..a85d58e 100644 --- a/src/imgui_ui_timeline.cpp +++ b/src/imgui_ui_timeline.cpp @@ -326,7 +326,7 @@ ImGui_Timeline_DrawGraph(project_data *File, project_state *State, memory *Memor Bezier_Interact_Evaluate(State, PointAddress[Idx], PointPos, GraphZoomHeight, Y_Increment); PointPos[0].x += Frame_Offset; - ImVec2 Keyframe_LocalPos[3] = { ImVec2_(PointPos[0]), ImVec2_(PointPos[0] + PointPos[1]), ImVec2_(PointPos[0] + PointPos[2]) }; + ImVec2 Keyframe_LocalPos[3] = { IV2(PointPos[0]), IV2(PointPos[0] + PointPos[1]), IV2(PointPos[0] + PointPos[2]) }; ImVec2 Keyframe_LocalPos_Ratio[3]; for (int b = 0; b < 3; b++) { diff --git a/src/imgui_ui_viewport.cpp b/src/imgui_ui_viewport.cpp index eb48159..f3e124e 100644 --- a/src/imgui_ui_viewport.cpp +++ b/src/imgui_ui_viewport.cpp @@ -57,10 +57,10 @@ ImGui_Viewport_ShapeUI(project_state *State, memory *Memory, ui *UI, ImGuiIO &io } for (int i = 0; i < 3; i++) { - ImVec2 Point = (i == 0) ? ImVec2_(Point_0->Pos[0]) : ImVec2_(Point_0->Pos[0] + Point_0->Pos[i]); + ImVec2 Point = (i == 0) ? IV2(Point_0->Pos[0]) : IV2(Point_0->Pos[0] + Point_0->Pos[i]); if (Layer != NULL) { layer_transforms T = Layer_GetTransforms(Layer); - Point = ImVec2_(TransformPoint(T, Width, Height, *(v2 *)&Point)); + Point = IV2(TransformPoint(T, Width, Height, *(v2 *)&Point)); } if (State->Interact_Active == interact_type_keyframe_move && Point_0->IsSelected) { Point.x += State->Interact_Offset[0]; @@ -70,10 +70,10 @@ ImGui_Viewport_ShapeUI(project_state *State, memory *Memory, ui *UI, ImGuiIO &io ScreenPoint_0[i] = UI->CompPos + Point_Ratio * UI->CompZoom; } for (int i = 0; i < 3; i++) { - ImVec2 Point = (i == 0) ? ImVec2_(Point_1->Pos[0]) : ImVec2_(Point_1->Pos[0] + Point_1->Pos[i]); + ImVec2 Point = (i == 0) ? IV2(Point_1->Pos[0]) : IV2(Point_1->Pos[0] + Point_1->Pos[i]); if (Layer != NULL) { layer_transforms T = Layer_GetTransforms(Layer); - Point = ImVec2_(TransformPoint(T, Width, Height, *(v2 *)&Point)); + Point = IV2(TransformPoint(T, Width, Height, *(v2 *)&Point)); } if (State->Interact_Active == interact_type_keyframe_move && Point_1->IsSelected) { Point.x += State->Interact_Offset[0]; @@ -516,8 +516,7 @@ ImGui_Viewport_SelectedLayerUI(project_state *State, memory *Memory, ui *UI, ImG ParentLayer[Recursions] = Layer; ImGui_Viewport_SelectedLayerUI(State, Memory, UI, io, draw_list, MainComp, Layer->Block_Source_Index, ParentLayer, Recursions + 1, SortedCompArray, SortedLayerArray); } - // if (Layer->IsSelected) { - if (1) { + if (Layer->IsSelected) { uint32 Width = 0, Height = 0; void *Data; uint32 NumberOfVerts; @@ -556,7 +555,7 @@ ImGui_Viewport_SelectedLayerUI(project_state *State, memory *Memory, ui *UI, ImG T.y += State->Interact_Offset[1]; } - if (Layer->IsShapeLayer) { + if (Layer->IsShapeLayer && State->Tool == tool_default_pointmove && State->Interact_Active == interact_type_none ) { ImGui_Viewport_ShapeUI(State, Memory, UI, io, Layer, Width, Height, &Layer->Shape, MainComp, draw_list); // point visualization @@ -691,7 +690,7 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, // UI+interaction for layer - // if (State->MostRecentlySelectedLayer > -1) + if (State->MostRecentlySelectedLayer > -1) { block_layer *ParentLayer[4]; ImGui_Viewport_SelectedLayerUI(State, Memory, UI, io, draw_list, MainComp, File->PrincipalCompIndex, ParentLayer, 0, SortedCompArray, SortedLayerArray); @@ -719,6 +718,8 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, bool32 IsDeactivated = ImGui::IsKeyReleased(ImGuiKey_3); #endif + // TODO(fox): Tidy up once all work is done + if (IsHovered && IsActivated && !ImGui::IsMouseDown(ImGuiMouseButton_Right)) { State->LastClickedPoint = ImGui_ScreenPointToCompUV(ViewportMin, UI->CompPos, UI->CompZoom, io.MousePos); @@ -746,43 +747,59 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, State->HotkeyInput = hotkey_newlayer_paint; } } - // Layer selection - if (State->Tool == tool_default && State->Interact_Active == interact_type_none) { - if (io.KeyAlt) { - } else { - int32 Selection = Layer_TestSelection(Memory, State, UI, SortedCompArray, SortedLayerArray, File->PrincipalCompIndex); - if (!io.KeyShift && State->Interact_Active == interact_type_none) - Layer_DeselectAll(File, State, Memory); - if (Selection != -1) - Layer_Select(Memory, State, Selection); - } - } } } - if (IsActive && !ImGui::IsMouseDown(ImGuiMouseButton_Right) && !io.KeyCtrl && !io.KeyAlt) + bool32 OtherActions = ImGui::IsKeyDown(ImGuiKey_Z) || ImGui::IsMouseDown(ImGuiMouseButton_Right); + + if (IsActive && !OtherActions && !io.KeyCtrl && !io.KeyAlt) { - v2 CompUV = State->LastClickedPoint; - ImVec2 ScreenPointStart = ImVec2(UI->CompPos.x + CompUV.x * UI->CompZoom.x, - UI->CompPos.y + CompUV.y * UI->CompZoom.y); - uint32 fcol = IM_COL32(00, 00, 255, 50); - uint32 wcol = IM_COL32(128, 128, 255, 255); - ImVec2 Vector = io.MousePos - ScreenPointStart; + ImVec2 ClickedPos = io.MouseClickedPos[0]; ImVec2 MousePos = io.MousePos; - if (State->Tool == tool_default && State->Interact_Active == interact_type_none) { - draw_list->AddRectFilled(ScreenPointStart, MousePos, fcol, 2.0f); - draw_list->AddRect(ScreenPointStart, MousePos, wcol, 2.0f); - } - if (io.MouseDelta.x || io.MouseDelta.y) { - Layer_DeselectAll(File, State, Memory); - v2 LocalMaxUV = ImGui_ScreenPointToCompUV(ViewportMin, UI->CompPos, UI->CompZoom, MousePos); - v2 LocalMinPos = State->LastClickedPoint * V2(MainComp->Width, MainComp->Height); - v2 LocalMaxPos = LocalMaxUV * V2(MainComp->Width, MainComp->Height); - Layer_TestBoxSelect(Memory, State, UI, SortedCompArray, SortedLayerArray, File->PrincipalCompIndex, - LocalMinPos, LocalMaxPos); + ImVec2 BoxMin = {}, BoxMax = {}; + BoxMin.x = (MousePos.x < ClickedPos.x) ? MousePos.x : ClickedPos.x; + BoxMin.y = (MousePos.y < ClickedPos.y) ? MousePos.y : ClickedPos.y; + BoxMax.x = (MousePos.x > ClickedPos.x) ? MousePos.x : ClickedPos.x; + BoxMax.y = (MousePos.y > ClickedPos.y) ? MousePos.y : ClickedPos.y; + if (BoxMax.x - BoxMin.x > 2.0f && BoxMax.y - BoxMin.y > 2.0f) { + Assert(BoxMax.x > BoxMin.x && + BoxMax.y > BoxMin.y) + BoxMax.y = (MousePos.y > ClickedPos.y) ? MousePos.y : ClickedPos.y; + if (io.MouseDelta.x || io.MouseDelta.y) { + if (State->Tool == tool_default && State->Interact_Active == interact_type_none) + State->Interact_Active = interact_type_viewport_selection; + if (State->Interact_Active == interact_type_viewport_selection) { + Layer_DeselectAll(File, State, Memory); + v2 MinPos_Comp = ImGui_ScreenPointToCompUV(ViewportMin, UI->CompPos, UI->CompZoom, BoxMin) * V2(MainComp->Width, MainComp->Height); + v2 MaxPos_Comp = ImGui_ScreenPointToCompUV(ViewportMax, UI->CompPos, UI->CompZoom, BoxMax) * V2(MainComp->Width, MainComp->Height); + Layer_TestBoxSelect(Memory, State, UI, SortedCompArray, SortedLayerArray, File->PrincipalCompIndex, MinPos_Comp, MaxPos_Comp); + } + } + if (State->Interact_Active == interact_type_viewport_selection) { + uint32 fcol = IM_COL32(00, 00, 255, 50); + uint32 wcol = IM_COL32(128, 128, 255, 255); + draw_list->AddRectFilled(BoxMin, BoxMax, fcol, 2.0f); + draw_list->AddRect(BoxMin, BoxMax, wcol, 2.0f); + } } } + if (IsHovered && IsDeactivated && !io.KeyCtrl && !io.KeyAlt && !ImGui::IsMouseDown(ImGuiMouseButton_Right && !ImGui::IsKeyDown(ImGuiKey_Z))) + { + // Layer selection + if (State->Tool == tool_default && State->Interact_Active == interact_type_none) { + int32 Selection = Layer_TestSelection(Memory, State, UI, SortedCompArray, SortedLayerArray, File->PrincipalCompIndex); + if (!io.KeyShift && State->Interact_Active == interact_type_none) + Layer_DeselectAll(File, State, Memory); + if (Selection != -1) + Layer_Select(Memory, State, Selection); + } + } + + if (IsDeactivated && State->Interact_Active == interact_type_viewport_selection) { + State->Interact_Active = interact_type_none; + } + /* if (State->Interact_Active == interact_type_viewport_transform) { interact_transform *Interact = (interact_transform *)&State->Interact_Offset[0]; @@ -800,7 +817,6 @@ ImGui_Viewport(project_data *File, project_state *State, ui *UI, memory *Memory, } - bool32 OtherActions = ImGui::IsKeyDown(ImGuiKey_Z) || ImGui::IsMouseDown(ImGuiMouseButton_Right); if (State->Tool == tool_brush && State->Interact_Active == interact_type_brush) { Assert(State->Brush.LayerToPaint_Index != -1); if (IsActive && !OtherActions) { diff --git a/src/include/all.h b/src/include/all.h index 8bafd30..a0368d8 100644 --- a/src/include/all.h +++ b/src/include/all.h @@ -444,6 +444,11 @@ 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); @@ -454,6 +459,11 @@ Data_Compress(memory *Memory, void *DataSource, uint64 DataSize, void *DataBuffe static void Data_Decompress(memory *Memory, void *CompressedLocation, uint64 CompressedSize, void *BitmapLocation, uint64 ExpectedSize); +static uint32 +NVG_FlattenPath(memory *Memory, shape_layer *Shape, nvg_point *PointData, + project_state *State, layer_transforms T, int Width, int Height, + int CompWidth, int CompHeight, bool32 Interact, v2 *Min, v2 *Max); + static real32 * NVG_Point(real32 *StrokeData, real32 x, real32 y, real32 u, real32 v); diff --git a/src/include/main.h b/src/include/main.h index 6c9caca..3129c5d 100644 --- a/src/include/main.h +++ b/src/include/main.h @@ -299,6 +299,7 @@ enum interact_type interact_type_slider_scrub, interact_type_layer_move, interact_type_layer_timeadjust, + interact_type_viewport_selection, interact_type_viewport_transform, interact_type_viewport_duplicate, interact_type_viewport_slide, @@ -310,6 +311,7 @@ enum interact_type char *ToolName[] { "Move", + "Point move", "Crop", "Brush", "Slide", @@ -319,6 +321,7 @@ char *ToolName[] { enum tool { tool_default, + tool_default_pointmove, tool_crop, tool_brush, tool_slide, diff --git a/src/include/my_math.h b/src/include/my_math.h index 2a54f4d..938ed3c 100644 --- a/src/include/my_math.h +++ b/src/include/my_math.h @@ -67,7 +67,7 @@ inline v2 V2(ImVec2 A) return(Result); } -inline ImVec2 ImVec2_(v2 f) { +inline ImVec2 IV2(v2 f) { return { f.x, f.y }; } diff --git a/src/layer.cpp b/src/layer.cpp index 8bf6bef..d21ab0e 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -421,75 +421,35 @@ Layer_TestSelection(memory *Memory, project_state *State, ui *UI, sorted_comp_ar return LayerIndex; } -static bool32 -Shape_TestBoxSelect(v2 Min, v2 Max, bezier_point *BezierPointData, uint32 BezierCount) -{ - v2 StartMin = V2(1000, 1000); - v2 StartMax = V2(-1000, -1000); - v2 ClosestPoint[4] = { StartMin, StartMax, V2(StartMin.x, StartMax.y), V2(StartMax.y, StartMin.x) }; - - for (int i = 0; i < BezierCount; i++) { - bezier_point *Point = &BezierPointData[i]; - if (i == 0 || Point->Type == interpolation_type_linear) { - if ((Point->Pos[0].x > Min.x) && (Point->Pos[0].x < Max.x) && - (Point->Pos[0].x > Min.y) && (Point->Pos[0].x < Max.y)) - Assert(0); - } else if (Point->Type == interpolation_type_bezier) { - Assert(0); - /* - bezier_point *Point_1 = &BezierPointData[i-1]; - v2 Pos[2] = { Point_1->Pos[0], Point->Pos[0] }; - PointPlayhead = (nvg_point *)Bezier_CubicCalcPoints(Pos[0], Pos[0] + Point_1->Pos[1], Pos[1] + Point->Pos[2], Pos[1], PointPlayhead, sizeof(nvg_point)); - */ - } else { - Assert(0); - } - } - return false; -} - -// v2 Bezier_LineClose - -// stPoint(v2 a, v2 b, v2 p); - - -// char get_line_intersection(float p0_x, float p0_y, float p1_x, float p1_y, -// float p2_x, float p2_y, float p3_x, float p3_y, float *i_x, float *i_y) -#if 0 -char T_TestLine(v2 Point[4]) +// TODO(fox): learn this; stop stealing from stackoverflow +bool32 Line_TestIntersect(real32 p0_x, real32 p0_y, real32 p1_x, real32 p1_y, + real32 p2_x, real32 p2_y, real32 p3_x, real32 p3_y) { - /* - float s1_x, s1_y, s2_x, s2_y; + real32 s1_x, s1_y, s2_x, s2_y; s1_x = p1_x - p0_x; s1_y = p1_y - p0_y; s2_x = p3_x - p2_x; s2_y = p3_y - p2_y; - */ - v2 Vector0 = Point[1] - Point[0]; - v2 Vector1 = Point[3] - Point[2]; + real32 b = (-s2_x * s1_y + s1_x * s2_y); + if (b == 0) + return 0; - Vector1 * (Point[0] - Point[2]) / - Side0 = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) + real32 s, t; + s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / b; + t = ( s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / b; - float s, t; - s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / (-s2_x * s1_y + s1_x * s2_y); - t = ( s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / (-s2_x * s1_y + s1_x * s2_y); + if (s >= 0 && s <= 1) { + int a = 0; + } if (s >= 0 && s <= 1 && t >= 0 && t <= 1) { - // Collision detected - if (i_x != NULL) - *i_x = p0_x + (t * s1_x); - if (i_y != NULL) - *i_y = p0_y + (t * s1_y); return 1; } - return 0; // No collision } -#endif static bool32 Transform_TestBox(block_layer *Layer, uint32 Width, uint32 Height, v2 Min, v2 Max) @@ -519,18 +479,77 @@ Transform_TestBox(block_layer *Layer, uint32 Width, uint32 Height, v2 Min, v2 Ma v2 *P1 = &Point[3]; v2 *P2 = &Point[0]; for (int i = 0; i < 4; i++) { - // v2 ClosestLayer = Bezier_LineClosestPoint(*P1, *P2, *P1_B); - // v2 ClosestBox = Bezier_LineClosestPoint(*P1_B, *P2_B, *P1); - // if (abs(ClosestLayer.x - ClosestBox.x) < 1.0f && - // abs(ClosestLayer.y - ClosestBox.y) < 1.0f) - // return true; - // P1 = P2++; + if (Line_TestIntersect(P1->x, P1->y, P2->x, P2->y, P1_B->x, P1_B->y, P2_B->x, P2_B->y)) + return true; + P1 = P2++; } P1_B = P2_B++; } return false; } +// TODO(fox): It would probably be faster to transform the box into layer space +// and test that way. Don't know how to do the UV test though. + +static bool32 +Shape_TestBoxSelect(layer_transforms T, uint32 CompWidth, uint32 CompHeight, uint32 ShapeWidth, uint32 ShapeHeight, v2 Box[4], + nvg_point *Point, uint16 PointCount) +{ + // v2 BoxLocal[4] = {}; + // for (int x = 0; x < 4; x++) { + // BoxLocal[x] = T_CompPosToLayerPos(T, CompWidth, CompHeight, ShapeHeight, ShapeWidth, Box[x].x, Box[x].y); + // } + Assert(Box[0].x < Box[2].x && Box[0].y < Box[2].y); +#if 1 + for (int i = 0; i < PointCount; i++) { + nvg_point *P0 = &Point[i]; + v2 Pos0 = TransformPoint(T, ShapeWidth, ShapeHeight, V2(P0->x, P0->y)); + if (Pos0.x > Box[0].x && Pos0.x < Box[2].x && + Pos0.y > Box[0].y && Pos0.y < Box[2].y) + return true; + P0->x = Pos0.x; + P0->y = Pos0.y; + } + nvg_point *P0 = &Point[PointCount-1]; + nvg_point *P1 = &Point[0]; + for (int i = 0; i < PointCount; i++) { + if (Line_TestIntersect(P0->x, P0->y, P1->x, P1->y, Box[0].x, Box[0].y, Box[1].x, Box[1].y)) + return true; + if (Line_TestIntersect(P0->x, P0->y, P1->x, P1->y, Box[1].x, Box[1].y, Box[2].x, Box[2].y)) + return true; + if (Line_TestIntersect(P0->x, P0->y, P1->x, P1->y, Box[2].x, Box[2].y, Box[3].x, Box[3].y)) + return true; + if (Line_TestIntersect(P0->x, P0->y, P1->x, P1->y, Box[3].x, Box[3].y, Box[0].x, Box[0].y)) + return true; + P0 = P1++; + } + return false; +#else + v2 *P0_B = &Box[3]; + v2 *P1_B = &Box[0]; + for (int x = 0; x < 4; x++) { + nvg_point *P0 = &Point[PointCount-1]; + v2 Pos0 = TransformPoint(T, ShapeWidth, ShapeHeight, V2(P0->x, P0->y)); + if (Pos0.x > Box[0].x && Pos0.x < Box[2].x && + Pos0.y > Box[0].y && Pos0.y < Box[2].y) + return true; + P0->x = Pos0.x; + P0->y = Pos0.y; + nvg_point *P1 = &Point[0]; + for (int i = 0; i < PointCount; i++) { + v2 Pos1 = TransformPoint(T, ShapeWidth, ShapeHeight, V2(P1->x, P1->y)); + if (Pos1.x > Box[0].x && Pos1.x < Box[2].x && + Pos1.y > Box[0].y && Pos1.y < Box[2].y) + return true; + if (Line_TestIntersect(P0->x, P0->y, P1->x, P1->y, P0_B->x, P0_B->y, P1_B->x, P1_B->y)) + return true; + P0 = P1++; + } + P0_B = P1_B++; + } + return false; +#endif +} static void Layer_TestBoxSelect(memory *Memory, project_state *State, ui *UI, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, @@ -547,17 +566,16 @@ Layer_TestBoxSelect(memory *Memory, project_state *State, ui *UI, sorted_comp_ar shape_layer *Shape = &Layer->Shape; int Width = Shape->Width, Height = Shape->Height; layer_transforms T = Layer_GetTransforms(Layer); - v2 MinUV = T_CompUVToLayerUV(T, Comp->Width, Comp->Height, Width, Height, MinPos); - v2 MaxUV = T_CompUVToLayerUV(T, Comp->Width, Comp->Height, Width, Height, MaxPos); - - bezier_point *BezierPointData = (bezier_point *)Memory_PushScratch(Memory, sizeof(bezier_point) * 128); - uint32 BezierCount = Bezier_Shape_Sort(Memory, Shape, BezierPointData, - State, T, Width, Height, - Comp->Width, Comp->Height, 0); - Shape_TestBoxSelect(MinPos, MaxPos, BezierPointData, BezierCount); + nvg_point *NVGPointData = (nvg_point *)Memory_PushScratch(Memory, sizeof(nvg_point) * 1024); + v2 ShapeMin = {}, ShapeMax = {}; + uint32 NumberOfVerts = NVG_FlattenPath(Memory, Shape, NVGPointData, + State, T, Shape->Width, Shape->Height, Comp->Width, Comp->Height, 1, &ShapeMin, &ShapeMax); + v2 Box[4] = { MinPos, V2(MinPos.x, MaxPos.y), MaxPos, V2(MaxPos.x, MinPos.y) }; + if (Shape_TestBoxSelect(T, Comp->Width, Comp->Height, Shape->Height, Shape->Width, Box, NVGPointData, NumberOfVerts)) + Layer->IsSelected = true; - Memory_PopScratch(Memory, sizeof(bezier_point) * 128); + Memory_PopScratch(Memory, sizeof(nvg_point) * 1024); } else { int Width, Height; Layer_GetDimensions(Memory, Layer, &Width, &Height); -- cgit v1.2.3