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

Print this page




  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 }


  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 
 105         CALayer *windowLayer = jlong_to_ptr(windowLayerPtr);
 106         surfaceLayers = [[AWTSurfaceLayers alloc] initWithWindowLayer: windowLayer];
 107         CFRetain(surfaceLayers);
 108         [surfaceLayers release];
 109     }];
 110     
 111 JNF_COCOA_EXIT(env);
 112 
 113   return ptr_to_jlong(surfaceLayers);
 114 }
 115 
 116 /*
 117  * Class:     sun_lwawt_macosx_CPlatformComponent
 118  * Method:    nativeSetBounds
 119  * Signature: (JIIII)V
 120  */
 121 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformComponent_nativeSetBounds
 122 (JNIEnv *env, jclass clazz, jlong surfaceLayersPtr, jint x, jint y, jint width, jint height)
 123 {
 124 JNF_COCOA_ENTER(env);
 125 
 126   AWTSurfaceLayers *surfaceLayers = OBJC(surfaceLayersPtr);
 127     
 128   [ThreadUtilities performOnMainThreadWaiting:NO block:^(){

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