Print this page
Added gradle and cmake project

Split Close
Expand all
Collapse all
          --- old/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m
          +++ new/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20   20   *
  21   21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22   22   * or visit www.oracle.com if you need additional information or have any
  23   23   * questions.
  24   24   */
  25   25  
  26   26  #import "LWCToolkit.h"
  27   27  #import "ThreadUtilities.h"
  28   28  #include "GeomUtilities.h"
       29 +#import <Metal/Metal.h>
       30 +#import <MetalKit/MetalKit.h>
  29   31  
  30   32  #import <JavaNativeFoundation/JavaNativeFoundation.h>
  31   33  
  32   34  /**
  33   35   * Some default values for invalid CoreGraphics display ID.
  34   36   */
  35   37  #define DEFAULT_DEVICE_WIDTH 1024
  36   38  #define DEFAULT_DEVICE_HEIGHT 768
  37   39  #define DEFAULT_DEVICE_DPI 72
  38   40  
↓ open down ↓ 338 lines elided ↑ open up ↑
 377  379                      ret = [screen backingScaleFactor];
 378  380                  }
 379  381                  break;
 380  382              }
 381  383          }
 382  384      }];
 383  385  
 384  386  JNF_COCOA_EXIT(env);
 385  387      return ret;
 386  388  }
      389 +
      390 +/*
      391 + * Class:     sun_awt_CGraphicsDevice
      392 + * Method:    nativeGetMetalDeviceName
      393 + * Signature: (I)Ljava/lang/String;
      394 + */
      395 +JNIEXPORT jstring JNICALL Java_sun_awt_CGraphicsDevice_nativeGetMetalDeviceName
      396 +  (JNIEnv *env, jclass class, jint displayID)
      397 +{
      398 +
      399 +    id<MTLDevice> device = CGDirectDisplayCopyCurrentMetalDevice(displayID);
      400 +    if (!device) return NULL;
      401 +    NSString* name = [device name];
      402 +    UniChar *chars = malloc(name.length * sizeof(UniChar));
      403 +    if (!chars) return NULL;
      404 +    [name getCharacters:chars range:NSMakeRange(0,name.length)];
      405 +    jstring javaString = (*env)->NewString(env, chars, name.length);
      406 +    free(chars);
      407 +    return javaString;
      408 +}
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX