/*
* 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 <string.h>
#include "jni.h"
#include "jni_util.h"
#include "awt_parseImage.h"
#include "imageInitIDs.h"
#include "sun_awt_image_ImageRepresentation.h"
#ifndef FALSE
# define FALSE 0
#endif
#ifndef TRUE
#endif
if ((ss) != 0) { \
/* integer oveflow */ \
return JNI_FALSE; \
} \
} \
#define CHECK_SRC() \
do { \
int pixeloffset; \
return JNI_FALSE; \
} \
CHECK_STRIDE(0, h, scansize); \
\
/* check scansize */ \
return JNI_FALSE; \
} \
pixeloffset += (w - 1); \
\
return JNI_FALSE; \
} \
} while (0) \
do { \
return JNI_FALSE; \
} \
return JNI_FALSE; \
} \
poffset += dstDataOff; \
\
return JNI_FALSE; \
} \
} while (0) \
"I");
}
/*
* This routine is used to draw ICM pixels into a default color model
*/
{
int *dstData;
int sStride;
int *cOffs;
int pixelStride;
return JNI_FALSE;
}
return JNI_FALSE;
}
if (x < 0 || w < 1 || (0x7fffffff - x) < w) {
return JNI_FALSE;
}
if (y < 0 || h < 1 || (0x7fffffff - y) < h) {
return JNI_FALSE;
}
/* no destination buffer */
return JNI_FALSE;
}
/* invalid data offstes in raster */
return JNI_FALSE;
}
return JNI_FALSE;
}
dstDataOff = cOffs[0];
/* the offset array is not needed anymore and can be released */
/* do basic validation: make sure that offsets for
* first pixel and for last pixel are safe to calculate and use */
CHECK_STRIDE(y, h, sStride);
CHECK_STRIDE(x, w, pixelStride);
CHECK_DST(x, y);
/* check source array */
CHECK_SRC();
return JNI_FALSE;
}
NULL);
return JNI_FALSE;
}
return JNI_FALSE;
}
}
}
/* Release the locked arrays */
return JNI_TRUE;
}
{
int sStride;
int pixelStride;
int mapSize;
unsigned char *srcData;
unsigned char *dstData;
unsigned char *dataP;
unsigned char *pixP;
int i;
int j;
int newNumLut;
int newTransIdx;
unsigned char *ydataP;
unsigned char *ypixP;
return JNI_FALSE;
}
return JNI_FALSE;
}
if (x < 0 || w < 1 || (0x7fffffff - x) < w) {
return JNI_FALSE;
}
if (y < 0 || h < 1 || (0x7fffffff - y) < h) {
return JNI_FALSE;
}
/* Ether old or new ICM has a palette that exceeds capacity
of byte data type, so we have to convert the image data
to default representation.
*/
return JNI_FALSE;
}
/* no destination buffer */
return JNI_FALSE;
}
CHECK_STRIDE(y, h, sStride);
CHECK_STRIDE(x, w, pixelStride);
CHECK_DST(x, y);
/* check source array */
CHECK_SRC();
NULL);
/* out of memory error already thrown */
return JNI_FALSE;
}
NULL);
/* out of memory error already thrown */
return JNI_FALSE;
}
/* Need to convert to ICR */
return JNI_FALSE;
}
/* Don't need these any more */
/* Need to write back new number of entries in lut */
}
if (newTransIdx != transIdx) {
}
NULL);
/* out of memory error already thrown */
return JNI_FALSE;
}
NULL);
/* out of memory error already thrown */
return JNI_FALSE;
}
for (i=0; i < h; i++) {
for (j=0; j < w; j++) {
dataP += pixelStride;
pixP++;
}
}
return JNI_TRUE;
}
{
int i;
int idx;
unsigned int rgb;
for (i=0; i < maxSize; i++) {
cvtLut[i] = i;
}
for (i=0; i < numLut2; i++) {
/* If this slot in new palette is different from the
* same slot in current palette, then we try to find
* this color in other slots. On failure, add this color
* to current palette.
*/
if ((i >= numLut1) ||
{
/* Transparent */
if ((rgb & ALPHA_MASK) == 0) {
if (transIdx == -1) {
if (numLut1 < 256) {
newTransIdx = i;
transIdx = i;
numLut1++;
}
else {
return FALSE;
}
}
}
else {
if (numLut1 < 256) {
numLut1++;
}
else {
/* Bad news... need to convert image */
return FALSE;
}
} else {
}
}
}
}
if (changed) {
*jniFlagP = 0;
*retNumLut1 = numLut1;
if (newTransIdx != -1) {
}
}
return TRUE;
}
int i;
if ((rgb&0xff000000)==0) {
for (i=0; i < numLut; i++) {
if ((lut[i]&0xff000000)==0) return i;
}
}
else {
for (i=0; i < numLut; i++) {
}
}
return -1;
}