jdk/src/java.desktop/share/native/libawt/java2d/loops/DrawPolygons.c
author prr
Fri, 19 Sep 2014 09:41:05 -0700
changeset 26751 70bac69b37c9
parent 25859 jdk/src/java.desktop/share/native/libawt/sun/java2d/loops/DrawPolygons.c@3317bb8137f4
permissions -rw-r--r--
8056216: Remove "sun" directory layer from libawt and common Reviewed-by: erikj, ihse, coffeys
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 20421
diff changeset
     2
 * Copyright (c) 2000, 2013, 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 "jni_util.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "GraphicsPrimitiveMgr.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "LineUtils.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include "sun_java2d_loops_DrawPolygons.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
RefineBounds(SurfaceDataBounds *bounds, jint transX, jint transY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
             jint *xPointsPtr, jint *yPointsPtr, jint pointsNeeded)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
    jint xmin, ymin, xmax, ymax;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    if (pointsNeeded > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
        xmin = xmax = transX + *xPointsPtr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
        ymin = ymax = transY + *yPointsPtr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
        while (--pointsNeeded > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
            jint x = transX + *xPointsPtr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
            jint y = transY + *yPointsPtr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
            if (xmin > x) xmin = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
            if (ymin > y) ymin = y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
            if (xmax < x) xmax = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
            if (ymax < y) ymax = y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        if (++xmax < xmin) xmax--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        if (++ymax < ymin) ymax--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
        if (bounds->x1 < xmin) bounds->x1 = xmin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        if (bounds->y1 < ymin) bounds->y1 = ymin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        if (bounds->x2 > xmax) bounds->x2 = xmax;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        if (bounds->y2 > ymax) bounds->y2 = ymax;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
        bounds->x2 = bounds->x1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        bounds->y2 = bounds->y1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
ProcessPoly(SurfaceDataRasInfo *pRasInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
            DrawLineFunc *pLine,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
            NativePrimitive *pPrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
            CompositeInfo *pCompInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
            jint pixel, jint transX, jint transY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
            jint *xPointsPtr, jint *yPointsPtr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
            jint *nPointsPtr, jint numPolys,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
            jboolean close)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    for (i = 0; i < numPolys; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        jint numPts = nPointsPtr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        if (numPts > 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            jint x0, y0, x1, y1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            jboolean empty = JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
            x0 = x1 = transX + *xPointsPtr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            y0 = y1 = transY + *yPointsPtr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            while (--numPts > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                jint x2 = transX + *xPointsPtr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                jint y2 = transY + *yPointsPtr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                empty = (empty && x1 == x2 && y1 == y2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                LineUtils_ProcessLine(pRasInfo, pixel, pLine,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                                      pPrim, pCompInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                                      x1, y1, x2, y2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                                      (numPts > 1 || close));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                x1 = x2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                y1 = y2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            if (close && (empty || x1 != x0 || y1 != y0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                LineUtils_ProcessLine(pRasInfo, pixel, pLine,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                                      pPrim, pCompInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                                      x1, y1, x0, y0, !empty);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        } else if (numPts == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            xPointsPtr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            yPointsPtr++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * Class:     sun_java2d_loops_DrawPolygons
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * Method:    DrawPolygons
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * Signature: (Lsun/java2d/SunGraphics2D;Lsun/java2d/SurfaceData;[I[I[IIIIZ)V
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
Java_sun_java2d_loops_DrawPolygons_DrawPolygons
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    (JNIEnv *env, jobject self,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     jobject sg2d, jobject sData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     jintArray xPointsArray, jintArray yPointsArray,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     jintArray nPointsArray, jint numPolys,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     jint transX, jint transY, jboolean close)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    SurfaceDataOps *sdOps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    SurfaceDataRasInfo rasInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    NativePrimitive *pPrim;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    CompositeInfo compInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    jsize nPointsLen, xPointsLen, yPointsLen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    jint *nPointsPtr = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    jint *xPointsPtr = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    jint *yPointsPtr = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    jint pointsNeeded;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    jint i, ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    jboolean ok = JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    jint pixel = GrPrim_Sg2dGetPixel(env, sg2d);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    if (JNU_IsNull(env, xPointsArray) || JNU_IsNull(env, yPointsArray)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        JNU_ThrowNullPointerException(env, "coordinate array");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    if (JNU_IsNull(env, nPointsArray)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        JNU_ThrowNullPointerException(env, "polygon length array");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    nPointsLen = (*env)->GetArrayLength(env, nPointsArray);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    xPointsLen = (*env)->GetArrayLength(env, xPointsArray);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    yPointsLen = (*env)->GetArrayLength(env, yPointsArray);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    if (nPointsLen < numPolys) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        JNU_ThrowArrayIndexOutOfBoundsException(env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                                                "polygon length array size");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    pPrim = GetNativePrim(env, self);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    if (pPrim == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    if (pPrim->pCompType->getCompInfo != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        GrPrim_Sg2dGetCompInfo(env, sg2d, pPrim, &compInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    sdOps = SurfaceData_GetOps(env, sData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    if (sdOps == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    GrPrim_Sg2dGetClip(env, sg2d, &rasInfo.bounds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    ret = sdOps->Lock(env, sdOps, &rasInfo, SD_LOCK_FASTEST | pPrim->dstflags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    if (ret == SD_FAILURE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    nPointsPtr = (*env)->GetPrimitiveArrayCritical(env, nPointsArray, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    if (!nPointsPtr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    if (ok) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        pointsNeeded = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        for (i = 0; i < numPolys; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            if (nPointsPtr[i] > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                pointsNeeded += nPointsPtr[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        if (yPointsLen < pointsNeeded || xPointsLen < pointsNeeded) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            (*env)->ReleasePrimitiveArrayCritical(env, nPointsArray,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                                                  nPointsPtr, JNI_ABORT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            SurfaceData_InvokeUnlock(env, sdOps, &rasInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            JNU_ThrowArrayIndexOutOfBoundsException(env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                                                    "coordinate array length");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        xPointsPtr = (*env)->GetPrimitiveArrayCritical(env, xPointsArray, NULL);
20421
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 5506
diff changeset
   189
        if (!xPointsPtr) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        }
20421
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 5506
diff changeset
   192
        if (ok) {
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 5506
diff changeset
   193
            yPointsPtr = (*env)->GetPrimitiveArrayCritical(env, yPointsArray, NULL);
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 5506
diff changeset
   194
            if (!yPointsPtr) {
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 5506
diff changeset
   195
                ok = JNI_FALSE;
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 5506
diff changeset
   196
            }
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 5506
diff changeset
   197
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    if (ok) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        if (ret == SD_SLOWLOCK) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            RefineBounds(&rasInfo.bounds, transX, transY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                         xPointsPtr, yPointsPtr, pointsNeeded);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            ok = (rasInfo.bounds.x2 > rasInfo.bounds.x1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                  rasInfo.bounds.y2 > rasInfo.bounds.y1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    if (ok) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        sdOps->GetRasInfo(env, sdOps, &rasInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        if (rasInfo.rasBase &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            rasInfo.bounds.x2 > rasInfo.bounds.x1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            rasInfo.bounds.y2 > rasInfo.bounds.y1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            ProcessPoly(&rasInfo, pPrim->funcs.drawline, pPrim, &compInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                        pixel, transX, transY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                        xPointsPtr, yPointsPtr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                        nPointsPtr, numPolys,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                        close);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        SurfaceData_InvokeRelease(env, sdOps, &rasInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    if (nPointsPtr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        (*env)->ReleasePrimitiveArrayCritical(env, nPointsArray,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                                              nPointsPtr, JNI_ABORT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    if (xPointsPtr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        (*env)->ReleasePrimitiveArrayCritical(env, xPointsArray,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                                              xPointsPtr, JNI_ABORT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    if (yPointsPtr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        (*env)->ReleasePrimitiveArrayCritical(env, yPointsArray,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                                              yPointsPtr, JNI_ABORT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    SurfaceData_InvokeUnlock(env, sdOps, &rasInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
}