Skip to content

Commit

Permalink
#238: adds boundary checks to RectangularShape
Browse files Browse the repository at this point in the history
  • Loading branch information
rladstaetter committed Oct 26, 2024
1 parent 981a12e commit a8bf0f3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import javafx.geometry.Rectangle2D
*/
case class RectangularShape(width: Double, height: Double) extends Rectangle2D(0.0, 0.0, width, height) {
// checks in order not to overshoot the boundaries of underlying restrictions of the hardware accelerated api
// assert(width <= ChunkImage.MaxWidth, s"width was $width which exceeds ${ChunkImage.MaxWidth}.")
// assert(height <= ChunkImage.MaxHeight, s"height was $height which exceeds ${ChunkImage.MaxHeight}.")
// assert(width > 0)
// assert(height > 0)
assert(width <= ChunkImage.MaxWidth, s"width was $width which exceeds ${ChunkImage.MaxWidth}.")
assert(height <= ChunkImage.MaxHeight, s"height was $height which exceeds ${ChunkImage.MaxHeight}.")
assert(width > 0)
assert(height > 0)

val widthAsInt: Int = width.toInt
val heightAsInt: Int = height.toInt
Expand Down

0 comments on commit a8bf0f3

Please sign in to comment.