diff options
Diffstat (limited to 'src/sorted.cpp')
-rw-r--r-- | src/sorted.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/sorted.cpp b/src/sorted.cpp index c039c08..b9bbb25 100644 --- a/src/sorted.cpp +++ b/src/sorted.cpp @@ -314,7 +314,8 @@ Layer_SortAll(project_state *State, memory *Memory, Arbitrary_ShiftData(Address_Start, Address_End, sizeof(sorted_layer_array) * SortedCompStart->FakeLayerCount, 1); FurthestMark = i + ((Direction > 0) ? 0 : -Direction); } - sorted_layer_array *FakeLayerEntry = &SortedLayerStart[FurthestMark + (FauxIncrement * ((Direction > 0) ? 1 : -Direction))]; + int FakeIdx = FurthestMark + ((Direction > 0) ? FauxIncrement : (SortedCompStart->FakeLayerCount - 1) - FauxIncrement); + sorted_layer_array *FakeLayerEntry = &SortedLayerStart[FakeIdx]; *FakeLayerEntry = *LayerEntry; FakeLayerEntry->IsFake = true; FauxIncrement++; @@ -329,30 +330,13 @@ Layer_SortAll(project_state *State, memory *Memory, FauxIncrement++; } } - if ((Direction > 0) ? !(i < SortedCompStart->LayerCount) : (i <= 0)) - break; i += Direction; - } - if (Furthest) { Direction *= -1; } - i = FauxIncrement = 0; - int LayerCount = SortedCompStart->LayerCount + SortedCompStart->FakeLayerCount; - FurthestMark = -1; - i = (Direction > 0) ? 0 : LayerCount - 1; - for (;;) { - sorted_layer_array *LayerEntry = &SortedLayerStart[i]; - block_layer *Layer = (block_layer *)Memory_Block_AddressAtIndex(Memory, F_Layers, LayerEntry->Block_Layer_Index); - if (LayerEntry->IsFake) { - if (FurthestMark == -1) - FurthestMark = Layer->Vertical_Offset; - if (Furthest) - LayerEntry->SortedOffset = FurthestMark; - FauxIncrement += Direction; - } - LayerEntry->SortedOffset -= FauxIncrement; - if ((Direction > 0) ? !(i < LayerCount) : (i <= 0)) + if ((Direction > 0) ? (i >= SortedCompStart->LayerCount) : (i < 0)) break; - i += Direction; } + // TODO(fox): Intermediate offset? + // Sort_OffsetDupes(State, Memory, SortedLayerStart, + // Direction, DupeIdx, LayerCount, SortedCompStart->FakeLayerCount) } } } |