src/java.desktop/share/native/libawt/java2d/SurfaceData.c
author aghaisas
Wed, 20 Feb 2019 17:00:40 +0530
branchmetal-prototype-branch
changeset 57196 a95707a39ff5
parent 49440 396ea30afbd5
permissions -rw-r--r--
Description : Metal Rendering Pipeline - initial implementation of line and quad rendering Contributed-by: jdv, aghaisas
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
57196
a95707a39ff5 Description : Metal Rendering Pipeline - initial implementation of line and quad rendering
aghaisas
parents: 49440
diff changeset
     2
 * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include "SurfaceData.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "jni_util.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "Disposer.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    31
#include "stdlib.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "string.h"
57196
a95707a39ff5 Description : Metal Rendering Pipeline - initial implementation of line and quad rendering
aghaisas
parents: 49440
diff changeset
    33
#include "Trace.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * This include file contains information on how to use a SurfaceData
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * object from native code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
static jclass pInvalidPipeClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
static jclass pNullSurfaceDataClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
static jfieldID pDataID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
static jfieldID allGrayID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
jfieldID validID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
GeneralDisposeFunc SurfaceData_DisposeOps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define InitClass(var, env, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    var = (*env)->FindClass(env, name); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    if (var == NULL) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        return; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
} while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#define InitField(var, env, jcl, name, type) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    var = (*env)->GetFieldID(env, jcl, name, type); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    if (var == NULL) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        return; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
} while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#define InitGlobalClassRef(var, env, name) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    jobject jtmp; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    InitClass(jtmp, env, name); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    var = (*env)->NewGlobalRef(env, jtmp); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    if (var == NULL) { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        return; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    } \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
} while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * Class:     sun_java2d_SurfaceData
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * Method:    initIDs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * Signature: ()V
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
Java_sun_java2d_SurfaceData_initIDs(JNIEnv *env, jclass sd)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    jclass pICMClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
57196
a95707a39ff5 Description : Metal Rendering Pipeline - initial implementation of line and quad rendering
aghaisas
parents: 49440
diff changeset
    84
    J2dTraceLn(J2D_TRACE_INFO, "Java_sun_java2d_SurfaceData_initIDs --- invoked ");
