< prev index next >

modules/javafx.graphics/src/main/native-glass/mac/GlassRobot.m

Print this page

        

@@ -479,19 +479,24 @@
 
                     // cleanup
                     CGContextRelease(jPicContextRef);
                     (*env)->ReleaseIntArrayElements(env, pixelArray, javaPixels, 0);
 
+                    jclass applicationClass =
+                        [GlassHelper ClassForName:"com.sun.glass.ui.Application" withEnv:env];
+                    if (!applicationClass) return NULL;
+
                     jfloat scale = (*env)->CallStaticFloatMethod(env,
-                            [GlassHelper ClassForName:"com.sun.glass.ui.Application" withEnv:env],
+                            applicationClass,
                             javaIDs.Application.getScaleFactor, x, y, width, height);
                      if ((*env)->ExceptionCheck(env)) return NULL;
 
                     // create Pixels
-                    pixels = (*env)->CallStaticObjectMethod(env,
-                            [GlassHelper ClassForName:"com.sun.glass.ui.Application" withEnv:env],
-                            javaIDs.Application.createPixels, pixWidth, pixHeight, pixelArray, scale, scale);
+                    pixels = (*env)->CallStaticObjectMethod(env, applicationClass,
+                                                            javaIDs.Application.createPixels,
+                                                            pixWidth, pixHeight,
+                                                            pixelArray, scale, scale);
                     if ((*env)->ExceptionCheck(env)) return NULL;
                 }
             }
 
             CGImageRelease(screenImage);
< prev index next >