8218877: Help transform transformers

Reviewed-by: serb, prr, mschoene, bpb, ssahoo
This commit is contained in:
Anton Litvinov 2019-05-31 18:16:57 +01:00
parent df1acef59e
commit 438892c0ca
4 changed files with 13 additions and 9 deletions

View File

@ -710,8 +710,8 @@ void flip(void *pDst, juint w, juint h, jint scanStride, jboolean convert) {
juint step = 0;
// vertical flip and convert argbpre to argb if necessary
for (; i < h / 2; ++i) {
juint *r1 = PtrAddBytes(pDst, (i * scanStride));
juint *r2 = PtrAddBytes(pDst, (h - i - 1) * scanStride);
juint *r1 = PtrPixelsRow(pDst, i, scanStride);
juint *r2 = PtrPixelsRow(pDst, h - i - 1, scanStride);
if (tempRow) {
// fast path
memcpy(tempRow, r1, clippedStride);
@ -733,7 +733,7 @@ void flip(void *pDst, juint w, juint h, jint scanStride, jboolean convert) {
}
// convert the middle line if necessary
if (convert && h % 2) {
juint *r1 = PtrAddBytes(pDst, (i * scanStride));
juint *r1 = PtrPixelsRow(pDst, i, scanStride);
for (step = 0; step < w; ++step) {
LoadIntArgbPreTo1IntArgb(r1, 0, step, r1[step]);
}
@ -806,7 +806,7 @@ OGLBlitLoops_SurfaceToSwBlit(JNIEnv *env, OGLContext *oglc,
height = srcInfo.bounds.y2 - srcInfo.bounds.y1;
pDst = PtrAddBytes(pDst, dstx * dstInfo.pixelStride);
pDst = PtrAddBytes(pDst, dsty * dstInfo.scanStride);
pDst = PtrPixelsRow(pDst, dsty, dstInfo.scanStride);
j2d_glPixelStorei(GL_PACK_ROW_LENGTH,
dstInfo.scanStride / dstInfo.pixelStride);

View File

@ -490,6 +490,8 @@ extern struct _CompositeTypes {
#define PtrCoord(p, x, xinc, y, yinc) PtrAddBytes(p, \
((ptrdiff_t)(y))*(yinc) + \
((ptrdiff_t)(x))*(xinc))
#define PtrPixelsRow(p, y, scanStride) PtrAddBytes(p, \
((intptr_t) (y)) * (scanStride))
/*
* The function to call with an array of NativePrimitive structures

View File

@ -137,7 +137,7 @@
do { \
juint w = WIDTH; \
jint tmpsxloc = SXLOC; \
SRCPTR = PtrAddBytes(SRCBASE, ((SYLOC >> SHIFT) * srcScan)); \
SRCPTR = PtrPixelsRow(SRCBASE, (SYLOC >> SHIFT), srcScan); \
Init ## DSTTYPE ## StoreVarsX(DSTPREFIX, DSTINFO); \
do { \
jint XVAR = (tmpsxloc >> SHIFT); \
@ -2067,7 +2067,7 @@ void NAME_TRANSFORMHELPER_NN(SRC)(SurfaceDataRasInfo *pSrcInfo, \
\
Init ## SRC ## LoadVars(SrcRead, pSrcInfo); \
while (pRGB < pEnd) { \
SRC ## DataType *pRow = PtrAddBytes(pBase, WholeOfLong(ylong) * scan); \
SRC ## DataType *pRow = PtrPixelsRow(pBase, WholeOfLong(ylong), scan); \
Copy ## SRC ## ToIntArgbPre(pRGB, 0, \
SrcRead, pRow, WholeOfLong(xlong)); \
pRGB++; \
@ -2115,7 +2115,7 @@ void NAME_TRANSFORMHELPER_BL(SRC)(SurfaceDataRasInfo *pSrcInfo, \
ydelta &= scan; \
\
xwhole += cx; \
pRow = PtrAddBytes(pSrcInfo->rasBase, (ywhole + cy) * scan); \
pRow = PtrPixelsRow(pSrcInfo->rasBase, ywhole + cy, scan); \
Copy ## SRC ## ToIntArgbPre(pRGB, 0, SrcRead, pRow, xwhole); \
Copy ## SRC ## ToIntArgbPre(pRGB, 1, SrcRead, pRow, xwhole+xdelta); \
pRow = PtrAddBytes(pRow, ydelta); \
@ -2173,7 +2173,7 @@ void NAME_TRANSFORMHELPER_BC(SRC)(SurfaceDataRasInfo *pSrcInfo, \
ydelta1 += (isneg & -scan); \
\
xwhole += cx; \
pRow = PtrAddBytes(pSrcInfo->rasBase, (ywhole + cy) * scan); \
pRow = PtrPixelsRow(pSrcInfo->rasBase, ywhole + cy, scan); \
pRow = PtrAddBytes(pRow, ydelta0); \
Copy ## SRC ## ToIntArgbPre(pRGB, 0, SrcRead, pRow, xwhole+xdelta0); \
Copy ## SRC ## ToIntArgbPre(pRGB, 1, SrcRead, pRow, xwhole ); \

View File

@ -1092,7 +1092,9 @@ D3DContext::UploadTileToTexture(D3DResource *pTextureRes, void *pixels,
{
#ifndef PtrAddBytes
#define PtrAddBytes(p, b) ((void *) (((intptr_t) (p)) + (b)))
#define PtrCoord(p, x, xinc, y, yinc) PtrAddBytes(p, (y)*(yinc) + (x)*(xinc))
#define PtrCoord(p, x, xinc, y, yinc) PtrAddBytes(p, \
((ptrdiff_t)(y))*(yinc) + \
((ptrdiff_t)(x))*(xinc))
#endif // PtrAddBytes
HRESULT res = S_OK;