< prev index next >
src/share/native/sun/awt/image/BufImgSurfaceData.c
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 30,39 ****
--- 30,40 ----
#include "img_util_md.h"
#include "jni_util.h"
/* Define uintptr_t */
#include "gdefs.h"
+ #include "Disposer.h"
/**
* This include file contains support code for loops using the
* SurfaceData interface to talk to an X11 drawable from native
* code.
*** 78,100 ****
CHECK_NULL(colorDataID = (*env)->GetFieldID(env, icm, "colorData",
"Lsun/awt/image/BufImgSurfaceData$ICMColorData;"));
}
/*
- * Class: sun_java2d_SurfaceData
- * Method: freeNativeICMData
- * Signature: (Ljava/awt/image/IndexColorModel;)V
- */
- JNIEXPORT void JNICALL
- Java_sun_awt_image_BufImgSurfaceData_freeNativeICMData
- (JNIEnv *env, jclass sd, jlong pData)
- {
- ColorData *cdata = (ColorData*)jlong_to_ptr(pData);
- freeICMColorData(cdata);
- }
-
- /*
* Class: sun_awt_image_BufImgSurfaceData
* Method: initOps
* Signature: (Ljava/lang/Object;IIIII)V
*/
JNIEXPORT void JNICALL
--- 79,88 ----
*** 138,147 ****
--- 126,144 ----
bisdo->rasbounds.x2 = width;
bisdo->rasbounds.y2 = height;
}
/*
+ * Releases native structures associated with BufImgSurfaceData.ICMColorData.
+ */
+ static void BufImg_Dispose_ICMColorData(JNIEnv *env, jlong pData)
+ {
+ ColorData *cdata = (ColorData*)jlong_to_ptr(pData);
+ freeICMColorData(cdata);
+ }
+
+ /*
* Method for disposing native BufImgSD
*/
static void BufImg_Dispose(JNIEnv *env, SurfaceDataOps *ops)
{
/* ops is assumed non-null as it is checked in SurfaceData_DisposeOps */
*** 315,324 ****
--- 312,322 ----
free(cData);
return (ColorData*)NULL;
}
(*env)->SetObjectField(env, bisdo->icm, colorDataID, colorData);
+ Disposer_AddRecord(env, colorData, BufImg_Dispose_ICMColorData, pData);
}
}
return cData;
}
< prev index next >