summaryrefslogtreecommitdiff
path: root/caching.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'caching.cpp')
-rw-r--r--caching.cpp171
1 files changed, 0 insertions, 171 deletions
diff --git a/caching.cpp b/caching.cpp
deleted file mode 100644
index c35189e..0000000
--- a/caching.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-
-#if 0
-static void
-CacheFrame(cache *Cache, pixel_buffer *CompBuffer)
-{
-
- int MinX = 0;
- int MinY = 0;
- int MaxX = CompBuffer->Width;
- int MaxY = CompBuffer->Height;
-
-
- uint8 *Row = ((uint8 *)Cache->Address +
- CompBuffer->BytesPerPixel +
- MinY*CompBuffer->Pitch);
- uint8 *CompRow = ((uint8 *)CompBuffer->OriginalBuffer +
- CompBuffer->BytesPerPixel +
- CompBuffer->Pitch);
- for(int Y = MinY;
- Y < MaxY;
- ++Y)
- {
- uint32 *Pixel = (uint32 *)Row + MinX;
- uint32 *CompPixel = (uint32 *)CompRow;
- for(int X = MinX;
- X < MaxX;
- ++X)
- {
- *(uint32 *)Pixel++ = *(uint32 *)CompPixel;
- CompPixel++;
- }
- Row += CompBuffer->Pitch;
- CompRow += CompBuffer->Pitch;
- }
-}
-
-static void
-FetchCache(cache *Cache, pixel_buffer *CompBuffer)
-{
-
- int MinX = 0;
- int MinY = 0;
- int MaxX = CompBuffer->Width;
- int MaxY = CompBuffer->Height;
-
-
- uint8 *Row = ((uint8 *)Cache->Address +
- CompBuffer->BytesPerPixel +
- MinY*CompBuffer->Pitch);
- uint8 *CompRow = ((uint8 *)CompBuffer->OriginalBuffer +
- CompBuffer->BytesPerPixel +
- CompBuffer->Pitch);
- for(int Y = MinY;
- Y < MaxY;
- ++Y)
- {
- uint32 *Pixel = (uint32 *)Row + MinX;
- uint32 *CompPixel = (uint32 *)CompRow;
- for(int X = MinX;
- X < MaxX;
- ++X)
- {
- *(uint32 *)CompPixel = *(uint32 *)Pixel++;
- CompPixel++;
- }
- Row += CompBuffer->Pitch;
- CompRow += CompBuffer->Pitch;
- }
-}
-
-static void
-InteractToComp(pixel_buffer *CompBuffer, cache_pool *Cache)
-{
- int MinX = 0;
- int MinY = 0;
- int MaxX = CompBuffer->Width;
- int MaxY = CompBuffer->Height;
-
- uint8 *CompRow = ((uint8 *)CompBuffer->OriginalBuffer +
- CompBuffer->BytesPerPixel +
- CompBuffer->Pitch);
- uint8 *Row0 = ((uint8 *)Cache->Intermediate[0].Address +
- CompBuffer->BytesPerPixel +
- CompBuffer->Pitch);
- uint8 *Row1 = ((uint8 *)Cache->Intermediate[1].Address +
- CompBuffer->BytesPerPixel +
- CompBuffer->Pitch);
- uint8 *Row2 = ((uint8 *)Cache->Intermediate[2].Address +
- CompBuffer->BytesPerPixel +
- CompBuffer->Pitch);
- for(int Y = MinY;
- Y < MaxY;
- ++Y)
- {
- uint32 *CompPixel = (uint32 *)CompRow;
- uint32 *Pixel0 = (uint32 *)Row0;
- uint32 *Pixel1 = (uint32 *)Row1;
- uint32 *Pixel2 = (uint32 *)Row2;
- for(int X = MinX;
- X < MaxX;
- ++X)
- {
- RenderAlpha(CompPixel, *Pixel0);
- RenderAlpha(CompPixel, *Pixel1);
- RenderAlpha(CompPixel, *Pixel2);
- CompPixel++;
- Pixel0++;
- Pixel1++;
- Pixel2++;
- }
- CompRow += CompBuffer->Pitch;
- Row0 += CompBuffer->Pitch;
- Row1 += CompBuffer->Pitch;
- Row2 += CompBuffer->Pitch;
- }
-}
-
-static void
-UncacheFrames(int16 Min, int16 Max, cache_pool *Cache)
-{
- for (int16 i = Min; i < Max; i++)
- Cache->Frame[i].Cached = false;
-};
-
-static void
-CacheKeyframeAtIndex(uint16 i, struct property_channel *Property, cache_pool *Cache)
-{
- Assert(Property->NumberOfKeyframes > 0);
- uint16 *Sorted = Property->Sorted + i;
- if (Property->NumberOfKeyframes == 1) {
- // nothing happens
- } else if (Property->NumberOfKeyframes == 2) {
- UncacheFrames(Property->Keyframe[0].FrameNumber, Property->Keyframe[1].FrameNumber, Cache);
- } else if (i == 0) {
- UncacheFrames(Property->Keyframe[*Sorted].FrameNumber, Property->Keyframe[*(Sorted+1)].FrameNumber, Cache);
- } else if (i == Property->NumberOfKeyframes - 1) {
- UncacheFrames(Property->Keyframe[*(Sorted-1)].FrameNumber, Property->Keyframe[*Sorted].FrameNumber, Cache);
- } else {
- UncacheFrames(Property->Keyframe[*(Sorted-1)].FrameNumber, Property->Keyframe[*(Sorted+1)].FrameNumber, Cache);
- }
-}
-
-static void
-SortAndCacheKeyframeAtFrame(uint16 f, struct property_channel *Property, cache_pool *Cache)
-{
- Assert(Property->NumberOfKeyframes > 0);
- if (Property->NumberOfKeyframes == 1) {
- } else if (Property->NumberOfKeyframes == 2) {
- UncacheFrames(Property->KeyframePTR[0]->FrameNumber, Property->KeyframePTR[1]->FrameNumber, Cache);
- } else {
- int i = 0;
- for (; i < Property->NumberOfKeyframes - 1; i++) {
- if (Property->KeyframePTR[i]->FrameNumber > Property->KeyframePTR[i+1]->FrameNumber) {
- struct keyframe *Temp = Property->KeyframePTR[i];
- Property->KeyframePTR[i] = Property->KeyframePTR[i+1];
- Property->KeyframePTR[i+1] = Temp;
- break;
- }
- if (Property->KeyframePTR[i]->FrameNumber >= f)
- break;
- }
- if (i == 0) {
- UncacheFrames(Property->KeyframePTR[i]->FrameNumber, Property->KeyframePTR[i+1]->FrameNumber, Cache);
- } else if (i == Property->NumberOfKeyframes - 1) {
- UncacheFrames(Property->KeyframePTR[i-1]->FrameNumber, Property->KeyframePTR[i]->FrameNumber, Cache);
- } else {
- UncacheFrames(Property->KeyframePTR[i-1]->FrameNumber, Property->KeyframePTR[i+1]->FrameNumber, Cache);
- }
- }
-}
-#endif