Gjallarhorn: Parallel Rendering and Quad Image Improvements

This commit is contained in:
Kenneth Endfinger
2022-01-07 07:29:04 -05:00
parent bc2d3e28ae
commit 10cf0cadac
4 changed files with 79 additions and 29 deletions

View File

@ -1,11 +1,12 @@
package cloud.kubelet.foundation.gjallarhorn.util
import java.awt.Color
import java.util.concurrent.ConcurrentHashMap
class RandomColorKey {
private val colors = mutableMapOf<String, Color>()
private val colors = ConcurrentHashMap<String, Color>()
fun map(key: String) = colors.getOrPut(key) { findUniqueColor() }
fun map(key: String) = colors.computeIfAbsent(key) { findUniqueColor() }
private fun findUniqueColor(): Color {
var random = randomColor()