On Sat, 14 Mar 2020 13:25:00 GMT, Frederic Thevenet <github.com+7450507+ftheve...@openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java >> line 1600: >> >>> 1599: } >>> 1600: } >>> 1601: } >> >> The `if (exactHeightDivFound.get())` and `else` block here look effectively >> same. Could you please take a re-look or >> explain what am I missing here. > > Functionally, both side of the condition actually do the exact same thing, > but the side effects of which dimension is > processed in the inner loop sometime have measurable consequences in terms of > performances; I've added the following > comment to the code to better explain this: > // In order to minimize the number of time we have to resize the underlying > // surface for capturing a tile, choose a dimension that has an exact > divider > // (if any) to be processed in the inner most loop. > // E.g. looping on width then height in the example bellow requires four > // surface resizing, whereas the opposite requires only two: > // > // for (w;;) for (h;;) > // for(h;;) for(w;;) > // ----------------- ----------------- > // | | | | | | > // | 1 | 3 | | 1 | 2 | > // h | | | h | | | > // ----------------- ----------------- > // | 2 | 4 | | 3 | 4 | > // ----------------- ----------------- > // w w Than for the additional comment, this will reduce the number of textures created by below call in `renderTile()` `com.sun.prism.RTTexture rt = tileImg.getRT(w, h, rf);` ------------- PR: https://git.openjdk.java.net/jfx/pull/112