NativeFX icon indicating copy to clipboard operation
NativeFX copied to clipboard

Use new PixelBuffer API

Open johanvos opened this issue 5 years ago • 10 comments

While not available in maven central, the new API using PixelBuffer can already be used. It would be nice to have this API being used in a branch, so that people can compare?

johanvos avatar Jun 27 '19 10:06 johanvos

thats a good idea!

miho avatar Jun 27 '19 20:06 miho

@johanvos do you know how to specify a local JavaFX installation in the openjfx plugin? I could work on this in the next couple of days.

miho avatar Jul 18 '19 09:07 miho

Not possible yet, will be added very soon though.

johanvos avatar Jul 18 '19 10:07 johanvos

Ok. Then I'll wait until that's done.

miho avatar Jul 18 '19 10:07 miho

This is now available in the new 0.0.8-SNAPSHOT of javafx-gradle-plugin. To use this, add a settings.gradle file with the following:

pluginManagement {
    repositories {
        gradlePluginPortal()
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
}

In build.gradle, update the plugin version to 0.0.8-SNAPSHOT and add a declaration for sdk in the javafx block:

plugins {
  ...
  id 'org.openjfx.javafxplugin' version '0.0.8-SNAPSHOT'
}
...
javafx {
    modules = [ 'javafx.controls' ]
    sdk = "path-to-javafx-sdk"
}

abhinayagarwal avatar Jul 19 '19 09:07 abhinayagarwal

Cool! So I have no excuses anymore ;)

miho avatar Jul 19 '19 09:07 miho

Just for the record, this is how I currently fetch the preview release:

javafx {
    modules = [ 'javafx.controls']
    sdk = "$projectDir/deps/javafx-sdk/sdk/javafx-sdk-13/"
}

task downloadJFX13(type: Download) {

    if(isWindows) {
        src 'https://download2.gluonhq.com/openjfx/forks/pixelbuffer/openjfx-13-pixelbuffer-ea+10_windows-x64_bin-sdk.zip'
    } else if(isLinux) {
        src 'https://download2.gluonhq.com/openjfx/forks/pixelbuffer/openjfx-13-pixelbuffer-ea+10_linux-x64_bin-sdk.zip'
    } else if(isMacOs) {
        src 'https://download2.gluonhq.com/openjfx/forks/pixelbuffer/openjfx-13-pixelbuffer-ea+10_osx-x64_bin-sdk.zip'
    }
    
    dest "$projectDir/deps/javafx-sdk/sdk.zip"
    
    onlyIfNewer true
}

task downloadAndUnzipJFX13(dependsOn: downloadJFX13, type: Copy) {
    
    from zipTree(downloadJFX13.dest)
    into "$projectDir/deps/javafx-sdk/sdk/"
    
}

miho avatar Jul 19 '19 09:07 miho

The good news is that the new API works. We consume around 50% less CPU on the java client. We have to reconsider the native mutex stuff though. It seems that we waste too much time waiting until native rendering is done.

miho avatar Jul 19 '19 11:07 miho

So far so good. For my understanding: what native mutex do you mean? Inside the OpenJFX implementation, or in NativeFX code?

johanvos avatar Jul 19 '19 11:07 johanvos

NativeFX

miho avatar Jul 19 '19 11:07 miho