< prev index next >

src/java.desktop/share/native/libawt/java2d/SurfaceData.c

Print this page


   1 /*
   2  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 214         bounds->y2 = h;
 215     }
 216 }
 217 
 218 JNIEXPORT void JNICALL
 219 SurfaceData_IntersectBlitBounds(SurfaceDataBounds *src,
 220                                 SurfaceDataBounds *dst,
 221                                 jint dx, jint dy)
 222 {
 223     int t;
 224     GETMAX(dst->x1, src->x1 + dx);
 225     GETMAX(dst->y1, src->y1 + dy);
 226     GETMIN(dst->x2, src->x2 + dx);
 227     GETMIN(dst->y2, src->y2 + dy);
 228     GETMAX(src->x1, dst->x1 - dx);
 229     GETMAX(src->y1, dst->y1 - dy);
 230     GETMIN(src->x2, dst->x2 - dx);
 231     GETMIN(src->y2, dst->y2 - dy);
 232 }
 233 
 234 SurfaceDataOps *SurfaceData_InitOps(JNIEnv *env, jobject sData, int opsSize)

 235 {
 236     SurfaceDataOps *ops = malloc(opsSize);
 237     SurfaceData_SetOps(env, sData, ops);
 238     if (ops != NULL) {
 239         memset(ops, 0, opsSize);
 240         if (!(*env)->ExceptionCheck(env)) {
 241             ops->sdObject = (*env)->NewWeakGlobalRef(env, sData);
 242         }
 243     }
 244     return ops;
 245 }
 246 
 247 void SurfaceData_DisposeOps(JNIEnv *env, jlong ops)
 248 {
 249     if (ops != 0) {
 250         SurfaceDataOps *sdops = (SurfaceDataOps*)jlong_to_ptr(ops);
 251         /* Invoke the ops-specific disposal function */
 252         SurfaceData_InvokeDispose(env, sdops);
 253         (*env)->DeleteWeakGlobalRef(env, sdops->sdObject);
 254         free(sdops);
   1 /*
   2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 214         bounds->y2 = h;
 215     }
 216 }
 217 
 218 JNIEXPORT void JNICALL
 219 SurfaceData_IntersectBlitBounds(SurfaceDataBounds *src,
 220                                 SurfaceDataBounds *dst,
 221                                 jint dx, jint dy)
 222 {
 223     int t;
 224     GETMAX(dst->x1, src->x1 + dx);
 225     GETMAX(dst->y1, src->y1 + dy);
 226     GETMIN(dst->x2, src->x2 + dx);
 227     GETMIN(dst->y2, src->y2 + dy);
 228     GETMAX(src->x1, dst->x1 - dx);
 229     GETMAX(src->y1, dst->y1 - dy);
 230     GETMIN(src->x2, dst->x2 - dx);
 231     GETMIN(src->y2, dst->y2 - dy);
 232 }
 233 
 234 JNIEXPORT SurfaceDataOps * JNICALL
 235 SurfaceData_InitOps(JNIEnv *env, jobject sData, int opsSize)
 236 {
 237     SurfaceDataOps *ops = malloc(opsSize);
 238     SurfaceData_SetOps(env, sData, ops);
 239     if (ops != NULL) {
 240         memset(ops, 0, opsSize);
 241         if (!(*env)->ExceptionCheck(env)) {
 242             ops->sdObject = (*env)->NewWeakGlobalRef(env, sData);
 243         }
 244     }
 245     return ops;
 246 }
 247 
 248 void SurfaceData_DisposeOps(JNIEnv *env, jlong ops)
 249 {
 250     if (ops != 0) {
 251         SurfaceDataOps *sdops = (SurfaceDataOps*)jlong_to_ptr(ops);
 252         /* Invoke the ops-specific disposal function */
 253         SurfaceData_InvokeDispose(env, sdops);
 254         (*env)->DeleteWeakGlobalRef(env, sdops->sdObject);
 255         free(sdops);
< prev index next >