src/solaris/native/sun/java2d/x11/XRBackendNative.c

Print this page
rev 7983 : 8024854: Basic changes and files to build the class library on AIX
Contributed-by: luchsh@linux.vnet.ibm.com, spoole@linux.vnet.ibm.com, thomas.stuefe@sap.com
Reviewed-by:
   1 /*
   2  * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  51     XPointFixed p1;
  52     XPointFixed p2;
  53 } XLinearGradient;
  54 #endif
  55 
  56 #ifndef X_RenderCreateRadialGradient
  57 typedef struct _XCircle {
  58     XFixed x;
  59     XFixed y;
  60     XFixed radius;
  61 } XCircle;
  62 
  63 typedef struct _XRadialGradient {
  64     XCircle inner;
  65     XCircle outer;
  66 } XRadialGradient;
  67 #endif
  68 
  69 #include <dlfcn.h>
  70 
  71 #ifdef __solaris__
  72 /* Solaris 10 will not have these symbols at runtime */
  73 
  74 typedef Picture (*XRenderCreateLinearGradientFuncType)
  75                                      (Display *dpy,
  76                                      const XLinearGradient *gradient,
  77                                      const XFixed *stops,
  78                                      const XRenderColor *colors,
  79                                      int nstops);
  80 
  81 typedef Picture (*XRenderCreateRadialGradientFuncType)
  82                                      (Display *dpy,
  83                                      const XRadialGradient *gradient,
  84                                      const XFixed *stops,
  85                                      const XRenderColor *colors,
  86                                      int nstops);
  87 
  88 static
  89 XRenderCreateLinearGradientFuncType XRenderCreateLinearGradientFunc = NULL;
  90 static
  91  XRenderCreateRadialGradientFuncType XRenderCreateRadialGradientFunc = NULL;


 126  * just to be conservative.  This is offset by the size of our maximum x*Req
 127  * type in this compilation unit, which is xRenderCreateRadiaGradientReq.
 128  *
 129  * Note that sizeof(xRenderCreateRadiaGradientReq) = 36
 130  */
 131 #define MAX_PAYLOAD (262140u - 36u)
 132 #define MAXUINT (0xffffffffu)
 133 
 134 static jboolean IsXRenderAvailable(jboolean verbose) {
 135 
 136     void *xrenderlib;
 137 
 138     int major_opcode, first_event, first_error;
 139     jboolean available = JNI_TRUE;
 140 
 141     if (!XQueryExtension(awt_display, "RENDER",
 142                          &major_opcode, &first_event, &first_error)) {
 143         return JNI_FALSE;
 144     }
 145 
 146 #ifdef __solaris__
 147     xrenderlib = dlopen("libXrender.so",RTLD_GLOBAL|RTLD_LAZY);
 148     if (xrenderlib != NULL) {
 149 
 150       XRenderCreateLinearGradientFunc =
 151         (XRenderCreateLinearGradientFuncType)
 152         dlsym(xrenderlib, "XRenderCreateLinearGradient");
 153 
 154       XRenderCreateRadialGradientFunc =
 155         (XRenderCreateRadialGradientFuncType)
 156         dlsym(xrenderlib, "XRenderCreateRadialGradient");
 157 
 158       if (XRenderCreateLinearGradientFunc == NULL ||
 159           XRenderCreateRadialGradientFunc == NULL)
 160       {
 161         available = JNI_FALSE;
 162       }
 163       dlclose(xrenderlib);
 164     } else {
 165       available = JNI_FALSE;
 166     }


   1 /*
   2  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  51     XPointFixed p1;
  52     XPointFixed p2;
  53 } XLinearGradient;
  54 #endif
  55 
  56 #ifndef X_RenderCreateRadialGradient
  57 typedef struct _XCircle {
  58     XFixed x;
  59     XFixed y;
  60     XFixed radius;
  61 } XCircle;
  62 
  63 typedef struct _XRadialGradient {
  64     XCircle inner;
  65     XCircle outer;
  66 } XRadialGradient;
  67 #endif
  68 
  69 #include <dlfcn.h>
  70 
  71 #if defined(__solaris__) || defined(AIX)
  72 /* Solaris 10 will not have these symbols at runtime */
  73 
  74 typedef Picture (*XRenderCreateLinearGradientFuncType)
  75                                      (Display *dpy,
  76                                      const XLinearGradient *gradient,
  77                                      const XFixed *stops,
  78                                      const XRenderColor *colors,
  79                                      int nstops);
  80 
  81 typedef Picture (*XRenderCreateRadialGradientFuncType)
  82                                      (Display *dpy,
  83                                      const XRadialGradient *gradient,
  84                                      const XFixed *stops,
  85                                      const XRenderColor *colors,
  86                                      int nstops);
  87 
  88 static
  89 XRenderCreateLinearGradientFuncType XRenderCreateLinearGradientFunc = NULL;
  90 static
  91  XRenderCreateRadialGradientFuncType XRenderCreateRadialGradientFunc = NULL;


 126  * just to be conservative.  This is offset by the size of our maximum x*Req
 127  * type in this compilation unit, which is xRenderCreateRadiaGradientReq.
 128  *
 129  * Note that sizeof(xRenderCreateRadiaGradientReq) = 36
 130  */
 131 #define MAX_PAYLOAD (262140u - 36u)
 132 #define MAXUINT (0xffffffffu)
 133 
 134 static jboolean IsXRenderAvailable(jboolean verbose) {
 135 
 136     void *xrenderlib;
 137 
 138     int major_opcode, first_event, first_error;
 139     jboolean available = JNI_TRUE;
 140 
 141     if (!XQueryExtension(awt_display, "RENDER",
 142                          &major_opcode, &first_event, &first_error)) {
 143         return JNI_FALSE;
 144     }
 145 
 146 #if defined(__solaris__) || defined(AIX)
 147     xrenderlib = dlopen("libXrender.so",RTLD_GLOBAL|RTLD_LAZY);
 148     if (xrenderlib != NULL) {
 149 
 150       XRenderCreateLinearGradientFunc =
 151         (XRenderCreateLinearGradientFuncType)
 152         dlsym(xrenderlib, "XRenderCreateLinearGradient");
 153 
 154       XRenderCreateRadialGradientFunc =
 155         (XRenderCreateRadialGradientFuncType)
 156         dlsym(xrenderlib, "XRenderCreateRadialGradient");
 157 
 158       if (XRenderCreateLinearGradientFunc == NULL ||
 159           XRenderCreateRadialGradientFunc == NULL)
 160       {
 161         available = JNI_FALSE;
 162       }
 163       dlclose(xrenderlib);
 164     } else {
 165       available = JNI_FALSE;
 166     }