提交 f1fd07e6 编写于 作者: B bae

8002325: Improve management of images

Reviewed-by: prr, ahgross
上级 eeda34b3
......@@ -223,9 +223,14 @@ int awt_parseRaster(JNIEnv *env, jobject jraster, RasterS_t *rasterP) {
return 0;
}
rasterP->sppsm.isUsed = 0;
if ((*env)->IsInstanceOf(env, rasterP->jsampleModel,
(*env)->FindClass(env,"java/awt/image/SinglePixelPackedSampleModel"))) {
jobject jmask, joffs, jnbits;
rasterP->sppsm.isUsed = 1;
rasterP->sppsm.maxBitSize = (*env)->GetIntField(env,
rasterP->jsampleModel,
g_SPPSMmaxBitID);
......@@ -711,6 +716,21 @@ setHints(JNIEnv *env, BufImageS_t *imageP) {
}
else if (cmodelP->cmType == DIRECT_CM_TYPE || cmodelP->cmType == PACKED_CM_TYPE) {
int i;
/* do some sanity check first: make sure that
* - sample model is SinglePixelPackedSampleModel
* - number of bands in the raster corresponds to the number
* of color components in the color model
*/
if (!rasterP->sppsm.isUsed ||
rasterP->numBands != cmodelP->numComponents)
{
/* given raster is not compatible with the color model,
* so the operation has to be aborted.
*/
return -1;
}
if (cmodelP->maxNbits > 8) {
hintP->needToExpand = TRUE;
hintP->expandToNbits = cmodelP->maxNbits;
......
......@@ -95,6 +95,7 @@ typedef struct {
jint offsets[MAX_NUMBANDS];
jint nBits[MAX_NUMBANDS];
jint maxBitSize;
jint isUsed; // flag to indicate whether the raster sample model is SPPSM
} SPPSampleModelS_t;
/* Struct that holds information for the Raster object */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册