summaryrefslogtreecommitdiff
path: root/createcalls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'createcalls.cpp')
-rw-r--r--createcalls.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/createcalls.cpp b/createcalls.cpp
index d1d423b..d3da841 100644
--- a/createcalls.cpp
+++ b/createcalls.cpp
@@ -66,10 +66,13 @@ File_Open(project_state *State, memory *Memory, char *Filename)
}
*/
-static void
+static bool32
File_Open(project_data *File, project_state *State, memory *Memory, char *Filename)
{
SDL_RWops *FileHandle = SDL_RWFromFile(Filename, "r+b");
+ if (!FileHandle) {
+ return 0;
+ }
uint64 FileSize = SDL_RWseek(FileHandle, 0, RW_SEEK_END);
void *CompressedData = Memory_PushScratch(Memory, FileSize);
SDL_RWseek(FileHandle, 0, RW_SEEK_SET);
@@ -77,6 +80,18 @@ File_Open(project_data *File, project_state *State, memory *Memory, char *Filena
SDL_RWclose(FileHandle);
Data_Decompress(Memory, CompressedData, FileSize, File, 0);
Memory_PopScratch(Memory, FileSize);
+
+ // Temp sources aren't cleaned out on file close, so we do it here.
+ int h = 0, c = 0, i = 0;
+ int Count = File->Source_Count;
+ while (Block_Loop(Memory, F_Sources, Count, &h, &c, &i)) {
+ block_source *Source = (block_source *)Memory_Block_AddressAtIndex(Memory, F_Sources, i);
+ if (Source->Type == source_type_principal_temp) {
+ Source->Occupied = 0;
+ File->Source_Count--;
+ }
+ }
+ return 1;
}
static bool32
@@ -1215,7 +1230,7 @@ void Bitmap_SwapData(uint8 *Address_0, uint8 *Address_1, uint64 Size, uint16 Byt
uint64 RemainderBytes = Size % ByteOffset;
Assert(BytesPerPixel == 8);
-#if NEON
+#if ARM
Assert(InstructionMode != instruction_mode_neon);
#else
if (BytesPerPixel == 4) {
@@ -1306,9 +1321,12 @@ PaintTest(brush_info B, void *Buffer, rectangle RenderRegion)
if (!B.EraseMode) {
A_Blend = LayerAlpha + BrushAlpha;
- R_Blend = (R_Layer * (1.0f - BrushAlpha)) + (B.R_Brush * BrushAlpha);
- G_Blend = (G_Layer * (1.0f - BrushAlpha)) + (B.G_Brush * BrushAlpha);
- B_Blend = (B_Layer * (1.0f - BrushAlpha)) + (B.B_Brush * BrushAlpha);
+ // R_Blend = (R_Layer * (1.0f - BrushAlpha)) + (B.R_Brush * BrushAlpha);
+ // G_Blend = (G_Layer * (1.0f - BrushAlpha)) + (B.G_Brush * BrushAlpha);
+ // B_Blend = (B_Layer * (1.0f - BrushAlpha)) + (B.B_Brush * BrushAlpha);
+ R_Blend = B.R_Brush;
+ G_Blend = B.G_Brush;
+ B_Blend = B.B_Brush;
} else {
A_Blend = A_Layer * (1.0f - BrushAlpha);
R_Blend = R_Layer;
@@ -1407,6 +1425,7 @@ PaintTest_AVX2(brush_info B, void *Buffer, rectangle RenderRegion)
}
}
}
+#endif
static void
Brush_Render(project_state *State, ui *UI, layer_transforms T_Layer, block_composition *MainComp, block_source *Source, void *BitmapAddress, ImVec2 ViewportMin, ImVec2 MousePos)
@@ -1420,7 +1439,6 @@ Brush_Render(project_state *State, ui *UI, layer_transforms T_Layer, block_compo
PaintTest(B, BitmapAddress, B.LayerBounds);
}
}
-#endif
#if 0