本文整理汇总了C++中SurfaceDataOps类的典型用法代码示例。如果您正苦于以下问题:C++ SurfaceDataOps类的具体用法?C++ SurfaceDataOps怎么用?C++ SurfaceDataOps使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SurfaceDataOps类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNativePrim
/*
* Class: sun_java2d_loops_MaskBlit
* Method: MaskBlit
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/SurfaceData;Ljava/awt/Composite;IIIIII[BII)V
*/
JNIEXPORT void JNICALL
Java_sun_java2d_loops_MaskBlit_MaskBlit
(JNIEnv *env, jobject self,
jobject srcData, jobject dstData, jobject comp, jobject clip,
jint srcx, jint srcy, jint dstx, jint dsty, jint width, jint height,
jbyteArray maskArray, jint maskoff, jint maskscan)
{
SurfaceDataOps *srcOps;
SurfaceDataOps *dstOps;
SurfaceDataRasInfo srcInfo;
SurfaceDataRasInfo dstInfo;
NativePrimitive *pPrim;
CompositeInfo compInfo;
RegionData clipInfo;
pPrim = GetNativePrim(env, self);
if (pPrim == NULL) {
return;
}
if (pPrim->pCompType->getCompInfo != NULL) {
(*pPrim->pCompType->getCompInfo)(env, &compInfo, comp);
}
if (Region_GetInfo(env, clip, &clipInfo)) {
return;
}
srcOps = SurfaceData_GetOps(env, srcData);
dstOps = SurfaceData_GetOps(env, dstData);
if (srcOps == 0 || dstOps == 0) {
return;
}
srcInfo.bounds.x1 = srcx;
srcInfo.bounds.y1 = srcy;
srcInfo.bounds.x2 = srcx + width;
srcInfo.bounds.y2 = srcy + height;
dstInfo.bounds.x1 = dstx;
dstInfo.bounds.y1 = dsty;
dstInfo.bounds.x2 = dstx + width;
dstInfo.bounds.y2 = dsty + height;
srcx -= dstx;
srcy -= dsty;
SurfaceData_IntersectBounds(&dstInfo.bounds, &clipInfo.bounds);
if (srcOps->Lock(env, srcOps, &srcInfo, pPrim->srcflags) != SD_SUCCESS) {
return;
}
if (dstOps->Lock(env, dstOps, &dstInfo, pPrim->dstflags) != SD_SUCCESS) {
SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
return;
}
SurfaceData_IntersectBlitBounds(&dstInfo.bounds, &srcInfo.bounds,
srcx, srcy);
Region_IntersectBounds(&clipInfo, &dstInfo.bounds);
if (!Region_IsEmpty(&clipInfo)) {
srcOps->GetRasInfo(env, srcOps, &srcInfo);
dstOps->GetRasInfo(env, dstOps, &dstInfo);
if (srcInfo.rasBase && dstInfo.rasBase) {
SurfaceDataBounds span;
unsigned char *pMask =
(maskArray
? (*env)->GetPrimitiveArrayCritical(env, maskArray, 0)
: 0);
jint savesx = srcInfo.bounds.x1;
jint savedx = dstInfo.bounds.x1;
Region_StartIteration(env, &clipInfo);
while (Region_NextIteration(&clipInfo, &span)) {
void *pSrc = PtrCoord(srcInfo.rasBase,
srcx + span.x1, srcInfo.pixelStride,
srcy + span.y1, srcInfo.scanStride);
void *pDst = PtrCoord(dstInfo.rasBase,
span.x1, dstInfo.pixelStride,
span.y1, dstInfo.scanStride);
maskoff += ((span.y1 - dsty) * maskscan + (span.x1 - dstx));
/*
* Fix for 4804375
* REMIND: There should probably be a better
* way to give the span coordinates to the
* inner loop. This is only really needed
* for the 1, 2, and 4 bit loops.
*/
srcInfo.bounds.x1 = srcx + span.x1;
dstInfo.bounds.x1 = span.x1;
(*pPrim->funcs.maskblit)(pDst, pSrc,
pMask, maskoff, maskscan,
span.x2 - span.x1, span.y2 - span.y1,
&dstInfo, &srcInfo,
pPrim, &compInfo);
}
Region_EndIteration(env, &clipInfo);
if (pMask) {
(*env)->ReleasePrimitiveArrayCritical(env, maskArray,
pMask, JNI_ABORT);
}
srcInfo.bounds.x1 = savesx;
//.........这里部分代码省略.........
示例2: GetNativePrim
/*
* Class: sun_java2d_loops_DrawPolygons
* Method: DrawPolygons
* Signature: (Lsun/java2d/SunGraphics2D;Lsun/java2d/SurfaceData;[I[I[IIIIZ)V
*/
JNIEXPORT void JNICALL
Java_sun_java2d_loops_DrawPolygons_DrawPolygons
(JNIEnv *env, jobject self,
jobject sg2d, jobject sData,
jintArray xPointsArray, jintArray yPointsArray,
jintArray nPointsArray, jint numPolys,
jint transX, jint transY, jboolean close)
{
SurfaceDataOps *sdOps;
SurfaceDataRasInfo rasInfo;
NativePrimitive *pPrim;
CompositeInfo compInfo;
jsize nPointsLen, xPointsLen, yPointsLen;
jint *nPointsPtr = NULL;
jint *xPointsPtr = NULL;
jint *yPointsPtr = NULL;
jint pointsNeeded;
jint i, ret;
jboolean ok = JNI_TRUE;
jint pixel = GrPrim_Sg2dGetPixel(env, sg2d);
if (JNU_IsNull(env, xPointsArray) || JNU_IsNull(env, yPointsArray)) {
JNU_ThrowNullPointerException(env, "coordinate array");
return;
}
if (JNU_IsNull(env, nPointsArray)) {
JNU_ThrowNullPointerException(env, "polygon length array");
return;
}
nPointsLen = (*env)->GetArrayLength(env, nPointsArray);
xPointsLen = (*env)->GetArrayLength(env, xPointsArray);
yPointsLen = (*env)->GetArrayLength(env, yPointsArray);
if (nPointsLen < numPolys) {
JNU_ThrowArrayIndexOutOfBoundsException(env,
"polygon length array size");
return;
}
pPrim = GetNativePrim(env, self);
if (pPrim == NULL) {
return;
}
if (pPrim->pCompType->getCompInfo != NULL) {
GrPrim_Sg2dGetCompInfo(env, sg2d, pPrim, &compInfo);
}
sdOps = SurfaceData_GetOps(env, sData);
if (sdOps == 0) {
return;
}
GrPrim_Sg2dGetClip(env, sg2d, &rasInfo.bounds);
ret = sdOps->Lock(env, sdOps, &rasInfo, SD_LOCK_FASTEST | pPrim->dstflags);
if (ret == SD_FAILURE) {
return;
}
nPointsPtr = (*env)->GetPrimitiveArrayCritical(env, nPointsArray, NULL);
if (!nPointsPtr) {
ok = JNI_FALSE;
}
if (ok) {
pointsNeeded = 0;
for (i = 0; i < numPolys; i++) {
if (nPointsPtr[i] > 0) {
pointsNeeded += nPointsPtr[i];
}
}
if (yPointsLen < pointsNeeded || xPointsLen < pointsNeeded) {
(*env)->ReleasePrimitiveArrayCritical(env, nPointsArray,
nPointsPtr, JNI_ABORT);
SurfaceData_InvokeUnlock(env, sdOps, &rasInfo);
JNU_ThrowArrayIndexOutOfBoundsException(env,
"coordinate array length");
return;
}
xPointsPtr = (*env)->GetPrimitiveArrayCritical(env, xPointsArray, NULL);
yPointsPtr = (*env)->GetPrimitiveArrayCritical(env, yPointsArray, NULL);
if (!xPointsPtr || !yPointsPtr) {
ok = JNI_FALSE;
}
}
if (ok) {
if (ret == SD_SLOWLOCK) {
RefineBounds(&rasInfo.bounds, transX, transY,
xPointsPtr, yPointsPtr, pointsNeeded);
ok = (rasInfo.bounds.x2 > rasInfo.bounds.x1 &&
rasInfo.bounds.y2 > rasInfo.bounds.y1);
}
//.........这里部分代码省略.........
示例3: GrPrim_Sg2dGetPixel
/*
* Class: sun_java2d_loops_FillPath
* Method: FillPath
* Signature: (Lsun/java2d/SunGraphics2D;Lsun/java2d/SurfaceData;IILjava/awt/geom/Path2D.Float;)V
*/
JNIEXPORT void JNICALL Java_sun_java2d_loops_FillPath_FillPath
(JNIEnv *env, jobject self,
jobject sg2d, jobject sData,
jint transX, jint transY, jobject p2df)
{
jarray typesArray;
jarray coordsArray;
jint numTypes;
jint fillRule;
jboolean ok = JNI_TRUE;
jint pixel = GrPrim_Sg2dGetPixel(env, sg2d);
jint maxCoords;
jfloat *coords;
SurfaceDataOps *sdOps;
SurfaceDataRasInfo rasInfo;
CompositeInfo compInfo;
jint ret;
NativePrimitive *pPrim = GetNativePrim(env, self);
jint stroke = (*env)->GetIntField(env, sg2d, sg2dStrokeHintID);
if (pPrim == NULL) {
return;
}
if (pPrim->pCompType->getCompInfo != NULL) {
GrPrim_Sg2dGetCompInfo(env, sg2d, pPrim, &compInfo);
}
sdOps = SurfaceData_GetOps(env, sData);
if (sdOps == 0) {
return;
}
typesArray = (jarray)(*env)->GetObjectField(env, p2df, path2DTypesID);
coordsArray = (jarray)(*env)->GetObjectField(env, p2df,
path2DFloatCoordsID);
if (coordsArray == NULL) {
JNU_ThrowNullPointerException(env, "coordinates array");
return;
}
numTypes = (*env)->GetIntField(env, p2df, path2DNumTypesID);
fillRule = (*env)->GetIntField(env, p2df, path2DWindingRuleID);
if ((*env)->GetArrayLength(env, typesArray) < numTypes) {
JNU_ThrowArrayIndexOutOfBoundsException(env, "types array");
return;
}
GrPrim_Sg2dGetClip(env, sg2d, &rasInfo.bounds);
ret = sdOps->Lock(env, sdOps, &rasInfo, SD_LOCK_FASTEST | pPrim->dstflags);
if (ret == SD_FAILURE) {
return;
}
maxCoords = (*env)->GetArrayLength(env, coordsArray);
coords = (jfloat*)(*env)->GetPrimitiveArrayCritical(
env, coordsArray, NULL);
if (ret == SD_SLOWLOCK) {
GrPrim_RefineBounds(&rasInfo.bounds, transX, transY,
coords, maxCoords);
ok = (rasInfo.bounds.x2 > rasInfo.bounds.x1 &&
rasInfo.bounds.y2 > rasInfo.bounds.y1);
}
if (ok) {
sdOps->GetRasInfo(env, sdOps, &rasInfo);
if (rasInfo.rasBase) {
if (rasInfo.bounds.x2 > rasInfo.bounds.x1 &&
rasInfo.bounds.y2 > rasInfo.bounds.y1)
{
DrawHandlerData dHData;
DrawHandler drawHandler = {
NULL,
NULL,
&drawScanline,
0, 0, 0, 0,
0, 0, 0, 0,
NULL
};
jbyte *types = (jbyte*)(*env)->GetPrimitiveArrayCritical(
env, typesArray, NULL);
/* Initialization of the following fields in the declaration of
* the dHData and drawHandler above causes warnings on sun
* studio compiler with
* -xc99=%none option applied (this option means compliance
* with C90 standard instead of C99)
*/
dHData.pRasInfo = &rasInfo;
dHData.pixel = pixel;
dHData.pPrim = pPrim;
dHData.pCompInfo = &compInfo;
drawHandler.xMin = rasInfo.bounds.x1;
//.........这里部分代码省略.........
示例4: PtrCoord
/**
* This implementation of MaskBlit first combines the source system memory
* tile with the corresponding alpha mask and stores the resulting
* IntArgbPre pixels directly into the RenderBuffer. Those pixels are
* then eventually pulled off the RenderBuffer and copied to the destination
* surface in OGL/D3DMaskBlit.
*
* Note that currently there are only inner loops defined for IntArgb,
* IntArgbPre, IntRgb, and IntBgr, as those are the most commonly used
* formats for this operation.
*/
JNIEXPORT jint JNICALL
Java_sun_java2d_pipe_BufferedMaskBlit_enqueueTile
(JNIEnv *env, jobject mb,
jlong buf, jint bpos,
jobject srcData, jlong pSrcOps, jint srcType,
jbyteArray maskArray, jint masklen, jint maskoff, jint maskscan,
jint srcx, jint srcy, jint dstx, jint dsty,
jint width, jint height)
{
SurfaceDataOps *srcOps = (SurfaceDataOps *)jlong_to_ptr(pSrcOps);
SurfaceDataRasInfo srcInfo;
unsigned char *pMask;
unsigned char *bbuf;
jint *pBuf;
J2dTraceLn1(J2D_TRACE_INFO,
"BufferedMaskBlit_enqueueTile: bpos=%d",
bpos);
if (srcOps == NULL) {
J2dRlsTraceLn(J2D_TRACE_ERROR,
"BufferedMaskBlit_enqueueTile: srcOps is null");
return bpos;
}
bbuf = (unsigned char *)jlong_to_ptr(buf);
if (bbuf == NULL) {
J2dRlsTraceLn(J2D_TRACE_ERROR,
"BufferedMaskBlit_enqueueTile: cannot get direct buffer address");
return bpos;
}
pBuf = (jint *)(bbuf + bpos);
if (JNU_IsNull(env, maskArray)) {
J2dRlsTraceLn(J2D_TRACE_ERROR,
"BufferedMaskBlit_enqueueTile: mask array is null");
return bpos;
}
if (masklen > MAX_MASK_LENGTH) {
// REMIND: this approach is seriously flawed if the mask
// length is ever greater than MAX_MASK_LENGTH (won't fit
// into the cached mask tile); so far this hasn't
// been a problem though...
J2dRlsTraceLn(J2D_TRACE_ERROR,
"BufferedMaskBlit_enqueueTile: mask array too large");
return bpos;
}
pMask = (*env)->GetPrimitiveArrayCritical(env, maskArray, 0);
if (pMask == NULL) {
J2dRlsTraceLn(J2D_TRACE_ERROR,
"BufferedMaskBlit_enqueueTile: cannot lock mask array");
return bpos;
}
srcInfo.bounds.x1 = srcx;
srcInfo.bounds.y1 = srcy;
srcInfo.bounds.x2 = srcx + width;
srcInfo.bounds.y2 = srcy + height;
if (srcOps->Lock(env, srcOps, &srcInfo, SD_LOCK_READ) != SD_SUCCESS) {
J2dRlsTraceLn(J2D_TRACE_WARNING,
"BufferedMaskBlit_enqueueTile: could not acquire lock");
(*env)->ReleasePrimitiveArrayCritical(env, maskArray,
pMask, JNI_ABORT);
return bpos;
}
if (srcInfo.bounds.x2 > srcInfo.bounds.x1 &&
srcInfo.bounds.y2 > srcInfo.bounds.y1)
{
srcOps->GetRasInfo(env, srcOps, &srcInfo);
if (srcInfo.rasBase) {
jint h;
jint srcScanStride = srcInfo.scanStride;
jint srcPixelStride = srcInfo.pixelStride;
jint *pSrc = (jint *)
PtrCoord(srcInfo.rasBase,
srcInfo.bounds.x1, srcInfo.pixelStride,
srcInfo.bounds.y1, srcInfo.scanStride);
width = srcInfo.bounds.x2 - srcInfo.bounds.x1;
height = srcInfo.bounds.y2 - srcInfo.bounds.y1;
maskoff += ((srcInfo.bounds.y1 - srcy) * maskscan +
(srcInfo.bounds.x1 - srcx));
maskscan -= width;
pMask += maskoff;
srcScanStride -= width * srcPixelStride;
//.........这里部分代码省略.........
示例5: if
/*
* Class: sun_java2d_loops_TransformHelper
* Method: Transform
* Signature: (Lsun/java2d/loops/MaskBlit;Lsun/java2d/SurfaceData;Lsun/java2d/SurfaceData;Ljava/awt/Composite;Lsun/java2d/pipe/Region;Ljava/awt/geom/AffineTransform;IIIIIIIII[I)V
*/
JNIEXPORT void JNICALL
Java_sun_java2d_loops_TransformHelper_Transform
(JNIEnv *env, jobject self,
jobject maskblit,
jobject srcData, jobject dstData,
jobject comp, jobject clip,
jobject itxform, jint txtype,
jint sx1, jint sy1, jint sx2, jint sy2,
jint dx1, jint dy1, jint dx2, jint dy2,
jintArray edgeArray, jint dxoff, jint dyoff)
{
SurfaceDataOps *srcOps;
SurfaceDataOps *dstOps;
SurfaceDataRasInfo srcInfo;
SurfaceDataRasInfo dstInfo;
NativePrimitive *pHelperPrim;
NativePrimitive *pMaskBlitPrim;
CompositeInfo compInfo;
RegionData clipInfo;
TransformInfo itxInfo;
jint maxlinepix;
TransformHelperFunc *pHelperFunc;
TransformInterpFunc *pInterpFunc;
jint edgebuf[MAXEDGES * 2];
jint *pEdges;
jdouble x, y;
jlong xbase, ybase;
jlong dxdxlong, dydxlong;
jlong dxdylong, dydylong;
#ifdef MAKE_STUBS
static int th_initialized;
/* For debugging only - used to swap in alternate funcs for perf testing */
if (!th_initialized) {
if (getenv("TXSTUB") != 0) {
pBilinearFunc = BilinearInterpStub;
pBicubicFunc = BicubicInterpStub;
} else if (getenv("TXNOVIS") != 0) {
pBilinearFunc = BilinearInterp;
pBicubicFunc = BicubicInterp;
}
th_initialized = 1;
}
#endif /* MAKE_STUBS */
pHelperPrim = GetNativePrim(env, self);
if (pHelperPrim == NULL) {
/* Should never happen... */
return;
}
pMaskBlitPrim = GetNativePrim(env, maskblit);
if (pMaskBlitPrim == NULL) {
/* Exception was thrown by GetNativePrim */
return;
}
if (pMaskBlitPrim->pCompType->getCompInfo != NULL) {
(*pMaskBlitPrim->pCompType->getCompInfo)(env, &compInfo, comp);
}
if (Region_GetInfo(env, clip, &clipInfo)) {
return;
}
srcOps = SurfaceData_GetOps(env, srcData);
dstOps = SurfaceData_GetOps(env, dstData);
if (srcOps == 0 || dstOps == 0) {
return;
}
/*
* Grab the appropriate pointer to the helper and interpolation
* routines and calculate the maximum number of destination pixels
* that can be processed in one intermediate buffer based on the
* size of the buffer and the number of samples needed per pixel.
*/
switch (txtype) {
case java_awt_image_AffineTransformOp_TYPE_NEAREST_NEIGHBOR:
pHelperFunc = pHelperPrim->funcs.transformhelpers->nnHelper;
pInterpFunc = NULL;
maxlinepix = LINE_SIZE;
break;
case java_awt_image_AffineTransformOp_TYPE_BILINEAR:
pHelperFunc = pHelperPrim->funcs.transformhelpers->blHelper;
pInterpFunc = pBilinearFunc;
maxlinepix = LINE_SIZE / 4;
break;
case java_awt_image_AffineTransformOp_TYPE_BICUBIC:
pHelperFunc = pHelperPrim->funcs.transformhelpers->bcHelper;
pInterpFunc = pBicubicFunc;
maxlinepix = LINE_SIZE / 16;
break;
}
srcInfo.bounds.x1 = sx1;
srcInfo.bounds.y1 = sy1;
//.........这里部分代码省略.........