src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c
author ihse
Wed, 28 Mar 2018 23:56:08 +0200
changeset 49440 396ea30afbd5
parent 47216 71c04702a3d5
permissions -rw-r--r--
8200178: Remove mapfiles for JDK native libraries Reviewed-by: erikj, alanb, mchung, prr, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
49440
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
     2
 * Copyright (c) 2000, 2018, 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: 888
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: 888
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: 888
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 888
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 888
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
#include "jlong.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "sun_java2d_loops_GraphicsPrimitiveMgr.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include "Region.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "GraphicsPrimitiveMgr.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#include "AlphaMacros.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
static char *InitName = "<init>";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
static char *InitSig =  ("(JLsun/java2d/loops/SurfaceType;"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
                         "Lsun/java2d/loops/CompositeType;"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
                         "Lsun/java2d/loops/SurfaceType;)V");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
static char *RegisterName =     "register";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
static char *RegisterSig =      "([Lsun/java2d/loops/GraphicsPrimitive;)V";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
static jclass GraphicsPrimitiveMgr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
static jclass GraphicsPrimitive;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
static jmethodID RegisterID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
static jfieldID pNativePrimID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
static jfieldID pixelID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
static jfieldID eargbID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
static jfieldID clipRegionID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
static jfieldID compositeID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
static jfieldID lcdTextContrastID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
static jfieldID xorPixelID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
static jfieldID xorColorID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
static jfieldID alphaMaskID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
static jfieldID ruleID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
static jfieldID extraAlphaID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
static jfieldID m00ID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
static jfieldID m01ID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
static jfieldID m02ID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
static jfieldID m10ID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
static jfieldID m11ID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
static jfieldID m12ID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    66
static jmethodID getRgbID;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    67
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
static jboolean InitPrimTypes(JNIEnv *env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
static jboolean InitSurfaceTypes(JNIEnv *env, jclass SurfaceType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
static jboolean InitCompositeTypes(JNIEnv *env, jclass CompositeType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
49440
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
    72
JNIEXPORT jfieldID path2DTypesID;
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
    73
JNIEXPORT jfieldID path2DNumTypesID;
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
    74
JNIEXPORT jfieldID path2DWindingRuleID;
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
    75
JNIEXPORT jfieldID path2DFloatCoordsID;
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
    76
JNIEXPORT jfieldID sg2dStrokeHintID;
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
    77
JNIEXPORT jint sunHints_INTVAL_STROKE_PURE;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * Class:     sun_java2d_loops_GraphicsPrimitiveMgr
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * Method:    initIDs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * Signature: (Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)V
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    (JNIEnv *env, jclass GPMgr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     jclass GP, jclass ST, jclass CT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     jclass SG2D, jclass Color, jclass AT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     jclass XORComp, jclass AlphaComp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     jclass Path2D, jclass Path2DFloat,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     jclass SHints)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    jfieldID fid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    initAlphaTables();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    GraphicsPrimitiveMgr = (*env)->NewGlobalRef(env, GPMgr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    GraphicsPrimitive = (*env)->NewGlobalRef(env, GP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    if (GraphicsPrimitiveMgr == NULL || GraphicsPrimitive == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        JNU_ThrowOutOfMemoryError(env, "creating global refs");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    if (!InitPrimTypes(env) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        !InitSurfaceTypes(env, ST) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        !InitCompositeTypes(env, CT))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    }
40145
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   107
    CHECK_NULL(RegisterID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   108
        (*env)->GetStaticMethodID(env, GPMgr, RegisterName, RegisterSig));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   109
    CHECK_NULL(pNativePrimID = (*env)->GetFieldID(env, GP, "pNativePrim", "J"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   110
    CHECK_NULL(pixelID = (*env)->GetFieldID(env, SG2D, "pixel", "I"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   111
    CHECK_NULL(eargbID = (*env)->GetFieldID(env, SG2D, "eargb", "I"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   112
    CHECK_NULL(clipRegionID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   113
        (*env)->GetFieldID(env, SG2D, "clipRegion", "Lsun/java2d/pipe/Region;"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   114
    CHECK_NULL(compositeID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   115
        (*env)->GetFieldID(env, SG2D, "composite", "Ljava/awt/Composite;"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   116
    CHECK_NULL(lcdTextContrastID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   117
        (*env)->GetFieldID(env, SG2D, "lcdTextContrast", "I"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   118
    CHECK_NULL(getRgbID = (*env)->GetMethodID(env, Color, "getRGB", "()I"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   119
    CHECK_NULL(xorPixelID = (*env)->GetFieldID(env, XORComp, "xorPixel", "I"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   120
    CHECK_NULL(xorColorID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   121
        (*env)->GetFieldID(env, XORComp, "xorColor", "Ljava/awt/Color;"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   122
    CHECK_NULL(alphaMaskID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   123
        (*env)->GetFieldID(env, XORComp, "alphaMask", "I"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   124
    CHECK_NULL(ruleID = (*env)->GetFieldID(env, AlphaComp, "rule", "I"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   125
    CHECK_NULL(extraAlphaID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   126
        (*env)->GetFieldID(env, AlphaComp, "extraAlpha", "F"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
40145
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   129
    CHECK_NULL(m00ID = (*env)->GetFieldID(env, AT, "m00", "D"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   130
    CHECK_NULL(m01ID = (*env)->GetFieldID(env, AT, "m01", "D"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   131
    CHECK_NULL(m02ID = (*env)->GetFieldID(env, AT, "m02", "D"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   132
    CHECK_NULL(m10ID = (*env)->GetFieldID(env, AT, "m10", "D"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   133
    CHECK_NULL(m11ID = (*env)->GetFieldID(env, AT, "m11", "D"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   134
    CHECK_NULL(m12ID = (*env)->GetFieldID(env, AT, "m12", "D"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
40145
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   136
    CHECK_NULL(path2DTypesID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   137
        (*env)->GetFieldID(env, Path2D, "pointTypes", "[B"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   138
    CHECK_NULL(path2DNumTypesID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   139
        (*env)->GetFieldID(env, Path2D, "numTypes", "I"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   140
    CHECK_NULL(path2DWindingRuleID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   141
        (*env)->GetFieldID(env, Path2D, "windingRule", "I"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   142
    CHECK_NULL(path2DFloatCoordsID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   143
        (*env)->GetFieldID(env, Path2DFloat, "floatCoords", "[F"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   144
    CHECK_NULL(sg2dStrokeHintID =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   145
        (*env)->GetFieldID(env, SG2D, "strokeHint", "I"));
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   146
    CHECK_NULL(fid =
27daee4932fe 8161761: [parfait] 2 JNI exception pending defect groups in GraphicsPrimitiveMgr.c
vadim
parents: 26751
diff changeset
   147
        (*env)->GetStaticFieldID(env, SHints, "INTVAL_STROKE_PURE", "I"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    sunHints_INTVAL_STROKE_PURE = (*env)->GetStaticIntField(env, SHints, fid);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
void GrPrim_RefineBounds(SurfaceDataBounds *bounds, jint transX, jint transY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                         jfloat *coords,  jint maxCoords)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    jint xmin, ymin, xmax, ymax;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    if (maxCoords > 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        xmin = xmax = transX + (jint)(*coords++ + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        ymin = ymax = transY + (jint)(*coords++ + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        for (;maxCoords > 1; maxCoords -= 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            jint x = transX + (jint)(*coords++ + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            jint y = transY + (jint)(*coords++ + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            if (xmin > x) xmin = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            if (ymin > y) ymin = y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            if (xmax < x) xmax = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            if (ymax < y) ymax = y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        if (++xmax < xmin) xmax--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        if (++ymax < ymin) ymax--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        if (bounds->x1 < xmin) bounds->x1 = xmin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        if (bounds->y1 < ymin) bounds->y1 = ymin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        if (bounds->x2 > xmax) bounds->x2 = xmax;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        if (bounds->y2 > ymax) bounds->y2 = ymax;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        bounds->x2 = bounds->x1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        bounds->y2 = bounds->y1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    }
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
 * Class:     sun_java2d_loops_GraphicsPrimitiveMgr
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 * Method:    registerNativeLoops
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * Signature: ()V
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    (JNIEnv *env, jclass GPMgr)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    RegisterFunc RegisterAnyByte;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    RegisterFunc RegisterByteBinary1Bit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    RegisterFunc RegisterByteBinary2Bit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    RegisterFunc RegisterByteBinary4Bit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    RegisterFunc RegisterByteIndexed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    RegisterFunc RegisterByteGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    RegisterFunc RegisterIndex8Gray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    RegisterFunc RegisterIndex12Gray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    RegisterFunc RegisterAnyShort;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    RegisterFunc RegisterUshort555Rgb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    RegisterFunc RegisterUshort565Rgb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    RegisterFunc RegisterUshort4444Argb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    RegisterFunc RegisterUshort555Rgbx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    RegisterFunc RegisterUshortGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    RegisterFunc RegisterUshortIndexed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    RegisterFunc RegisterAny3Byte;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    RegisterFunc RegisterThreeByteBgr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    RegisterFunc RegisterAnyInt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    RegisterFunc RegisterIntArgb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    RegisterFunc RegisterIntArgbPre;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    RegisterFunc RegisterIntArgbBm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    RegisterFunc RegisterIntRgb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    RegisterFunc RegisterIntBgr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    RegisterFunc RegisterIntRgbx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    RegisterFunc RegisterAny4Byte;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    RegisterFunc RegisterFourByteAbgr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    RegisterFunc RegisterFourByteAbgrPre;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
20421
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   215
    if (!RegisterAnyByte(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   216
        !RegisterByteBinary1Bit(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   217
        !RegisterByteBinary2Bit(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   218
        !RegisterByteBinary4Bit(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   219
        !RegisterByteIndexed(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   220
        !RegisterByteGray(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   221
        !RegisterIndex8Gray(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   222
        !RegisterIndex12Gray(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   223
        !RegisterAnyShort(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   224
        !RegisterUshort555Rgb(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   225
        !RegisterUshort565Rgb(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   226
        !RegisterUshort4444Argb(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   227
        !RegisterUshort555Rgbx(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   228
        !RegisterUshortGray(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   229
        !RegisterUshortIndexed(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   230
        !RegisterAny3Byte(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   231
        !RegisterThreeByteBgr(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   232
        !RegisterAnyInt(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   233
        !RegisterIntArgb(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   234
        !RegisterIntArgbPre(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   235
        !RegisterIntArgbBm(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   236
        !RegisterIntRgb(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   237
        !RegisterIntBgr(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   238
        !RegisterIntRgbx(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   239
        !RegisterAny4Byte(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   240
        !RegisterFourByteAbgr(env) ||
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   241
        !RegisterFourByteAbgrPre(env))
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   242
    {
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   243
        return;
8fab9959a1bc 8025280: [parfait] warnings from b107 for jdk.src.share.native.sun.java2d.loops: JNI exception pending, JNI critical region violation
jchen
parents: 7668
diff changeset
   244
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
#define _StartOf(T)     ((T *) (&T##s))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
#define _NumberOf(T)    (sizeof(T##s) / sizeof(T))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
#define _EndOf(T)       (_StartOf(T) + _NumberOf(T))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
#define PrimTypeStart   _StartOf(PrimitiveType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
#define PrimTypeEnd     _EndOf(PrimitiveType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
#define SurfTypeStart   _StartOf(SurfaceType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
#define SurfTypeEnd     _EndOf(SurfaceType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
#define CompTypeStart   _StartOf(CompositeType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
#define CompTypeEnd     _EndOf(CompositeType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
 * This function initializes the global collection of PrimitiveType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
 * structures by retrieving the necessary Java Class object and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
 * associated methodID of the necessary constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
 * See PrimitiveTypes.* below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
static jboolean InitPrimTypes(JNIEnv *env)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    jboolean ok = JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    PrimitiveType *pPrimType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    jclass cl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    for (pPrimType = PrimTypeStart; pPrimType < PrimTypeEnd; pPrimType++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        cl = (*env)->FindClass(env, pPrimType->ClassName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        if (cl == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        pPrimType->ClassObject = (*env)->NewGlobalRef(env, cl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        pPrimType->Constructor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
            (*env)->GetMethodID(env, cl, InitName, InitSig);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        (*env)->DeleteLocalRef(env, cl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        if (pPrimType->ClassObject == NULL ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
            pPrimType->Constructor == NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    if (!ok) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        for (pPrimType = PrimTypeStart; pPrimType < PrimTypeEnd; pPrimType++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            if (pPrimType->ClassObject != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
                (*env)->DeleteGlobalRef(env, pPrimType->ClassObject);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                pPrimType->ClassObject = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            pPrimType->Constructor = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    return ok;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
 * This function initializes the global collection of SurfaceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
 * or CompositeType structures by retrieving the corresponding Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
 * object stored as a static field on the Java Class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
 * See SurfaceTypes.* below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
 * See CompositeeTypes.* below.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
static jboolean InitSimpleTypes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    (JNIEnv *env, jclass SimpleClass, char *SimpleSig,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     SurfCompHdr *pStart, SurfCompHdr *pEnd, jsize size)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    jboolean ok = JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    SurfCompHdr *pHdr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    jfieldID field;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    jobject obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    for (pHdr = pStart; pHdr < pEnd; pHdr = PtrAddBytes(pHdr, size)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        field = (*env)->GetStaticFieldID(env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                                         SimpleClass,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                                         pHdr->Name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                                         SimpleSig);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        if (field == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        obj = (*env)->GetStaticObjectField(env, SimpleClass, field);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
        if (obj == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        pHdr->Object = (*env)->NewGlobalRef(env, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
        (*env)->DeleteLocalRef(env, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        if (pHdr->Object == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    if (!ok) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        for (pHdr = pStart; pHdr < pEnd; pHdr = PtrAddBytes(pHdr, size)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            if (pHdr->Object != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
                (*env)->DeleteGlobalRef(env, pHdr->Object);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                pHdr->Object = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    return ok;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
static jboolean InitSurfaceTypes(JNIEnv *env, jclass ST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    return InitSimpleTypes(env, ST, "Lsun/java2d/loops/SurfaceType;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
                           (SurfCompHdr *) SurfTypeStart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
                           (SurfCompHdr *) SurfTypeEnd,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                           sizeof(SurfaceType));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
static jboolean InitCompositeTypes(JNIEnv *env, jclass CT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    return InitSimpleTypes(env, CT, "Lsun/java2d/loops/CompositeType;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
                           (SurfCompHdr *) CompTypeStart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                           (SurfCompHdr *) CompTypeEnd,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
                           sizeof(CompositeType));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
 * This function registers a set of Java GraphicsPrimitive objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
 * based on information stored in an array of NativePrimitive structures.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
jboolean RegisterPrimitives(JNIEnv *env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                            NativePrimitive *pPrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                            jint NumPrimitives)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    jarray primitives;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    primitives = (*env)->NewObjectArray(env, NumPrimitives,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                                        GraphicsPrimitive, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    if (primitives == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    for (i = 0; i < NumPrimitives; i++, pPrim++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        jint srcflags, dstflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        jobject prim;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        PrimitiveType *pType = pPrim->pPrimType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        SurfaceType *pSrc = pPrim->pSrcType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        CompositeType *pComp = pPrim->pCompType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        SurfaceType *pDst = pPrim->pDstType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        pPrim->funcs.initializer = MapAccelFunction(pPrim->funcs_c.initializer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
         * Calculate the necessary SurfaceData lock flags for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
         * source and destination surfaces based on the information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
         * stored in the PrimitiveType, SurfaceType, and CompositeType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
         * structures.  The starting point is the values that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
         * already stored in the NativePrimitive structure.  These
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
         * flags are usually left as 0, but can be filled in by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
         * native primitive loops that have special needs that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
         * not deducible from their declared attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        srcflags = pPrim->srcflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        dstflags = pPrim->dstflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        srcflags |= pType->srcflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        dstflags |= pType->dstflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        dstflags |= pComp->dstflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        if (srcflags & SD_LOCK_READ) srcflags |= pSrc->readflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        /* if (srcflags & SD_LOCK_WRITE) srcflags |= pSrc->writeflags; */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        if (dstflags & SD_LOCK_READ) dstflags |= pDst->readflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        if (dstflags & SD_LOCK_WRITE) dstflags |= pDst->writeflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        pPrim->srcflags = srcflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        pPrim->dstflags = dstflags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        prim = (*env)->NewObject(env,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
                                 pType->ClassObject,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
                                 pType->Constructor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
                                 ptr_to_jlong(pPrim),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                                 pSrc->hdr.Object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                                 pComp->hdr.Object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                                 pDst->hdr.Object);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        if (prim == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        (*env)->SetObjectArrayElement(env, primitives, i, prim);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        (*env)->DeleteLocalRef(env, prim);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        if ((*env)->ExceptionCheck(env)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    if (i >= NumPrimitives) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        /* No error - upcall to GraphicsPrimitiveMgr to register the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
         * new primitives... */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        (*env)->CallStaticVoidMethod(env, GraphicsPrimitiveMgr, RegisterID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                                     primitives);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
    (*env)->DeleteLocalRef(env, primitives);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    return !((*env)->ExceptionCheck(env));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
JNIEXPORT NativePrimitive * JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
GetNativePrim(JNIEnv *env, jobject gp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    NativePrimitive *pPrim;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    pPrim = (NativePrimitive *) JNU_GetLongFieldAsPtr(env, gp, pNativePrimID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    if (pPrim == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        JNU_ThrowInternalError(env, "Non-native Primitive invoked natively");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    return pPrim;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
GrPrim_Sg2dGetCompInfo(JNIEnv *env, jobject sg2d,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
                       NativePrimitive *pPrim, CompositeInfo *pCompInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
    jobject comp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
    comp = (*env)->GetObjectField(env, sg2d, compositeID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
    (*pPrim->pCompType->getCompInfo)(env, pCompInfo, comp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    (*env)->DeleteLocalRef(env, comp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
GrPrim_CompGetXorColor(JNIEnv *env, jobject comp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
    jobject color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    jint rgb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    color = (*env)->GetObjectField(env, comp, xorColorID);
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   480
    rgb = (*env)->CallIntMethod(env, color, getRgbID);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    (*env)->DeleteLocalRef(env, color);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    return rgb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
GrPrim_Sg2dGetClip(JNIEnv *env, jobject sg2d, SurfaceDataBounds *bounds)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    jobject clip = (*env)->GetObjectField(env, sg2d, clipRegionID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    Region_GetBounds(env, clip, bounds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
GrPrim_Sg2dGetPixel(JNIEnv *env, jobject sg2d)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    return (*env)->GetIntField(env, sg2d, pixelID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
GrPrim_Sg2dGetEaRGB(JNIEnv *env, jobject sg2d)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    return (*env)->GetIntField(env, sg2d, eargbID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
JNIEXPORT jint JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
GrPrim_Sg2dGetLCDTextContrast(JNIEnv *env, jobject sg2d)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    return (*env)->GetIntField(env, sg2d, lcdTextContrastID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
 * Helper function for CompositeTypes.Xor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
GrPrim_CompGetXorInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
    pCompInfo->rule = RULE_Xor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
    pCompInfo->details.xorPixel = (*env)->GetIntField(env, comp, xorPixelID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    pCompInfo->alphaMask = (*env)->GetIntField(env, comp, alphaMaskID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
 * Helper function for CompositeTypes.AnyAlpha
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
GrPrim_CompGetAlphaInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
    pCompInfo->rule =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        (*env)->GetIntField(env, comp, ruleID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
    pCompInfo->details.extraAlpha =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        (*env)->GetFloatField(env, comp, extraAlphaID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
Transform_GetInfo(JNIEnv *env, jobject txform, TransformInfo *pTxInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
    pTxInfo->dxdx = (*env)->GetDoubleField(env, txform, m00ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
    pTxInfo->dxdy = (*env)->GetDoubleField(env, txform, m01ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    pTxInfo->tx   = (*env)->GetDoubleField(env, txform, m02ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    pTxInfo->dydx = (*env)->GetDoubleField(env, txform, m10ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    pTxInfo->dydy = (*env)->GetDoubleField(env, txform, m11ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    pTxInfo->ty   = (*env)->GetDoubleField(env, txform, m12ID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
Transform_transform(TransformInfo *pTxInfo, jdouble *pX, jdouble *pY)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
    jdouble x = *pX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
    jdouble y = *pY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    *pX = pTxInfo->dxdx * x + pTxInfo->dxdy * y + pTxInfo->tx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    *pY = pTxInfo->dydx * x + pTxInfo->dydy * y + pTxInfo->ty;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
 * External declarations for the pixelFor helper methods for the various
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
 * named surface types.  These functions are defined in the various
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
 * files that contain the loop functions for their type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
extern PixelForFunc PixelForByteBinary;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
extern PixelForFunc PixelForByteIndexed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
extern PixelForFunc PixelForByteGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
extern PixelForFunc PixelForIndex8Gray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
extern PixelForFunc PixelForIndex12Gray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
extern PixelForFunc PixelForUshort555Rgb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
extern PixelForFunc PixelForUshort555Rgbx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
extern PixelForFunc PixelForUshort565Rgb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
extern PixelForFunc PixelForUshort4444Argb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
extern PixelForFunc PixelForUshortGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
extern PixelForFunc PixelForUshortIndexed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
extern PixelForFunc PixelForIntArgbPre;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
extern PixelForFunc PixelForIntArgbBm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
extern PixelForFunc PixelForIntBgr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
extern PixelForFunc PixelForIntRgbx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
extern PixelForFunc PixelForFourByteAbgr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
extern PixelForFunc PixelForFourByteAbgrPre;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
 * Definition and initialization of the globally accessible PrimitiveTypes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
struct _PrimitiveTypes PrimitiveTypes = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
    { "sun/java2d/loops/Blit", SD_LOCK_READ, SD_LOCK_WRITE, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
    { "sun/java2d/loops/BlitBg", SD_LOCK_READ, SD_LOCK_WRITE, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
    { "sun/java2d/loops/ScaledBlit", SD_LOCK_READ, SD_LOCK_WRITE, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
    { "sun/java2d/loops/FillRect", 0, SD_LOCK_WRITE, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    { "sun/java2d/loops/FillSpans", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
7487
9b031d062ede 6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents: 5506
diff changeset
   587
    { "sun/java2d/loops/FillParallelogram", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
9b031d062ede 6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents: 5506
diff changeset
   588
    { "sun/java2d/loops/DrawParallelogram", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
    { "sun/java2d/loops/DrawLine", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
    { "sun/java2d/loops/DrawRect", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
    { "sun/java2d/loops/DrawPolygons", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    { "sun/java2d/loops/DrawPath", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
    { "sun/java2d/loops/FillPath", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
    { "sun/java2d/loops/MaskBlit", SD_LOCK_READ, SD_LOCK_RD_WR, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
    { "sun/java2d/loops/MaskFill", 0, SD_LOCK_RD_WR, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
    { "sun/java2d/loops/DrawGlyphList", 0, SD_LOCK_PARTIAL_WRITE |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
                                           SD_LOCK_FASTEST, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
    { "sun/java2d/loops/DrawGlyphListAA", 0, SD_LOCK_RD_WR | SD_LOCK_FASTEST, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
    { "sun/java2d/loops/DrawGlyphListLCD", 0, SD_LOCK_RD_WR | SD_LOCK_FASTEST, NULL, NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
    { "sun/java2d/loops/TransformHelper", SD_LOCK_READ, 0, NULL, NULL}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
 * Definition and initialization of the globally accessible SurfaceTypes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
struct _SurfaceTypes SurfaceTypes = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
    { { "OpaqueColor", NULL}, NULL, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
    { { "AnyColor", NULL}, NULL, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
    { { "AnyByte", NULL}, NULL, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
    { { "ByteBinary1Bit", NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
      PixelForByteBinary, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
    { { "ByteBinary2Bit", NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
      PixelForByteBinary, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
    { { "ByteBinary4Bit", NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
      PixelForByteBinary, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
    { { "ByteIndexed", NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
      PixelForByteIndexed, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
    { { "ByteIndexedBm", NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
      PixelForByteIndexed, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    { { "ByteGray", NULL}, PixelForByteGray, 0, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
    { { "Index8Gray", NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
      PixelForIndex8Gray, SD_LOCK_LUT, SD_LOCK_INVGRAY },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
    { { "Index12Gray", NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
      PixelForIndex12Gray, SD_LOCK_LUT, SD_LOCK_INVGRAY },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
    { { "AnyShort", NULL}, NULL, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
    { { "Ushort555Rgb", NULL}, PixelForUshort555Rgb, 0, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    { { "Ushort555Rgbx", NULL}, PixelForUshort555Rgbx, 0, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
    { { "Ushort565Rgb", NULL}, PixelForUshort565Rgb, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
    { { "Ushort4444Argb", NULL}, PixelForUshort4444Argb, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
    { { "UshortGray", NULL}, PixelForUshortGray, 0, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    { { "UshortIndexed", NULL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
      PixelForUshortIndexed, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
    { { "Any3Byte", NULL},  NULL, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
    { { "ThreeByteBgr", NULL},  NULL, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
    { { "AnyInt", NULL}, NULL, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
    { { "IntArgb", NULL},  NULL, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
    { { "IntArgbPre", NULL}, PixelForIntArgbPre, 0, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
    { { "IntArgbBm", NULL}, PixelForIntArgbBm, 0, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    { { "IntRgb", NULL},  NULL, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
    { { "IntBgr", NULL}, PixelForIntBgr, 0, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
    { { "IntRgbx", NULL}, PixelForIntRgbx, 0, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
    { { "Any4Byte", NULL},  NULL, 0, 0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
    { { "FourByteAbgr", NULL}, PixelForFourByteAbgr, 0, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
    { { "FourByteAbgrPre", NULL}, PixelForFourByteAbgrPre, 0, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
 * Definition and initialization of the globally accessible CompositeTypes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
struct _CompositeTypes CompositeTypes = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
    { { "SrcNoEa", NULL}, NULL, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
    { { "SrcOverNoEa", NULL}, NULL, SD_LOCK_RD_WR },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
    { { "SrcOverNoEa", NULL}, NULL, SD_LOCK_PARTIAL_WRITE }, /* SrcOverBmNoEa */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    { { "Src", NULL}, GrPrim_CompGetAlphaInfo, 0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
    { { "SrcOver", NULL}, GrPrim_CompGetAlphaInfo, SD_LOCK_RD_WR },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
    { { "Xor", NULL}, GrPrim_CompGetXorInfo, SD_LOCK_RD_WR },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
    { { "AnyAlpha", NULL}, GrPrim_CompGetAlphaInfo, SD_LOCK_RD_WR },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
};