a95707a39ff5 Description : Metal Rendering Pipeline - initial implementation of line and quad rendering
aghaisas
parents: 49440
diff changeset
    85
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    InitGlobalClassRef(pInvalidPipeClass, env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                       "sun/java2d/InvalidPipeException");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    InitGlobalClassRef(pNullSurfaceDataClass, env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                       "sun/java2d/NullSurfaceData");
57196
a95707a39ff5 Description : Metal Rendering Pipeline - initial implementation of line and quad rendering
aghaisas
parents: 49440
diff changeset
    91
            
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    InitField(pDataID, env, sd, "pData", "J");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    InitField(validID, env, sd, "valid", "Z");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    InitClass(pICMClass, env, "java/awt/image/IndexColorModel");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    InitField(allGrayID, env, pICMClass, "allgrayopaque", "Z");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * Class:     sun_java2d_SurfaceData
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * Method:    isOpaqueGray
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * Signature: ()Z
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
JNIEXPORT jboolean JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
Java_sun_java2d_SurfaceData_isOpaqueGray(JNIEnv *env, jclass sdClass,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                                         jobject icm)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    if (icm == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    return (*env)->GetBooleanField(env, icm, allGrayID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
static SurfaceDataOps *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
GetSDOps(JNIEnv *env, jobject sData, jboolean callSetup)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    SurfaceDataOps *ops;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    if (JNU_IsNull(env, sData)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        JNU_ThrowNullPointerException(env, "surfaceData");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    ops = (SurfaceDataOps *)JNU_GetLongFieldAsPtr(env, sData, pDataID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    if (ops == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        if (!(*env)->ExceptionOccurred(env) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            !(*env)->IsInstanceOf(env, sData, pNullSurfaceDataClass))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            if (!(*env)->GetBooleanField(env, sData, validID)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                SurfaceData_ThrowInvalidPipeException(env, "invalid data");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                JNU_ThrowNullPointerException(env, "native ops missing");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    } else if (callSetup) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        SurfaceData_InvokeSetup(env, ops);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    return ops;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
JNIEXPORT SurfaceDataOps * JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
SurfaceData_GetOps(JNIEnv *env, jobject sData)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    return GetSDOps(env, sData, JNI_TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
JNIEXPORT SurfaceDataOps * JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
SurfaceData_GetOpsNoSetup(JNIEnv *env, jobject sData)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    return GetSDOps(env, sData, JNI_FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
SurfaceData_SetOps(JNIEnv *env, jobject sData, SurfaceDataOps *ops)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    if (JNU_GetLongFieldAsPtr(env, sData, pDataID) == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        JNU_SetLongFieldFromPtr(env, sData, pDataID, ops);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        /* Register the data for disposal */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        Disposer_AddRecord(env, sData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                           SurfaceData_DisposeOps,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                           ptr_to_jlong(ops));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        JNU_ThrowInternalError(env, "Attempting to set SurfaceData ops twice");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
SurfaceData_ThrowInvalidPipeException(JNIEnv *env, const char *msg)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    (*env)->ThrowNew(env, pInvalidPipeClass, msg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
#define GETMIN(v1, v2)          (((v1) > (t=(v2))) && ((v1) = t))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
#define GETMAX(v1, v2)          (((v1) < (t=(v2))) && ((v1) = t))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
SurfaceData_IntersectBounds(SurfaceDataBounds *dst, SurfaceDataBounds *src)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    int t;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    GETMAX(dst->x1, src->x1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    GETMAX(dst->y1, src->y1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    GETMIN(dst->x2, src->x2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    GETMIN(dst->y2, src->y2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
SurfaceData_IntersectBoundsXYXY(SurfaceDataBounds *bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                                jint x1, jint y1, jint x2, jint y2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    int t;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    GETMAX(bounds->x1, x1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    GETMAX(bounds->y1, y1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    GETMIN(bounds->x2, x2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    GETMIN(bounds->y2, y2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
SurfaceData_IntersectBoundsXYWH(SurfaceDataBounds *bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                                jint x, jint y, jint w, jint h)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    w = (w <= 0) ? x : x+w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    if (w < x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        w = 0x7fffffff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    if (bounds->x1 < x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        bounds->x1 = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    if (bounds->x2 > w) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        bounds->x2 = w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    h = (h <= 0) ? y : y+h;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    if (h < y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        h = 0x7fffffff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    if (bounds->y1 < y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        bounds->y1 = y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    if (bounds->y2 > h) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        bounds->y2 = h;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
SurfaceData_IntersectBlitBounds(SurfaceDataBounds *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                                SurfaceDataBounds *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                                jint dx, jint dy)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    int t;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    GETMAX(dst->x1, src->x1 + dx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    GETMAX(dst->y1, src->y1 + dy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    GETMIN(dst->x2, src->x2 + dx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    GETMIN(dst->y2, src->y2 + dy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    GETMAX(src->x1, dst->x1 - dx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    GETMAX(src->y1, dst->y1 - dy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    GETMIN(src->x2, dst->x2 - dx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    GETMIN(src->y2, dst->y2 - dy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
49440
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
   237
JNIEXPORT SurfaceDataOps * JNICALL
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
   238
SurfaceData_InitOps(JNIEnv *env, jobject sData, int opsSize)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    SurfaceDataOps *ops = malloc(opsSize);
57196
a95707a39ff5 Description : Metal Rendering Pipeline - initial implementation of line and quad rendering
aghaisas
parents: 49440
diff changeset
   241
a95707a39ff5 Description : Metal Rendering Pipeline - initial implementation of line and quad rendering
aghaisas
parents: 49440
diff changeset
   242
    J2dTraceLn(J2D_TRACE_INFO, "SurfaceData_InitOps --- invoked ");
a95707a39ff5 Description : Metal Rendering Pipeline - initial implementation of line and quad rendering
aghaisas
parents: 49440
diff changeset
   243
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    SurfaceData_SetOps(env, sData, ops);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    if (ops != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        memset(ops, 0, opsSize);
20422
1a47790e7d9b 8025480: [parfait] "JNI exception pending" warnings from b107 for jdk.src.share.native.sun.java2d
jchen
parents: 12047
diff changeset
   247
        if (!(*env)->ExceptionCheck(env)) {
1a47790e7d9b 8025480: [parfait] "JNI exception pending" warnings from b107 for jdk.src.share.native.sun.java2d
jchen
parents: 12047
diff changeset
   248
            ops->sdObject = (*env)->NewWeakGlobalRef(env, sData);
1a47790e7d9b 8025480: [parfait] "JNI exception pending" warnings from b107 for jdk.src.share.native.sun.java2d
jchen
parents: 12047
diff changeset
   249
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    return ops;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
void SurfaceData_DisposeOps(JNIEnv *env, jlong ops)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    if (ops != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        SurfaceDataOps *sdops = (SurfaceDataOps*)jlong_to_ptr(ops);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        /* Invoke the ops-specific disposal function */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        SurfaceData_InvokeDispose(env, sdops);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        (*env)->DeleteWeakGlobalRef(env, sdops->sdObject);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        free(sdops);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
}