jdk/src/solaris/native/sun/java2d/x11/XRSurfaceData.c
author prr
Mon, 22 Jul 2013 12:52:15 -0700
changeset 19006 fcda25164f7d
parent 12047 320a714614e9
child 20425 5964c0fc5cc0
permissions -rw-r--r--
7196866: CTW fails on all Solaris platforms Reviewed-by: prr, jrose, twisti, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
     1
/*
9035
1255eb81cc2f 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 8507
diff changeset
     2
 * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
     4
 *
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6374
e214162c907e 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 5579
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
6374
e214162c907e 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 5579
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    10
 *
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    15
 * accompanied this code).
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    16
 *
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    20
 *
6374
e214162c907e 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 5579
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e214162c907e 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 5579
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
e214162c907e 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 5579
diff changeset
    23
 * questions.
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    24
 */
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    25
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    26
#include "GraphicsPrimitiveMgr.h"
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    27
#include "Region.h"
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    28
#include "Trace.h"
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    29
#include "X11SurfaceData.h"
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    30
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    31
/*#include <xcb/xcb.h>*/
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 9035
diff changeset
    32
#include <X11/extensions/Xrender.h>
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    33
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    34
#ifndef RepeatNone  /* added in 0.10 */
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    35
#define RepeatNone    0
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    36
#define RepeatNormal  1
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    37
#define RepeatPad     2
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    38
#define RepeatReflect 3
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    39
#endif
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    40
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    41
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    42
#include <sys/uio.h>
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    43
#include <dlfcn.h>
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    44
#include <setjmp.h>
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    45
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    46
#ifndef HEADLESS
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    47
jfieldID pictID;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    48
jfieldID xidID;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    49
jfieldID blitMaskPMID;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    50
jfieldID blitMaskPictID;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    51
#endif /* !HEADLESS */
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    52
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    53
JNIEXPORT void JNICALL
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    54
   Java_sun_java2d_xr_XRSurfaceData_initXRPicture(JNIEnv *env, jobject xsd,
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    55
                                                  jlong pXSData,
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    56
                                                  jint pictFormat)
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    57
{
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    58
#ifndef HEADLESS
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    59
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    60
  X11SDOps *xsdo;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    61
  XRenderPictFormat *fmt;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    62
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    63
  J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initXRender");
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    64
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    65
  xsdo = (X11SDOps *) jlong_to_ptr(pXSData);
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    66
  if (xsdo == NULL) {
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    67
      return;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    68
  }
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    69
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    70
  if (xsdo->xrPic == None) {
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    71
      XRenderPictureAttributes pict_attr;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    72
      pict_attr.repeat = RepeatNone;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    73
      fmt = XRenderFindStandardFormat(awt_display, pictFormat);
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    74
      xsdo->xrPic =
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    75
         XRenderCreatePicture(awt_display, xsdo->drawable, fmt,
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    76
                              CPRepeat, &pict_attr);
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    77
  }
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    78
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    79
  (*env)->SetIntField (env, xsd, pictID, xsdo->xrPic);
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    80
  (*env)->SetIntField (env, xsd, xidID, xsdo->drawable);
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    81
#endif /* !HEADLESS */
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    82
}
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    83
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    84
JNIEXPORT void JNICALL
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    85
Java_sun_java2d_xr_XRSurfaceData_initIDs(JNIEnv *env, jclass xsd)
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    86
{
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    87
#ifndef HEADLESS
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    88
  J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initIDs");
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    89
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    90
  pictID = (*env)->GetFieldID(env, xsd, "picture", "I");
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    91
  xidID = (*env)->GetFieldID(env, xsd, "xid", "I");
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    92
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    93
  XShared_initIDs(env, JNI_FALSE);
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    94
#endif /* !HEADLESS */
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    95
}
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    96
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    97
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    98
JNIEXPORT void JNICALL
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
    99
Java_sun_java2d_xr_XRSurfaceData_XRInitSurface(JNIEnv *env, jclass xsd,
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   100
                                               jint depth,
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   101
                                               jint width, jint height,
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   102
                                               jlong drawable, jint pictFormat)
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   103
{
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   104
#ifndef HEADLESS
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   105
    X11SDOps *xsdo;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   106
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   107
    J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initSurface");
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   108
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   109
    xsdo = X11SurfaceData_GetOps(env, xsd);
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   110
    if (xsdo == NULL) {
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   111
        return;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   112
    }
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   113
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   114
    XShared_initSurface(env, xsdo, depth, width, height, drawable);
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   115
#endif /* !HEADLESS */
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
diff changeset
   116
}
8507
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   117
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   118
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   119
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   120
JNIEXPORT void JNICALL
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   121
Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture(JNIEnv *env, jobject xsd,
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   122
                                                  jlong pXSData)
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   123
{
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   124
#ifndef HEADLESS
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   125
    X11SDOps *xsdo;
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   126
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   127
    J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_freeXSDOPicture");
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   128
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   129
    xsdo = X11SurfaceData_GetOps(env, xsd);
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   130
    if (xsdo == NULL) {
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   131
        return;
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   132
    }
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   133
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   134
    if(xsdo->xrPic != None) {
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   135
       XRenderFreePicture(awt_display, xsdo->xrPic);
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   136
       xsdo->xrPic = None;
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   137
    }
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   138
#endif /* !HEADLESS */
78ea3ec4877b 6974985: Jave2Demo threw exceptions when xrender enabled in OEL5.5
ceisserer
parents: 6374
diff changeset
   139
}