src/macosx/native/sun/awt/AWTSurfaceLayers.m

Print this page




  82 
  83     layer.frame = newRect;
  84 
  85     [AWTSurfaceLayers repaintLayersRecursively:layer];
  86 }
  87 
  88 @end
  89 
  90 /*
  91  * Class:     sun_lwawt_macosx_CPlatformComponent
  92  * Method:    nativeCreateLayer
  93  * Signature: ()J
  94  */
  95 JNIEXPORT jlong JNICALL
  96 Java_sun_lwawt_macosx_CPlatformComponent_nativeCreateComponent
  97 (JNIEnv *env, jobject obj, jlong windowLayerPtr)
  98 {
  99   __block AWTSurfaceLayers *surfaceLayers = nil;
 100 
 101 JNF_COCOA_ENTER(env);
 102 AWT_ASSERT_NOT_APPKIT_THREAD;
 103 
 104   [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
 105       AWT_ASSERT_APPKIT_THREAD;
 106 
 107       CALayer *windowLayer = jlong_to_ptr(windowLayerPtr);
 108       surfaceLayers = [[AWTSurfaceLayers alloc] initWithWindowLayer: windowLayer];
 109       CFRetain(surfaceLayers);
 110       [surfaceLayers release];
 111     }];
 112 
 113 JNF_COCOA_EXIT(env);
 114 
 115   return ptr_to_jlong(surfaceLayers);
 116 }
 117 
 118 /*
 119  * Class:     sun_lwawt_macosx_CPlatformComponent
 120  * Method:    nativeSetBounds
 121  * Signature: (JIIII)V
 122  */
 123 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformComponent_nativeSetBounds
 124 (JNIEnv *env, jclass clazz, jlong surfaceLayersPtr, jint x, jint y, jint width, jint height)
 125 {
 126 JNF_COCOA_ENTER(env);
 127 
 128   AWTSurfaceLayers *surfaceLayers = OBJC(surfaceLayersPtr);
 129   [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){

 130       AWT_ASSERT_APPKIT_THREAD;
 131 
 132       CGRect rect = CGRectMake(x, y, width, height);
 133       [surfaceLayers setBounds: rect];
 134     }];
 135 
 136 JNF_COCOA_EXIT(env);
 137 }


  82 
  83     layer.frame = newRect;
  84 
  85     [AWTSurfaceLayers repaintLayersRecursively:layer];
  86 }
  87 
  88 @end
  89 
  90 /*
  91  * Class:     sun_lwawt_macosx_CPlatformComponent
  92  * Method:    nativeCreateLayer
  93  * Signature: ()J
  94  */
  95 JNIEXPORT jlong JNICALL
  96 Java_sun_lwawt_macosx_CPlatformComponent_nativeCreateComponent
  97 (JNIEnv *env, jobject obj, jlong windowLayerPtr)
  98 {
  99   __block AWTSurfaceLayers *surfaceLayers = nil;
 100 
 101 JNF_COCOA_ENTER(env);

 102 
 103     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
 104         AWT_ASSERT_APPKIT_THREAD;
 105         
 106         CALayer *windowLayer = jlong_to_ptr(windowLayerPtr);
 107         surfaceLayers = [[AWTSurfaceLayers alloc] initWithWindowLayer: windowLayer];
 108         CFRetain(surfaceLayers);
 109         [surfaceLayers release];
 110     }];
 111     
 112 JNF_COCOA_EXIT(env);
 113 
 114   return ptr_to_jlong(surfaceLayers);
 115 }
 116 
 117 /*
 118  * Class:     sun_lwawt_macosx_CPlatformComponent
 119  * Method:    nativeSetBounds
 120  * Signature: (JIIII)V
 121  */
 122 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformComponent_nativeSetBounds
 123 (JNIEnv *env, jclass clazz, jlong surfaceLayersPtr, jint x, jint y, jint width, jint height)
 124 {
 125 JNF_COCOA_ENTER(env);
 126 
 127   AWTSurfaceLayers *surfaceLayers = OBJC(surfaceLayersPtr);
 128     
 129   [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
 130       AWT_ASSERT_APPKIT_THREAD;
 131 
 132       CGRect rect = CGRectMake(x, y, width, height);
 133       [surfaceLayers setBounds: rect];
 134   }];
 135 
 136 JNF_COCOA_EXIT(env);
 137 }