src/java.desktop/share/native/libawt/java2d/SurfaceData.c
branchmetal-prototype-branch
changeset 57196 a95707a39ff5
parent 49440 396ea30afbd5
equal deleted inserted replaced
57195:bb0bd0cff018 57196:a95707a39ff5
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    28 #include "jni_util.h"
    28 #include "jni_util.h"
    29 #include "Disposer.h"
    29 #include "Disposer.h"
    30 
    30 
    31 #include "stdlib.h"
    31 #include "stdlib.h"
    32 #include "string.h"
    32 #include "string.h"
       
    33 #include "Trace.h"
    33 
    34 
    34 /**
    35 /**
    35  * This include file contains information on how to use a SurfaceData
    36  * This include file contains information on how to use a SurfaceData
    36  * object from native code.
    37  * object from native code.
    37  */
    38  */
    78 JNIEXPORT void JNICALL
    79 JNIEXPORT void JNICALL
    79 Java_sun_java2d_SurfaceData_initIDs(JNIEnv *env, jclass sd)
    80 Java_sun_java2d_SurfaceData_initIDs(JNIEnv *env, jclass sd)
    80 {
    81 {
    81     jclass pICMClass;
    82     jclass pICMClass;
    82 
    83 
       
    84     J2dTraceLn(J2D_TRACE_INFO, "Java_sun_java2d_SurfaceData_initIDs --- invoked ");
       
    85 
    83     InitGlobalClassRef(pInvalidPipeClass, env,
    86     InitGlobalClassRef(pInvalidPipeClass, env,
    84                        "sun/java2d/InvalidPipeException");
    87                        "sun/java2d/InvalidPipeException");
    85 
    88 
    86     InitGlobalClassRef(pNullSurfaceDataClass, env,
    89     InitGlobalClassRef(pNullSurfaceDataClass, env,
    87                        "sun/java2d/NullSurfaceData");
    90                        "sun/java2d/NullSurfaceData");
    88 
    91             
    89     InitField(pDataID, env, sd, "pData", "J");
    92     InitField(pDataID, env, sd, "pData", "J");
    90     InitField(validID, env, sd, "valid", "Z");
    93     InitField(validID, env, sd, "valid", "Z");
    91 
    94 
    92     InitClass(pICMClass, env, "java/awt/image/IndexColorModel");
    95     InitClass(pICMClass, env, "java/awt/image/IndexColorModel");
    93     InitField(allGrayID, env, pICMClass, "allgrayopaque", "Z");
    96     InitField(allGrayID, env, pICMClass, "allgrayopaque", "Z");
   233 
   236 
   234 JNIEXPORT SurfaceDataOps * JNICALL
   237 JNIEXPORT SurfaceDataOps * JNICALL
   235 SurfaceData_InitOps(JNIEnv *env, jobject sData, int opsSize)
   238 SurfaceData_InitOps(JNIEnv *env, jobject sData, int opsSize)
   236 {
   239 {
   237     SurfaceDataOps *ops = malloc(opsSize);
   240     SurfaceDataOps *ops = malloc(opsSize);
       
   241 
       
   242     J2dTraceLn(J2D_TRACE_INFO, "SurfaceData_InitOps --- invoked ");
       
   243 
   238     SurfaceData_SetOps(env, sData, ops);
   244     SurfaceData_SetOps(env, sData, ops);
   239     if (ops != NULL) {
   245     if (ops != NULL) {
   240         memset(ops, 0, opsSize);
   246         memset(ops, 0, opsSize);
   241         if (!(*env)->ExceptionCheck(env)) {
   247         if (!(*env)->ExceptionCheck(env)) {
   242             ops->sdObject = (*env)->NewWeakGlobalRef(env, sData);
   248             ops->sdObject = (*env)->NewWeakGlobalRef(env, sData);