/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <jni.h>
#include <jlong.h>
#include <jni_util.h>
#include "sun_java2d_pipe_BufferedMaskBlit.h"
#include "sun_java2d_pipe_BufferedOpCodes.h"
#include "Trace.h"
#include "GraphicsPrimitiveMgr.h"
#include "IntArgb.h"
#include "IntRgb.h"
#include "IntBgr.h"
/**
* 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.
*/
{
unsigned char *bbuf;
"BufferedMaskBlit_enqueueTile: bpos=%d",
bpos);
"BufferedMaskBlit_enqueueTile: srcOps is null");
return bpos;
}
"BufferedMaskBlit_enqueueTile: cannot get direct buffer address");
return bpos;
}
"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...
"BufferedMaskBlit_enqueueTile: mask array too large");
return bpos;
}
"BufferedMaskBlit_enqueueTile: could not acquire lock");
return bpos;
}
{
jint h;
pMask = pMaskAlloc =
"BufferedMaskBlit_enqueueTile: cannot lock mask array");
return bpos;
}
h = height;
" sx=%d sy=%d w=%d h=%d",
" maskoff=%d maskscan=%d",
" pixstride=%d scanstride=%d",
// enqueue parameters
pBuf += 5;
// apply alpha values from mask to the source tile, and store
// resulting IntArgbPre pixels into RenderBuffer (there are
// separate inner loops for the most common source formats)
switch (srcType) {
do {
do {
if (!pathA) {
pBuf[0] = 0;
} else {
} else {
jint r, g, b, a;
ExtractIntDcmComponents1234(pixel, a, r, g, b);
r = MUL8(a, r);
g = MUL8(a, g);
b = MUL8(a, b);
}
}
pBuf++;
} while (--w > 0);
} while (--h > 0);
break;
do {
do {
if (!pathA) {
pBuf[0] = 0;
} else if (pathA == 0xff) {
} else {
jint r, g, b, a;
}
pBuf++;
} while (--w > 0);
} while (--h > 0);
break;
do {
do {
if (!pathA) {
pBuf[0] = 0;
} else if (pathA == 0xff) {
} else {
jint r, g, b, a;
LoadIntRgbTo3ByteRgb(pSrc, c, 0, r, g, b);
a = pathA;
r = MUL8(a, r);
g = MUL8(a, g);
b = MUL8(a, b);
}
pBuf++;
} while (--w > 0);
} while (--h > 0);
break;
do {
do {
if (!pathA) {
pBuf[0] = 0;
} else {
jint r, g, b, a;
LoadIntBgrTo3ByteRgb(pSrc, c, 0, r, g, b);
a = pathA;
r = MUL8(a, r);
g = MUL8(a, g);
b = MUL8(a, b);
}
pBuf++;
} while (--w > 0);
} while (--h > 0);
break;
default:
// should not get here, just no-op...
break;
}
// increment current byte position
}
}
// return the current byte position
return bpos;
}