diff --git a/core/dplug/core/stackallocator.d b/core/dplug/core/stackallocator.d index 023e9108..59d367a8 100644 --- a/core/dplug/core/stackallocator.d +++ b/core/dplug/core/stackallocator.d @@ -4,12 +4,13 @@ Stack allocator for temporary allocations. Copyright: Auburn Sounds 2019. License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) */ +// TODO deprecated("Will be removed in Dplug v15") for the module itself module dplug.core.stackallocator; import core.stdc.stdlib: malloc, free; import dplug.core.vec; -struct StackAllocator +deprecated("Will be removed in Dplug v14") struct StackAllocator { private: Vec!(ubyte*) bucketArray; @@ -76,37 +77,3 @@ public: currentPageFreeBytes = PAGE_SIZE; } } - -unittest -{ - StackAllocator allocator; - auto saved = allocator.saveState; - uint[] arr = allocator.makeArray!uint(10); - arr[] = 42; - assert(arr.length == 10); - allocator.restoreState(saved); - - uint[] arr2 = allocator.makeArray!uint(10); - arr2[] = 48; - - assert(arr[0] == 48); - - // multiple allocations - uint[] arr3 = allocator.makeArray!uint(10); - arr3[] = 60; - - // doesn't overwrite arr2 - assert(arr2[0] == 48); - assert(arr2[$-1] == 48); - - allocator.restoreState(saved); - - // test new page allocation - allocator.makeArray!uint(1); - allocator.makeArray!uint(StackAllocator.PAGE_SIZE / uint.sizeof); - - allocator.restoreState(saved); - - // test page reuse - allocator.makeArray!uint(StackAllocator.PAGE_SIZE / uint.sizeof); -} \ No newline at end of file diff --git a/graphics/dplug/graphics/draw.d b/graphics/dplug/graphics/draw.d index 4501d201..68aa385b 100644 --- a/graphics/dplug/graphics/draw.d +++ b/graphics/dplug/graphics/draw.d @@ -212,10 +212,10 @@ void fillSector(V, COLOR)(auto ref V v, int x, int y, int r0, int r1, real a0, r { int x0 = x>r1?x-r1:0; int y0 = y>r1?y-r1:0; - int x1 = x+r; + int x1 = x+r1; if (x1 > v.w-1) x1 = v.w-1; - int y1 = y+r; + int y1 = y+r1; if (y1 > v.h-1) y1 = v.h-1;