提交 cd46faf1 编写于 作者: V vadim

8151925: Font reference improvements

Reviewed-by: prr, serb, skoivu
上级 2aedf226
......@@ -256,7 +256,7 @@ AwtFont* AwtFont::Create(JNIEnv *env, jobject font, jint angle, jfloat awScale)
AwtFont* awtFont = NULL;
jobjectArray compFont = NULL;
int cfnum;
int cfnum = 0;
try {
if (env->EnsureLocalCapacity(3) < 0)
......@@ -264,7 +264,9 @@ AwtFont* AwtFont::Create(JNIEnv *env, jobject font, jint angle, jfloat awScale)
if (IsMultiFont(env, font)) {
compFont = GetComponentFonts(env, font);
cfnum = env->GetArrayLength(compFont);
if (compFont != NULL) {
cfnum = env->GetArrayLength(compFont);
}
} else {
compFont = NULL;
cfnum = 0;
......@@ -614,7 +616,9 @@ int AwtFont::getFontDescriptorNumber(JNIEnv *env, jobject font,
if (IsMultiFont(env, font)) {
array = GetComponentFonts(env, font);
num = env->GetArrayLength(array);
if (array != NULL) {
num = env->GetArrayLength(array);
}
} else {
array = NULL;
num = 0;
......@@ -672,14 +676,16 @@ SIZE AwtFont::DrawStringSize_sub(jstring str, HDC hDC,
if (IsMultiFont(env, font)) {
jobject peer = env->CallObjectMethod(font, AwtFont::peerMID);
array = (jobjectArray)(env->CallObjectMethod(
peer, AwtFont::makeConvertedMultiFontStringMID, str));
DASSERT(!safe_ExceptionOccurred(env));
if (peer != NULL) {
array = (jobjectArray)(env->CallObjectMethod(
peer, AwtFont::makeConvertedMultiFontStringMID, str));
DASSERT(!safe_ExceptionOccurred(env));
if (array != NULL) {
arrayLength = env->GetArrayLength(array);
if (array != NULL) {
arrayLength = env->GetArrayLength(array);
}
env->DeleteLocalRef(peer);
}
env->DeleteLocalRef(peer);
} else {
array = NULL;
arrayLength = 0;
......
......@@ -230,11 +230,14 @@ public:
INLINE static jobjectArray GetComponentFonts(JNIEnv *env,
jobject font) {
jobject platformFont = env->CallObjectMethod(font, AwtFont::peerMID);
jobjectArray result =
(jobjectArray)(env->GetObjectField(platformFont,
AwtFont::componentFontsID));
env->DeleteLocalRef(platformFont);
return result;
if (platformFont != NULL) {
jobjectArray result =
(jobjectArray)(env->GetObjectField(platformFont,
AwtFont::componentFontsID));
env->DeleteLocalRef(platformFont);
return result;
}
return NULL;
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册