src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m
branchmetal-prototype-branch
changeset 57196 a95707a39ff5
parent 47216 71c04702a3d5
child 57417 28582d575a98
equal deleted inserted replaced
57195:bb0bd0cff018 57196:a95707a39ff5
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    27 #import "ThreadUtilities.h"
    27 #import "ThreadUtilities.h"
    28 #import "LWCToolkit.h"
    28 #import "LWCToolkit.h"
    29 
    29 
    30 #import <JavaNativeFoundation/JavaNativeFoundation.h>
    30 #import <JavaNativeFoundation/JavaNativeFoundation.h>
    31 #import <QuartzCore/CATransaction.h>
    31 #import <QuartzCore/CATransaction.h>
       
    32 #import <QuartzCore/CAMetalLayer.h>
    32 
    33 
    33 @implementation AWTSurfaceLayers
    34 @implementation AWTSurfaceLayers
    34 
    35 
    35 @synthesize windowLayer;
    36 @synthesize windowLayer;
    36 
    37 
    67     }
    68     }
    68 }
    69 }
    69 
    70 
    70 // Updates back buffer size of the layer if it's an OpenGL layer
    71 // Updates back buffer size of the layer if it's an OpenGL layer
    71 // including all OpenGL sublayers
    72 // including all OpenGL sublayers
       
    73 // TODO : Added check for CAMetalLayer also but this needs to be verified.
    72 + (void) repaintLayersRecursively:(CALayer*)aLayer {
    74 + (void) repaintLayersRecursively:(CALayer*)aLayer {
    73     if ([aLayer isKindOfClass:[CAOpenGLLayer class]]) {
    75     if ([aLayer isKindOfClass:[CAOpenGLLayer class]] ||
       
    76         [aLayer isKindOfClass:[CAMetalLayer class]]) {
    74         [aLayer setNeedsDisplay];
    77         [aLayer setNeedsDisplay];
    75     }
    78     }
    76     for(CALayer *child in aLayer.sublayers) {
    79     for(CALayer *child in aLayer.sublayers) {
    77         [AWTSurfaceLayers repaintLayersRecursively: child];
    80         [AWTSurfaceLayers repaintLayersRecursively: child];
    78     }
    81     }
    90 
    93 
    91 @end
    94 @end
    92 
    95 
    93 /*
    96 /*
    94  * Class:     sun_lwawt_macosx_CPlatformComponent
    97  * Class:     sun_lwawt_macosx_CPlatformComponent
    95  * Method:    nativeCreateLayer
    98  * Method:    nativeCreateComponent
    96  * Signature: ()J
    99  * Signature: ()J
    97  */
   100  */
    98 JNIEXPORT jlong JNICALL
   101 JNIEXPORT jlong JNICALL
    99 Java_sun_lwawt_macosx_CPlatformComponent_nativeCreateComponent
   102 Java_sun_lwawt_macosx_CPlatformComponent_nativeCreateComponent
   100 (JNIEnv *env, jobject obj, jlong windowLayerPtr)
   103 (JNIEnv *env, jobject obj, jlong windowLayerPtr)