summaryrefslogtreecommitdiff
path: root/functions.h
blob: 6cecb76b85cf498f4b8f0f43bc613e96efd7a573 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

// Buffer management

static void * Layer_AllocateBitmap(memory *Memory, uint16 Width, uint16 Height, uint16 BytesPerPixel); //
static project_layer * Layer_Init(project_data *File, memory *Memory); // Initializes a layer's name and properties. Add a source manually.


static void Bitmap_CalcPackedDimensions(uint16 Width, uint16 Height, uint16 *WidthP, uint16 *HeightP); // Returns the dimensions a packed bitmap should be in memory.
static uint16 Bitmap_CalcByteOffset(uint16 BytesPerPixel); // Returns the amount of bytes a loop goes through depending on the InstructionMode.
static uint64 Bitmap_CalcTotalBytes(uint16 Width, uint16 Height, uint16 BytesPerPixel); // Returns the total amount of bytes a bitmap takes up.
static uint64 Bitmap_CalcUnpackedBytes(uint16 Width, uint16 Height, uint16 BytesPerPixel);
static void Bitmap_ConvertPacking(void *Buffer, void *DestBuffer, uint16 Width, uint16 Height, uint16 BytesPerPixel, uint16 Which);
static void Bitmap_CalcHistogram(void *Data, void *Input, uint16 BytesPerPixel, uint64 TotalBytes);

static bool32 Source_Generate(project_data *File, memory *Memory, void *Path); // Fills out source info if the source is a supported file.

// Libav (ffmpeg) backend for decoding video

static bool32 AV_IsFileSupported(char *filename);       // Tests whether a decoder is available for a given file.
static void AV_Init(char *filename, source *Source, memory *Memory); // Initializes all internal structs and calculates average PTS.
static cached_bitmap * AV_LoadVideoFrame(source *Source, memory *Memory, int32 TimelineFrame); // Loads video frame at TimelineFrame.

static cached_bitmap * Cache_CheckBitmap(source *Source, layer_bitmap_info *BitmapInfo, memory *Memory, int32 TimelineFrame);

static void TestGL_InitTexture(gl_effect_layer *Test, void *Data, uint16 Width, uint16 Height);
static gl_effect TestGL_MaskInitVerts(mask Mask);
static void TestGL_InitVerts();
static gl_vertex_shader TestGL_MaskUploadVerts(project_layer *Layer, mask *Mask);

static v2 Line_RatioToPoint(v2 a, v2 b, float ratio);
static v2 ImGui_ScreenPointToCompUV(ImVec2 ViewportMin, ImVec2 CompPos, ImVec2 CompZoom, ImVec2 MousePos);

void Bezier_CubicCalcPoints(v2 p1, v2 p2, v2 p3, v2 p4, void *Data, uint32 *Increment);

static void Action_Change_Commit(memory *Memory, void *DataLocation, void *OriginalData, void *NewData, action_change_type ActionChange);
static void Action_Entry_SetPointer(memory *Memory, void *Data);
static void Action_Entry_Begin(memory *Memory, action_entry_type Type, char *Name);
static void Action_Entry_End(memory *Memory);
static void Action_Undo(memory *Memory);
static void Action_Redo(memory *Memor);