0N/A/*
3261N/A * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A#include "jni_util.h"
0N/A#include "jlong.h"
0N/A
0N/A#include "sun_java2d_loops_GraphicsPrimitiveMgr.h"
0N/A
0N/A#include "Region.h"
0N/A#include "GraphicsPrimitiveMgr.h"
0N/A#include "AlphaMacros.h"
0N/A
0N/Astatic char *InitName = "<init>";
0N/Astatic char *InitSig = ("(JLsun/java2d/loops/SurfaceType;"
0N/A "Lsun/java2d/loops/CompositeType;"
0N/A "Lsun/java2d/loops/SurfaceType;)V");
0N/A
0N/Astatic char *RegisterName = "register";
0N/Astatic char *RegisterSig = "([Lsun/java2d/loops/GraphicsPrimitive;)V";
0N/A
0N/Astatic jclass GraphicsPrimitiveMgr;
0N/Astatic jclass GraphicsPrimitive;
0N/A
0N/Astatic jmethodID RegisterID;
0N/Astatic jfieldID pNativePrimID;
0N/Astatic jfieldID pixelID;
0N/Astatic jfieldID eargbID;
0N/Astatic jfieldID clipRegionID;
0N/Astatic jfieldID compositeID;
0N/Astatic jfieldID lcdTextContrastID;
0N/Astatic jfieldID xorPixelID;
0N/Astatic jfieldID xorColorID;
0N/Astatic jfieldID alphaMaskID;
0N/Astatic jfieldID ruleID;
0N/Astatic jfieldID extraAlphaID;
0N/A
0N/Astatic jfieldID m00ID;
0N/Astatic jfieldID m01ID;
0N/Astatic jfieldID m02ID;
0N/Astatic jfieldID m10ID;
0N/Astatic jfieldID m11ID;
0N/Astatic jfieldID m12ID;
0N/A
430N/Astatic jmethodID getRgbID;
430N/A
0N/Astatic jboolean InitPrimTypes(JNIEnv *env);
0N/Astatic jboolean InitSurfaceTypes(JNIEnv *env, jclass SurfaceType);
0N/Astatic jboolean InitCompositeTypes(JNIEnv *env, jclass CompositeType);
0N/A
0N/AjfieldID path2DTypesID;
0N/AjfieldID path2DNumTypesID;
0N/AjfieldID path2DWindingRuleID;
0N/AjfieldID path2DFloatCoordsID;
0N/AjfieldID sg2dStrokeHintID;
0N/Ajint sunHints_INTVAL_STROKE_PURE;
0N/A
0N/A/*
0N/A * Class: sun_java2d_loops_GraphicsPrimitiveMgr
0N/A * Method: initIDs
0N/A * Signature: (Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;)V
0N/A */
0N/AJNIEXPORT void JNICALL
0N/AJava_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs
0N/A (JNIEnv *env, jclass GPMgr,
0N/A jclass GP, jclass ST, jclass CT,
0N/A jclass SG2D, jclass Color, jclass AT,
0N/A jclass XORComp, jclass AlphaComp,
0N/A jclass Path2D, jclass Path2DFloat,
0N/A jclass SHints)
0N/A{
0N/A jfieldID fid;
0N/A initAlphaTables();
0N/A GraphicsPrimitiveMgr = (*env)->NewGlobalRef(env, GPMgr);
0N/A GraphicsPrimitive = (*env)->NewGlobalRef(env, GP);
0N/A if (GraphicsPrimitiveMgr == NULL || GraphicsPrimitive == NULL) {
0N/A JNU_ThrowOutOfMemoryError(env, "creating global refs");
0N/A return;
0N/A }
0N/A if (!InitPrimTypes(env) ||
0N/A !InitSurfaceTypes(env, ST) ||
0N/A !InitCompositeTypes(env, CT))
0N/A {
0N/A return;
0N/A }
0N/A RegisterID = (*env)->GetStaticMethodID(env, GPMgr,
0N/A RegisterName, RegisterSig);
0N/A pNativePrimID = (*env)->GetFieldID(env, GP, "pNativePrim", "J");
0N/A pixelID = (*env)->GetFieldID(env, SG2D, "pixel", "I");
0N/A eargbID = (*env)->GetFieldID(env, SG2D, "eargb", "I");
0N/A clipRegionID = (*env)->GetFieldID(env, SG2D, "clipRegion",
0N/A "Lsun/java2d/pipe/Region;");
0N/A compositeID = (*env)->GetFieldID(env, SG2D, "composite",
0N/A "Ljava/awt/Composite;");
0N/A lcdTextContrastID =
0N/A (*env)->GetFieldID(env, SG2D, "lcdTextContrast", "I");
430N/A getRgbID = (*env)->GetMethodID(env, Color, "getRGB", "()I");
0N/A xorPixelID = (*env)->GetFieldID(env, XORComp, "xorPixel", "I");
0N/A xorColorID = (*env)->GetFieldID(env, XORComp, "xorColor",
0N/A "Ljava/awt/Color;");
0N/A alphaMaskID = (*env)->GetFieldID(env, XORComp, "alphaMask", "I");
0N/A ruleID = (*env)->GetFieldID(env, AlphaComp, "rule", "I");
0N/A extraAlphaID = (*env)->GetFieldID(env, AlphaComp, "extraAlpha", "F");
0N/A
0N/A
0N/A m00ID = (*env)->GetFieldID(env, AT, "m00", "D");
0N/A m01ID = (*env)->GetFieldID(env, AT, "m01", "D");
0N/A m02ID = (*env)->GetFieldID(env, AT, "m02", "D");
0N/A m10ID = (*env)->GetFieldID(env, AT, "m10", "D");
0N/A m11ID = (*env)->GetFieldID(env, AT, "m11", "D");
0N/A m12ID = (*env)->GetFieldID(env, AT, "m12", "D");
0N/A
0N/A path2DTypesID = (*env)->GetFieldID(env, Path2D, "pointTypes", "[B");
0N/A path2DNumTypesID = (*env)->GetFieldID(env, Path2D, "numTypes", "I");
0N/A path2DWindingRuleID = (*env)->GetFieldID(env, Path2D, "windingRule", "I");
0N/A path2DFloatCoordsID = (*env)->GetFieldID(env, Path2DFloat,
0N/A "floatCoords", "[F");
0N/A sg2dStrokeHintID = (*env)->GetFieldID(env, SG2D, "strokeHint", "I");
0N/A fid = (*env)->GetStaticFieldID(env, SHints, "INTVAL_STROKE_PURE", "I");
0N/A sunHints_INTVAL_STROKE_PURE = (*env)->GetStaticIntField(env, SHints, fid);
0N/A}
0N/A
0N/Avoid GrPrim_RefineBounds(SurfaceDataBounds *bounds, jint transX, jint transY,
0N/A jfloat *coords, jint maxCoords)
0N/A{
0N/A jint xmin, ymin, xmax, ymax;
0N/A if (maxCoords > 1) {
0N/A xmin = xmax = transX + (jint)(*coords++ + 0.5);
0N/A ymin = ymax = transY + (jint)(*coords++ + 0.5);
0N/A for (;maxCoords > 1; maxCoords -= 2) {
0N/A jint x = transX + (jint)(*coords++ + 0.5);
0N/A jint y = transY + (jint)(*coords++ + 0.5);
0N/A if (xmin > x) xmin = x;
0N/A if (ymin > y) ymin = y;
0N/A if (xmax < x) xmax = x;
0N/A if (ymax < y) ymax = y;
0N/A }
0N/A if (++xmax < xmin) xmax--;
0N/A if (++ymax < ymin) ymax--;
0N/A if (bounds->x1 < xmin) bounds->x1 = xmin;
0N/A if (bounds->y1 < ymin) bounds->y1 = ymin;
0N/A if (bounds->x2 > xmax) bounds->x2 = xmax;
0N/A if (bounds->y2 > ymax) bounds->y2 = ymax;
0N/A } else {
0N/A bounds->x2 = bounds->x1;
0N/A bounds->y2 = bounds->y1;
0N/A }
0N/A}
0N/A
0N/A/*
0N/A * Class: sun_java2d_loops_GraphicsPrimitiveMgr
0N/A * Method: registerNativeLoops
0N/A * Signature: ()V
0N/A */
0N/AJNIEXPORT void JNICALL
0N/AJava_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops
0N/A (JNIEnv *env, jclass GPMgr)
0N/A{
0N/A RegisterFunc RegisterAnyByte;
0N/A RegisterFunc RegisterByteBinary1Bit;
0N/A RegisterFunc RegisterByteBinary2Bit;
0N/A RegisterFunc RegisterByteBinary4Bit;
0N/A RegisterFunc RegisterByteIndexed;
0N/A RegisterFunc RegisterByteGray;
0N/A RegisterFunc RegisterIndex8Gray;
0N/A RegisterFunc RegisterIndex12Gray;
0N/A RegisterFunc RegisterAnyShort;
0N/A RegisterFunc RegisterUshort555Rgb;
0N/A RegisterFunc RegisterUshort565Rgb;
0N/A RegisterFunc RegisterUshort4444Argb;
0N/A RegisterFunc RegisterUshort555Rgbx;
0N/A RegisterFunc RegisterUshortGray;
0N/A RegisterFunc RegisterUshortIndexed;
0N/A RegisterFunc RegisterAny3Byte;
0N/A RegisterFunc RegisterThreeByteBgr;
0N/A RegisterFunc RegisterAnyInt;
0N/A RegisterFunc RegisterIntArgb;
0N/A RegisterFunc RegisterIntArgbPre;
0N/A RegisterFunc RegisterIntArgbBm;
0N/A RegisterFunc RegisterIntRgb;
0N/A RegisterFunc RegisterIntBgr;
0N/A RegisterFunc RegisterIntRgbx;
0N/A RegisterFunc RegisterAny4Byte;
0N/A RegisterFunc RegisterFourByteAbgr;
0N/A RegisterFunc RegisterFourByteAbgrPre;
0N/A
0N/A RegisterAnyByte(env);
0N/A RegisterByteBinary1Bit(env);
0N/A RegisterByteBinary2Bit(env);
0N/A RegisterByteBinary4Bit(env);
0N/A RegisterByteIndexed(env);
0N/A RegisterByteGray(env);
0N/A RegisterIndex8Gray(env);
0N/A RegisterIndex12Gray(env);
0N/A RegisterAnyShort(env);
0N/A RegisterUshort555Rgb(env);
0N/A RegisterUshort565Rgb(env);
0N/A RegisterUshort4444Argb(env);
0N/A RegisterUshort555Rgbx(env);
0N/A RegisterUshortGray(env);
0N/A RegisterUshortIndexed(env);
0N/A RegisterAny3Byte(env);
0N/A RegisterThreeByteBgr(env);
0N/A RegisterAnyInt(env);
0N/A RegisterIntArgb(env);
0N/A RegisterIntArgbPre(env);
0N/A RegisterIntArgbBm(env);
0N/A RegisterIntRgb(env);
0N/A RegisterIntBgr(env);
0N/A RegisterIntRgbx(env);
0N/A RegisterAny4Byte(env);
0N/A RegisterFourByteAbgr(env);
0N/A RegisterFourByteAbgrPre(env);
0N/A}
0N/A
0N/A#define _StartOf(T) ((T *) (&T##s))
0N/A#define _NumberOf(T) (sizeof(T##s) / sizeof(T))
0N/A#define _EndOf(T) (_StartOf(T) + _NumberOf(T))
0N/A
0N/A#define PrimTypeStart _StartOf(PrimitiveType)
0N/A#define PrimTypeEnd _EndOf(PrimitiveType)
0N/A
0N/A#define SurfTypeStart _StartOf(SurfaceType)
0N/A#define SurfTypeEnd _EndOf(SurfaceType)
0N/A
0N/A#define CompTypeStart _StartOf(CompositeType)
0N/A#define CompTypeEnd _EndOf(CompositeType)
0N/A
0N/A/*
0N/A * This function initializes the global collection of PrimitiveType
0N/A * structures by retrieving the necessary Java Class object and the
0N/A * associated methodID of the necessary constructor.
0N/A *
0N/A * See PrimitiveTypes.* below.
0N/A */
0N/Astatic jboolean InitPrimTypes(JNIEnv *env)
0N/A{
0N/A jboolean ok = JNI_TRUE;
0N/A PrimitiveType *pPrimType;
0N/A jclass cl;
0N/A
0N/A for (pPrimType = PrimTypeStart; pPrimType < PrimTypeEnd; pPrimType++) {
0N/A cl = (*env)->FindClass(env, pPrimType->ClassName);
0N/A if (cl == NULL) {
0N/A ok = JNI_FALSE;
0N/A break;
0N/A }
0N/A pPrimType->ClassObject = (*env)->NewGlobalRef(env, cl);
0N/A pPrimType->Constructor =
0N/A (*env)->GetMethodID(env, cl, InitName, InitSig);
0N/A
0N/A (*env)->DeleteLocalRef(env, cl);
0N/A if (pPrimType->ClassObject == NULL ||
0N/A pPrimType->Constructor == NULL)
0N/A {
0N/A ok = JNI_FALSE;
0N/A break;
0N/A }
0N/A }
0N/A
0N/A if (!ok) {
0N/A for (pPrimType = PrimTypeStart; pPrimType < PrimTypeEnd; pPrimType++) {
0N/A if (pPrimType->ClassObject != NULL) {
0N/A (*env)->DeleteGlobalRef(env, pPrimType->ClassObject);
0N/A pPrimType->ClassObject = NULL;
0N/A }
0N/A pPrimType->Constructor = NULL;
0N/A }
0N/A }
0N/A
0N/A return ok;
0N/A}
0N/A
0N/A/*
0N/A * This function initializes the global collection of SurfaceType
0N/A * or CompositeType structures by retrieving the corresponding Java
0N/A * object stored as a static field on the Java Class.
0N/A *
0N/A * See SurfaceTypes.* below.
0N/A * See CompositeeTypes.* below.
0N/A */
0N/Astatic jboolean InitSimpleTypes
0N/A (JNIEnv *env, jclass SimpleClass, char *SimpleSig,
0N/A SurfCompHdr *pStart, SurfCompHdr *pEnd, jsize size)
0N/A{
0N/A jboolean ok = JNI_TRUE;
0N/A SurfCompHdr *pHdr;
0N/A jfieldID field;
0N/A jobject obj;
0N/A
0N/A for (pHdr = pStart; pHdr < pEnd; pHdr = PtrAddBytes(pHdr, size)) {
0N/A field = (*env)->GetStaticFieldID(env,
0N/A SimpleClass,
0N/A pHdr->Name,
0N/A SimpleSig);
0N/A if (field == NULL) {
0N/A ok = JNI_FALSE;
0N/A break;
0N/A }
0N/A obj = (*env)->GetStaticObjectField(env, SimpleClass, field);
0N/A if (obj == NULL) {
0N/A ok = JNI_FALSE;
0N/A break;
0N/A }
0N/A pHdr->Object = (*env)->NewGlobalRef(env, obj);
0N/A (*env)->DeleteLocalRef(env, obj);
0N/A if (pHdr->Object == NULL) {
0N/A ok = JNI_FALSE;
0N/A break;
0N/A }
0N/A }
0N/A
0N/A if (!ok) {
0N/A for (pHdr = pStart; pHdr < pEnd; pHdr = PtrAddBytes(pHdr, size)) {
0N/A if (pHdr->Object != NULL) {
0N/A (*env)->DeleteGlobalRef(env, pHdr->Object);
0N/A pHdr->Object = NULL;
0N/A }
0N/A }
0N/A }
0N/A
0N/A return ok;
0N/A}
0N/A
0N/Astatic jboolean InitSurfaceTypes(JNIEnv *env, jclass ST)
0N/A{
0N/A return InitSimpleTypes(env, ST, "Lsun/java2d/loops/SurfaceType;",
0N/A (SurfCompHdr *) SurfTypeStart,
0N/A (SurfCompHdr *) SurfTypeEnd,
0N/A sizeof(SurfaceType));
0N/A}
0N/A
0N/Astatic jboolean InitCompositeTypes(JNIEnv *env, jclass CT)
0N/A{
0N/A return InitSimpleTypes(env, CT, "Lsun/java2d/loops/CompositeType;",
0N/A (SurfCompHdr *) CompTypeStart,
0N/A (SurfCompHdr *) CompTypeEnd,
0N/A sizeof(CompositeType));
0N/A}
0N/A
0N/A/*
0N/A * This function registers a set of Java GraphicsPrimitive objects
0N/A * based on information stored in an array of NativePrimitive structures.
0N/A */
0N/Ajboolean RegisterPrimitives(JNIEnv *env,
0N/A NativePrimitive *pPrim,
0N/A jint NumPrimitives)
0N/A{
0N/A jarray primitives;
0N/A int i;
0N/A
0N/A primitives = (*env)->NewObjectArray(env, NumPrimitives,
0N/A GraphicsPrimitive, NULL);
0N/A if (primitives == NULL) {
0N/A return JNI_FALSE;
0N/A }
0N/A
0N/A for (i = 0; i < NumPrimitives; i++, pPrim++) {
0N/A jint srcflags, dstflags;
0N/A jobject prim;
0N/A PrimitiveType *pType = pPrim->pPrimType;
0N/A SurfaceType *pSrc = pPrim->pSrcType;
0N/A CompositeType *pComp = pPrim->pCompType;
0N/A SurfaceType *pDst = pPrim->pDstType;
0N/A
0N/A pPrim->funcs.initializer = MapAccelFunction(pPrim->funcs_c.initializer);
0N/A
0N/A /*
0N/A * Calculate the necessary SurfaceData lock flags for the
0N/A * source and destination surfaces based on the information
0N/A * stored in the PrimitiveType, SurfaceType, and CompositeType
0N/A * structures. The starting point is the values that are
0N/A * already stored in the NativePrimitive structure. These
0N/A * flags are usually left as 0, but can be filled in by
0N/A * native primitive loops that have special needs that are
0N/A * not deducible from their declared attributes.
0N/A */
0N/A srcflags = pPrim->srcflags;
0N/A dstflags = pPrim->dstflags;
0N/A srcflags |= pType->srcflags;
0N/A dstflags |= pType->dstflags;
0N/A dstflags |= pComp->dstflags;
0N/A if (srcflags & SD_LOCK_READ) srcflags |= pSrc->readflags;
0N/A /* if (srcflags & SD_LOCK_WRITE) srcflags |= pSrc->writeflags; */
0N/A if (dstflags & SD_LOCK_READ) dstflags |= pDst->readflags;
0N/A if (dstflags & SD_LOCK_WRITE) dstflags |= pDst->writeflags;
0N/A pPrim->srcflags = srcflags;
0N/A pPrim->dstflags = dstflags;
0N/A
0N/A prim = (*env)->NewObject(env,
0N/A pType->ClassObject,
0N/A pType->Constructor,
0N/A ptr_to_jlong(pPrim),
0N/A pSrc->hdr.Object,
0N/A pComp->hdr.Object,
0N/A pDst->hdr.Object);
0N/A if (prim == NULL) {
0N/A break;
0N/A }
0N/A (*env)->SetObjectArrayElement(env, primitives, i, prim);
0N/A (*env)->DeleteLocalRef(env, prim);
0N/A if ((*env)->ExceptionCheck(env)) {
0N/A break;
0N/A }
0N/A }
0N/A
0N/A if (i >= NumPrimitives) {
0N/A /* No error - upcall to GraphicsPrimitiveMgr to register the
0N/A * new primitives... */
0N/A (*env)->CallStaticVoidMethod(env, GraphicsPrimitiveMgr, RegisterID,
0N/A primitives);
0N/A }
0N/A (*env)->DeleteLocalRef(env, primitives);
0N/A
0N/A return !((*env)->ExceptionCheck(env));
0N/A}
0N/A
0N/AJNIEXPORT NativePrimitive * JNICALL
0N/AGetNativePrim(JNIEnv *env, jobject gp)
0N/A{
0N/A NativePrimitive *pPrim;
0N/A
0N/A pPrim = (NativePrimitive *) JNU_GetLongFieldAsPtr(env, gp, pNativePrimID);
0N/A if (pPrim == NULL) {
0N/A JNU_ThrowInternalError(env, "Non-native Primitive invoked natively");
0N/A }
0N/A
0N/A return pPrim;
0N/A}
0N/A
0N/AJNIEXPORT void JNICALL
0N/AGrPrim_Sg2dGetCompInfo(JNIEnv *env, jobject sg2d,
0N/A NativePrimitive *pPrim, CompositeInfo *pCompInfo)
0N/A{
0N/A jobject comp;
0N/A
0N/A comp = (*env)->GetObjectField(env, sg2d, compositeID);
0N/A (*pPrim->pCompType->getCompInfo)(env, pCompInfo, comp);
0N/A (*env)->DeleteLocalRef(env, comp);
0N/A}
0N/A
0N/AJNIEXPORT jint JNICALL
0N/AGrPrim_CompGetXorColor(JNIEnv *env, jobject comp)
0N/A{
0N/A jobject color;
0N/A jint rgb;
0N/A
0N/A color = (*env)->GetObjectField(env, comp, xorColorID);
430N/A rgb = (*env)->CallIntMethod(env, color, getRgbID);
0N/A (*env)->DeleteLocalRef(env, color);
0N/A
0N/A return rgb;
0N/A}
0N/A
0N/AJNIEXPORT void JNICALL
0N/AGrPrim_Sg2dGetClip(JNIEnv *env, jobject sg2d, SurfaceDataBounds *bounds)
0N/A{
0N/A jobject clip = (*env)->GetObjectField(env, sg2d, clipRegionID);
0N/A Region_GetBounds(env, clip, bounds);
0N/A}
0N/A
0N/AJNIEXPORT jint JNICALL
0N/AGrPrim_Sg2dGetPixel(JNIEnv *env, jobject sg2d)
0N/A{
0N/A return (*env)->GetIntField(env, sg2d, pixelID);
0N/A}
0N/A
0N/AJNIEXPORT jint JNICALL
0N/AGrPrim_Sg2dGetEaRGB(JNIEnv *env, jobject sg2d)
0N/A{
0N/A return (*env)->GetIntField(env, sg2d, eargbID);
0N/A}
0N/A
0N/AJNIEXPORT jint JNICALL
0N/AGrPrim_Sg2dGetLCDTextContrast(JNIEnv *env, jobject sg2d)
0N/A{
0N/A return (*env)->GetIntField(env, sg2d, lcdTextContrastID);
0N/A}
0N/A
0N/A/*
0N/A * Helper function for CompositeTypes.Xor
0N/A */
0N/AJNIEXPORT void JNICALL
0N/AGrPrim_CompGetXorInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp)
0N/A{
0N/A pCompInfo->rule = RULE_Xor;
0N/A pCompInfo->details.xorPixel = (*env)->GetIntField(env, comp, xorPixelID);
0N/A pCompInfo->alphaMask = (*env)->GetIntField(env, comp, alphaMaskID);
0N/A}
0N/A
0N/A/*
0N/A * Helper function for CompositeTypes.AnyAlpha
0N/A */
0N/AJNIEXPORT void JNICALL
0N/AGrPrim_CompGetAlphaInfo(JNIEnv *env, CompositeInfo *pCompInfo, jobject comp)
0N/A{
0N/A pCompInfo->rule =
0N/A (*env)->GetIntField(env, comp, ruleID);
0N/A pCompInfo->details.extraAlpha =
0N/A (*env)->GetFloatField(env, comp, extraAlphaID);
0N/A}
0N/A
0N/AJNIEXPORT void JNICALL
0N/ATransform_GetInfo(JNIEnv *env, jobject txform, TransformInfo *pTxInfo)
0N/A{
0N/A pTxInfo->dxdx = (*env)->GetDoubleField(env, txform, m00ID);
0N/A pTxInfo->dxdy = (*env)->GetDoubleField(env, txform, m01ID);
0N/A pTxInfo->tx = (*env)->GetDoubleField(env, txform, m02ID);
0N/A pTxInfo->dydx = (*env)->GetDoubleField(env, txform, m10ID);
0N/A pTxInfo->dydy = (*env)->GetDoubleField(env, txform, m11ID);
0N/A pTxInfo->ty = (*env)->GetDoubleField(env, txform, m12ID);
0N/A}
0N/A
0N/AJNIEXPORT void JNICALL
0N/ATransform_transform(TransformInfo *pTxInfo, jdouble *pX, jdouble *pY)
0N/A{
0N/A jdouble x = *pX;
0N/A jdouble y = *pY;
0N/A
0N/A *pX = pTxInfo->dxdx * x + pTxInfo->dxdy * y + pTxInfo->tx;
0N/A *pY = pTxInfo->dydx * x + pTxInfo->dydy * y + pTxInfo->ty;
0N/A}
0N/A
0N/A/*
0N/A * External declarations for the pixelFor helper methods for the various
0N/A * named surface types. These functions are defined in the various
0N/A * files that contain the loop functions for their type.
0N/A */
0N/Aextern PixelForFunc PixelForByteBinary;
0N/Aextern PixelForFunc PixelForByteIndexed;
0N/Aextern PixelForFunc PixelForByteGray;
0N/Aextern PixelForFunc PixelForIndex8Gray;
0N/Aextern PixelForFunc PixelForIndex12Gray;
0N/Aextern PixelForFunc PixelForUshort555Rgb;
0N/Aextern PixelForFunc PixelForUshort555Rgbx;
0N/Aextern PixelForFunc PixelForUshort565Rgb;
0N/Aextern PixelForFunc PixelForUshort4444Argb;
0N/Aextern PixelForFunc PixelForUshortGray;
0N/Aextern PixelForFunc PixelForUshortIndexed;
0N/Aextern PixelForFunc PixelForIntArgbPre;
0N/Aextern PixelForFunc PixelForIntArgbBm;
0N/Aextern PixelForFunc PixelForIntBgr;
0N/Aextern PixelForFunc PixelForIntRgbx;
0N/Aextern PixelForFunc PixelForFourByteAbgr;
0N/Aextern PixelForFunc PixelForFourByteAbgrPre;
0N/A
0N/A/*
0N/A * Definition and initialization of the globally accessible PrimitiveTypes.
0N/A */
0N/Astruct _PrimitiveTypes PrimitiveTypes = {
0N/A { "sun/java2d/loops/Blit", SD_LOCK_READ, SD_LOCK_WRITE, NULL, NULL},
0N/A { "sun/java2d/loops/BlitBg", SD_LOCK_READ, SD_LOCK_WRITE, NULL, NULL},
0N/A { "sun/java2d/loops/ScaledBlit", SD_LOCK_READ, SD_LOCK_WRITE, NULL, NULL},
0N/A { "sun/java2d/loops/FillRect", 0, SD_LOCK_WRITE, NULL, NULL},
0N/A { "sun/java2d/loops/FillSpans", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
3172N/A { "sun/java2d/loops/FillParallelogram", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
3172N/A { "sun/java2d/loops/DrawParallelogram", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
0N/A { "sun/java2d/loops/DrawLine", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
0N/A { "sun/java2d/loops/DrawRect", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
0N/A { "sun/java2d/loops/DrawPolygons", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
0N/A { "sun/java2d/loops/DrawPath", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
0N/A { "sun/java2d/loops/FillPath", 0, SD_LOCK_PARTIAL_WRITE, NULL, NULL},
0N/A { "sun/java2d/loops/MaskBlit", SD_LOCK_READ, SD_LOCK_RD_WR, NULL, NULL},
0N/A { "sun/java2d/loops/MaskFill", 0, SD_LOCK_RD_WR, NULL, NULL},
0N/A { "sun/java2d/loops/DrawGlyphList", 0, SD_LOCK_PARTIAL_WRITE |
0N/A SD_LOCK_FASTEST, NULL, NULL},
0N/A { "sun/java2d/loops/DrawGlyphListAA", 0, SD_LOCK_RD_WR | SD_LOCK_FASTEST, NULL, NULL},
0N/A { "sun/java2d/loops/DrawGlyphListLCD", 0, SD_LOCK_RD_WR | SD_LOCK_FASTEST, NULL, NULL},
0N/A { "sun/java2d/loops/TransformHelper", SD_LOCK_READ, 0, NULL, NULL}
0N/A};
0N/A
0N/A/*
0N/A * Definition and initialization of the globally accessible SurfaceTypes.
0N/A */
0N/Astruct _SurfaceTypes SurfaceTypes = {
0N/A { { "OpaqueColor", NULL}, NULL, 0, 0 },
0N/A { { "AnyColor", NULL}, NULL, 0, 0 },
0N/A { { "AnyByte", NULL}, NULL, 0, 0 },
0N/A { { "ByteBinary1Bit", NULL},
0N/A PixelForByteBinary, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
0N/A { { "ByteBinary2Bit", NULL},
0N/A PixelForByteBinary, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
0N/A { { "ByteBinary4Bit", NULL},
0N/A PixelForByteBinary, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
0N/A { { "ByteIndexed", NULL},
0N/A PixelForByteIndexed, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
0N/A { { "ByteIndexedBm", NULL},
0N/A PixelForByteIndexed, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
0N/A { { "ByteGray", NULL}, PixelForByteGray, 0, 0},
0N/A { { "Index8Gray", NULL},
0N/A PixelForIndex8Gray, SD_LOCK_LUT, SD_LOCK_INVGRAY },
0N/A { { "Index12Gray", NULL},
0N/A PixelForIndex12Gray, SD_LOCK_LUT, SD_LOCK_INVGRAY },
0N/A { { "AnyShort", NULL}, NULL, 0, 0 },
0N/A { { "Ushort555Rgb", NULL}, PixelForUshort555Rgb, 0, 0},
0N/A { { "Ushort555Rgbx", NULL}, PixelForUshort555Rgbx, 0, 0},
0N/A { { "Ushort565Rgb", NULL}, PixelForUshort565Rgb, 0, 0 },
0N/A { { "Ushort4444Argb", NULL}, PixelForUshort4444Argb, 0, 0 },
0N/A { { "UshortGray", NULL}, PixelForUshortGray, 0, 0},
0N/A { { "UshortIndexed", NULL},
0N/A PixelForUshortIndexed, SD_LOCK_LUT, SD_LOCK_INVCOLOR },
0N/A { { "Any3Byte", NULL}, NULL, 0, 0 },
0N/A { { "ThreeByteBgr", NULL}, NULL, 0, 0 },
0N/A { { "AnyInt", NULL}, NULL, 0, 0 },
0N/A { { "IntArgb", NULL}, NULL, 0, 0 },
0N/A { { "IntArgbPre", NULL}, PixelForIntArgbPre, 0, 0},
0N/A { { "IntArgbBm", NULL}, PixelForIntArgbBm, 0, 0},
0N/A { { "IntRgb", NULL}, NULL, 0, 0 },
0N/A { { "IntBgr", NULL}, PixelForIntBgr, 0, 0},
0N/A { { "IntRgbx", NULL}, PixelForIntRgbx, 0, 0},
0N/A { { "Any4Byte", NULL}, NULL, 0, 0 },
0N/A { { "FourByteAbgr", NULL}, PixelForFourByteAbgr, 0, 0},
0N/A { { "FourByteAbgrPre", NULL}, PixelForFourByteAbgrPre, 0, 0},
0N/A};
0N/A
0N/A/*
0N/A * Definition and initialization of the globally accessible CompositeTypes.
0N/A */
0N/Astruct _CompositeTypes CompositeTypes = {
0N/A { { "SrcNoEa", NULL}, NULL, 0},
0N/A { { "SrcOverNoEa", NULL}, NULL, SD_LOCK_RD_WR },
0N/A { { "SrcOverNoEa", NULL}, NULL, SD_LOCK_PARTIAL_WRITE }, /* SrcOverBmNoEa */
0N/A { { "Src", NULL}, GrPrim_CompGetAlphaInfo, 0},
0N/A { { "SrcOver", NULL}, GrPrim_CompGetAlphaInfo, SD_LOCK_RD_WR },
0N/A { { "Xor", NULL}, GrPrim_CompGetXorInfo, SD_LOCK_RD_WR },
0N/A { { "AnyAlpha", NULL}, GrPrim_CompGetAlphaInfo, SD_LOCK_RD_WR },
0N/A};