Poor performance of javafx ported app

梦想与她 提交于 2019-12-06 00:43:35
José Pereda

This question contains some possible reasons why performance on an Android device could be poor in terms of what one could expect based on how the app runs on desktop.

Anyway, there is a quick win in "PuzzlePieces", and it is related to the CSS point mentioned in that question.

The Desk class adds this inline styling:

Desk(int numOfColumns, int numOfRows) {
        setStyle("-fx-background-color: #cccccc; " +
                "-fx-border-color: #464646; " +
                "-fx-effect: innershadow( two-pass-box , rgba(0,0,0,0.8) , 15, 0.0 , 0 , 4 );");

If you just remove the effect:

Desk(int numOfColumns, int numOfRows) {
        setStyle("-fx-background-color: #cccccc; " +
                "-fx-border-color: #464646; ");

you should notice a huge increment in performance.

As a rule of thumb, when porting desktop applications to mobile devices, avoid excessive css styling, and particularly, avoid at all cost css effects.

I haven't tried cache with the pieces, but probably this will help as well.

And it's worth mentioning as well, CPU will matter...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!