< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/CRobot.m

Print this page
rev 54086 : 8240487: Cleanup whitespace in .cc, .hh, .m, and .mm files


 307 }
 308 
 309 /*
 310  * Class:     sun_lwawt_macosx_CRobot
 311  * Method:    nativeGetScreenPixels
 312  * Signature: (IIIII[I)V
 313  */
 314 JNIEXPORT void JNICALL
 315 Java_sun_lwawt_macosx_CRobot_nativeGetScreenPixels
 316 (JNIEnv *env, jobject peer,
 317  jint x, jint y, jint width, jint height, jdouble scale, jintArray pixels)
 318 {
 319     JNF_COCOA_ENTER(env);
 320 
 321     jint picX = x;
 322     jint picY = y;
 323     jint picWidth = width;
 324     jint picHeight = height;
 325 
 326     CGRect screenRect = CGRectMake(picX / scale, picY / scale,
 327                                 picWidth / scale, picHeight / scale);
 328     CGImageRef screenPixelsImage = CGWindowListCreateImage(screenRect,
 329                                         kCGWindowListOptionOnScreenOnly,
 330                                         kCGNullWindowID, kCGWindowImageBestResolution);
 331 
 332     if (screenPixelsImage == NULL) {
 333         return;
 334     }
 335 
 336     // get a pointer to the Java int array
 337     void *jPixelData = (*env)->GetPrimitiveArrayCritical(env, pixels, 0);
 338     CHECK_NULL(jPixelData);
 339 
 340     // create a graphics context around the Java int array
 341     CGColorSpaceRef picColorSpace = CGColorSpaceCreateWithName(
 342                                             kCGColorSpaceSRGB);
 343     CGContextRef jPicContextRef = CGBitmapContextCreate(
 344                                             jPixelData,
 345                                             picWidth, picHeight,
 346                                             8, picWidth * sizeof(jint),
 347                                             picColorSpace,




 307 }
 308 
 309 /*
 310  * Class:     sun_lwawt_macosx_CRobot
 311  * Method:    nativeGetScreenPixels
 312  * Signature: (IIIII[I)V
 313  */
 314 JNIEXPORT void JNICALL
 315 Java_sun_lwawt_macosx_CRobot_nativeGetScreenPixels
 316 (JNIEnv *env, jobject peer,
 317  jint x, jint y, jint width, jint height, jdouble scale, jintArray pixels)
 318 {
 319     JNF_COCOA_ENTER(env);
 320 
 321     jint picX = x;
 322     jint picY = y;
 323     jint picWidth = width;
 324     jint picHeight = height;
 325 
 326     CGRect screenRect = CGRectMake(picX / scale, picY / scale,
 327                                 picWidth / scale, picHeight / scale);
 328     CGImageRef screenPixelsImage = CGWindowListCreateImage(screenRect,
 329                                         kCGWindowListOptionOnScreenOnly,
 330                                         kCGNullWindowID, kCGWindowImageBestResolution);
 331 
 332     if (screenPixelsImage == NULL) {
 333         return;
 334     }
 335 
 336     // get a pointer to the Java int array
 337     void *jPixelData = (*env)->GetPrimitiveArrayCritical(env, pixels, 0);
 338     CHECK_NULL(jPixelData);
 339 
 340     // create a graphics context around the Java int array
 341     CGColorSpaceRef picColorSpace = CGColorSpaceCreateWithName(
 342                                             kCGColorSpaceSRGB);
 343     CGContextRef jPicContextRef = CGBitmapContextCreate(
 344                                             jPixelData,
 345                                             picWidth, picHeight,
 346                                             8, picWidth * sizeof(jint),
 347                                             picColorSpace,


< prev index next >