Skip to content

Commit 168e705

Browse files
committed
Added alpha check
1 parent b3829c2 commit 168e705

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

common/src/main/kotlin/com/lambda/graphics/renderer/gui/rect/filled/FilledRectEntry.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,16 @@ class FilledRectEntry(
3131
val pos2 = position.rightBottom
3232

3333
val size = pos2 - pos1
34+
if (leftTop.alpha < MIN_ALPHA && rightTop.alpha < MIN_ALPHA && rightBottom.alpha < MIN_ALPHA && leftBottom.alpha < MIN_ALPHA) return@use
3435
if (size.x < MIN_SIZE || size.y < MIN_SIZE) return@use
3536

3637
val halfSize = size * 0.5
3738
val maxRadius = min(halfSize.x, halfSize.y)
3839

3940
val round = min(roundRadius, maxRadius)
4041

41-
val p1 = pos1 - 0.75
42-
val p2 = pos2 + 0.75
42+
val p1 = pos1 - 0.25
43+
val p2 = pos2 + 0.25
4344
val s = shade.toInt().toDouble()
4445

4546
grow(4)
@@ -54,5 +55,6 @@ class FilledRectEntry(
5455

5556
companion object {
5657
private const val MIN_SIZE = 0.5
58+
private const val MIN_ALPHA = 3
5759
}
5860
}

0 commit comments

Comments
 (0)