On Thu, 16 Jan 2020 10:55:38 GMT, Ambarish Rapte <ara...@openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/Scene.java line 1306: >> >>> 1305: int verticalTileNb = (int) Math.ceil(height / (double) >>> maxTextureSize); >>> 1306: int horizontalTileNb = (int) Math.ceil(width / (double) >>> maxTextureSize); >>> 1307: for (int i = 0; i < horizontalTileNb; i++) { >> >> A suggestion for this arithmetic. >> int verticalTileNb = height / maxTextureSize + 1; >> int horizontalTileNb = width / maxTextureSize + 1; >> This will avoid the type casting and floating point operations. However I >> leave it to you to change or not. > > Assuming `Nb` in `verticalTileNb` stands for number, I would recommend to > change the names as `numVerticalTiles` and `numHorizontalTiles` I think the proposed code changes are wrong in case that `height / maxTextureSize` is an exact integer. (Same for width). I normally add the 1 only if `height % maxTextureSize != 0` ------------- PR: https://git.openjdk.java.net/jfx/pull/68