[orx-fx, orx-jumpflood] Match changes to Filter

This commit is contained in:
Edwin Jakobs
2023-12-14 17:52:09 +01:00
parent ad9177e085
commit 3ec3f0bafb
39 changed files with 162 additions and 118 deletions

View File

@@ -4,6 +4,7 @@ import org.openrndr.draw.ColorBuffer
import org.openrndr.draw.Filter
import org.openrndr.draw.createEquivalent
import org.openrndr.draw.isEquivalentTo
import org.openrndr.shape.Rectangle
/**
* @param first the filter that is applied first
@@ -26,15 +27,15 @@ class CompositeFilter<F0 : Filter, F1 : Filter>(
) : Filter() {
private var intermediate: ColorBuffer? = null
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
val firstSource = firstSource(source.toList()).toTypedArray()
if (!useIntermediateBuffer) {
first.firstParameters()
first.apply(firstSource, target)
first.apply(firstSource, target, clip)
second.secondParameters()
val secondSource = secondSource(source.toList(), target.first()).toTypedArray()
second.apply(secondSource, target)
second.apply(secondSource, target, clip)
} else {
val li = intermediate
if (li != null && !li.isEquivalentTo(target.first())) {
@@ -45,10 +46,10 @@ class CompositeFilter<F0 : Filter, F1 : Filter>(
intermediate = target.first().createEquivalent()
}
first.firstParameters()
first.apply(firstSource, arrayOf(intermediate!!))
first.apply(firstSource, arrayOf(intermediate!!), clip)
val secondSource = secondSource(source.toList(), intermediate!!).toTypedArray()
second.secondParameters()
second.apply(secondSource, target)
second.apply(secondSource, target, clip)
}
}