< prev index next >

src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c

Print this page
rev 52901 : 8233250: Better X11 rendering
Reviewed-by: prr, rhalade, mschoene, serb


 246                 JNU_ThrowOutOfMemoryError(env,
 247                                           "Cannot create bitmask for "
 248                                           "offscreen surface");
 249             }
 250             return;
 251         }
 252     }
 253 
 254     /* Create a bitmask image and then blit it to the pixmap. */
 255     image = XCreateImage(awt_display, DefaultVisual(awt_display, screen),
 256                          1, XYBitmap, 0, NULL, width, height, 32, 0);
 257     if (image == NULL) {
 258         AWT_UNLOCK();
 259         if (!(*env)->ExceptionCheck(env))
 260         {
 261              JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask");
 262         }
 263         return;
 264     }
 265     dstScan = image->bytes_per_line;
 266     image->data = malloc(dstScan * height);
 267     if (image->data == NULL) {
 268         XFree(image);
 269         AWT_UNLOCK();
 270         if (!(*env)->ExceptionCheck(env))
 271         {
 272             JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask");
 273         }
 274         return;
 275     }
 276     pDst = (unsigned char *)image->data;
 277 
 278     srcInfo.bounds.x1 = 0;
 279     srcInfo.bounds.y1 = 0;
 280     srcInfo.bounds.x2 = width;
 281     srcInfo.bounds.y2 = height;
 282 
 283     flags = (isICM ? (SD_LOCK_LUT | SD_LOCK_READ) : SD_LOCK_READ);
 284     if (srcOps->Lock(env, srcOps, &srcInfo, flags) != SD_SUCCESS) {
 285         XDestroyImage(image);
 286         AWT_UNLOCK();




 246                 JNU_ThrowOutOfMemoryError(env,
 247                                           "Cannot create bitmask for "
 248                                           "offscreen surface");
 249             }
 250             return;
 251         }
 252     }
 253 
 254     /* Create a bitmask image and then blit it to the pixmap. */
 255     image = XCreateImage(awt_display, DefaultVisual(awt_display, screen),
 256                          1, XYBitmap, 0, NULL, width, height, 32, 0);
 257     if (image == NULL) {
 258         AWT_UNLOCK();
 259         if (!(*env)->ExceptionCheck(env))
 260         {
 261              JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask");
 262         }
 263         return;
 264     }
 265     dstScan = image->bytes_per_line;
 266     image->data = malloc((size_t) dstScan * height);
 267     if (image->data == NULL) {
 268         XFree(image);
 269         AWT_UNLOCK();
 270         if (!(*env)->ExceptionCheck(env))
 271         {
 272             JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask");
 273         }
 274         return;
 275     }
 276     pDst = (unsigned char *)image->data;
 277 
 278     srcInfo.bounds.x1 = 0;
 279     srcInfo.bounds.y1 = 0;
 280     srcInfo.bounds.x2 = width;
 281     srcInfo.bounds.y2 = height;
 282 
 283     flags = (isICM ? (SD_LOCK_LUT | SD_LOCK_READ) : SD_LOCK_READ);
 284     if (srcOps->Lock(env, srcOps, &srcInfo, flags) != SD_SUCCESS) {
 285         XDestroyImage(image);
 286         AWT_UNLOCK();


< prev index next >