提交 9cb9fc47 编写于 作者: A alitvinov

8218877: Help transform transformers

Reviewed-by: serb, prr, mschoene, bpb, ssahoo
上级 cf79f02c
......@@ -489,6 +489,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
......
......@@ -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); \
......@@ -2015,7 +2015,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++; \
......@@ -2063,7 +2063,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); \
......@@ -2121,7 +2121,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 ); \
......
......@@ -717,8 +717,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);
......@@ -740,7 +740,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]);
}
......@@ -813,7 +813,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);
......
......@@ -1156,7 +1156,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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册