< prev index next >

src/java.desktop/unix/native/common/awt/X11Color.c

Print this page
rev 58017 : 8239124: Minimize the usage of AwtGraphicsConfigDataPtr in native
Reviewed-by: XXX

*** 1,7 **** /* ! * Copyright (c) 1995, 2019, 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) 1995, 2020, 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
*** 1261,1307 **** #endif /* !HEADLESS */ extern jfieldID colorValueID; #ifndef HEADLESS - int awtJNI_GetColorForVis (JNIEnv *env,jobject this, AwtGraphicsConfigDataPtr awt_data) - { - int col; - jclass SYSCLR_class; - - if (!JNU_IsNull(env,this)) - { - SYSCLR_class = (*env)->FindClass(env, "java/awt/SystemColor"); - CHECK_NULL_RETURN(SYSCLR_class, 0); - - if ((*env)->IsInstanceOf(env, this, SYSCLR_class)) { - /* SECURITY: This is safe, because there is no way - * for client code to insert an object - * that is a subclass of SystemColor - */ - col = (int) JNU_CallMethodByName(env - ,NULL - ,this - ,"getRGB" - ,"()I").i; - JNU_CHECK_EXCEPTION_RETURN(env, 0); - } else { - col = (int)(*env)->GetIntField(env,this,colorValueID); - } - - if (awt_data->awt_cmap == (Colormap) NULL) { - awtJNI_CreateColorData (env, awt_data, 1); - } - - col = awt_data->AwtColorMatch(red(col), green(col), blue(col), - awt_data); - return col; - } - - return 0; - } - void awt_allocate_systemrgbcolors (jint *rgbColors, int num_colors, AwtGraphicsConfigDataPtr awtData) { int i, pixel; for (i = 0; i < num_colors; i++) --- 1261,1270 ----
< prev index next >