From 8875d0226f0d38a1e5ef946e56cd15810627f5ac Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Wed, 3 Aug 2022 16:57:07 -0400 Subject: caching introduced --- effects.cpp | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'effects.cpp') diff --git a/effects.cpp b/effects.cpp index d427778..6d27df1 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1,5 +1,5 @@ static void -DrawColor(pixel_buffer *Buffer, memory *Memory, property_channel Property[]) +DrawColor(source *Source, layer_bitmap_info *BitmapInfo, memory *Memory, property_channel Property[]) { v4 FloatColor = Property[0].CurrentValue.col; blend_mode BlendMode = Property[1].CurrentValue.blendmode; @@ -32,14 +32,14 @@ DrawColor(pixel_buffer *Buffer, memory *Memory, property_channel Property[]) __m256 B_Colx2 = _mm256_mul_ps(B_Col, Two); __m256 B_ColInv = _mm256_set1_ps(1.0f - FloatColor.E[2]); - for (int16 Y = 0; Y < Buffer->Height; Y += 2) + for (int16 Y = 0; Y < Source->Info.Height; Y += 2) { - for (int16 X = 0; X < Buffer->Width; X += 4) + for (int16 X = 0; X < Source->Info.Width; X += 4) { uint32 XLookup = (X >> 2)*16 + (X % 4); - uint32 YLookup = (Y >> 2)*(Buffer->Width*4) + (Y % 4)*4; + uint32 YLookup = (Y >> 2)*(Source->Info.Width*4) + (Y % 4)*4; uint32 PixelToSeek = XLookup + YLookup; - uint8 *Pixel = (uint8 *)Buffer->EffectBuffer + PixelToSeek*Buffer->BytesPerPixel; + uint8 *Pixel = (uint8 *)BitmapInfo->BitmapBuffer + PixelToSeek*Source->Info.BytesPerPixel; __m256i DestPixel = _mm256_loadu_si256((const __m256i *)Pixel); // normalized values @@ -178,14 +178,14 @@ DrawColor(pixel_buffer *Buffer, memory *Memory, property_channel Property[]) } static void -DrawGradient(pixel_buffer *Buffer, memory *Memory, property_channel Property[]) +DrawGradient(source *Source, layer_bitmap_info *BitmapInfo, memory *Memory, property_channel Property[]) { v4 StartColor = Property[0].CurrentValue.col; v4 EndColor = Property[1].CurrentValue.col; } static void -Levels(pixel_buffer *Buffer, memory *Memory, property_channel Property[]) +Levels(source *Source, layer_bitmap_info *BitmapInfo, memory *Memory, property_channel Property[]) { } @@ -303,25 +303,6 @@ AddEffect(project_layer *Layer, memory *Memory, uint16 EffectListIndex) Layer->NumberOfEffects++; } -static void -CopyToBuffer(pixel_buffer *, uint16 asda = 0); - -static void -UpdateEffects(project_layer *Layer, memory *Memory) -{ - source_image *Source = (source_image *)Layer->RenderInfo; - if (!Source->Raster.EffectBuffer) { - Source->Raster.EffectBuffer = AllocateMemory(Memory, Source->Raster.Width * Source->Raster.Height * Source->Raster.BytesPerPixel, - B_Scratch); - } - CopyToBuffer(&Source->Raster); - for (int i = 0; i < Layer->NumberOfEffects; i++) - { - if (Layer->Effect[i]->IsActive) - Layer->Effect[i]->func(&Source->Raster, Memory, Layer->Effect[i]->Property); - } -} - #if 0 static void -- cgit v1.2.3