Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/java2d/x11/XRSurfaceData.c
32288 views
/*1* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#include "GraphicsPrimitiveMgr.h"26#include "Region.h"27#include "Trace.h"28#include "X11SurfaceData.h"2930/*#include <xcb/xcb.h>*/31#include <X11/extensions/Xrender.h>3233#ifndef RepeatNone /* added in 0.10 */34#define RepeatNone 035#define RepeatNormal 136#define RepeatPad 237#define RepeatReflect 338#endif394041#include <sys/uio.h>42#include <dlfcn.h>43#include <setjmp.h>4445#ifndef HEADLESS46jfieldID pictID;47jfieldID xidID;48jfieldID blitMaskPMID;49jfieldID blitMaskPictID;50#endif /* !HEADLESS */5152JNIEXPORT void JNICALL53Java_sun_java2d_xr_XRSurfaceData_initXRPicture(JNIEnv *env, jobject xsd,54jlong pXSData,55jint pictFormat)56{57#ifndef HEADLESS5859X11SDOps *xsdo;60XRenderPictFormat *fmt;6162J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initXRender");6364xsdo = (X11SDOps *) jlong_to_ptr(pXSData);65if (xsdo == NULL) {66return;67}6869if (xsdo->xrPic == None) {70XRenderPictureAttributes pict_attr;71pict_attr.repeat = RepeatNone;72fmt = XRenderFindStandardFormat(awt_display, pictFormat);73xsdo->xrPic =74XRenderCreatePicture(awt_display, xsdo->drawable, fmt,75CPRepeat, &pict_attr);76}7778(*env)->SetIntField (env, xsd, pictID, xsdo->xrPic);79(*env)->SetIntField (env, xsd, xidID, xsdo->drawable);80#endif /* !HEADLESS */81}8283JNIEXPORT void JNICALL84Java_sun_java2d_xr_XRSurfaceData_initIDs(JNIEnv *env, jclass xsd)85{86#ifndef HEADLESS87J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initIDs");8889pictID = (*env)->GetFieldID(env, xsd, "picture", "I");90if (pictID == NULL) {91return;92}93xidID = (*env)->GetFieldID(env, xsd, "xid", "I");94if (xidID == NULL) {95return;96}9798XShared_initIDs(env, JNI_FALSE);99#endif /* !HEADLESS */100}101102103JNIEXPORT void JNICALL104Java_sun_java2d_xr_XRSurfaceData_XRInitSurface(JNIEnv *env, jclass xsd,105jint depth,106jint width, jint height,107jlong drawable, jint pictFormat)108{109#ifndef HEADLESS110X11SDOps *xsdo;111112J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_initSurface");113114xsdo = X11SurfaceData_GetOps(env, xsd);115if (xsdo == NULL) {116return;117}118119XShared_initSurface(env, xsdo, depth, width, height, drawable);120#endif /* !HEADLESS */121}122123124125JNIEXPORT void JNICALL126Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture(JNIEnv *env, jobject xsd,127jlong pXSData)128{129#ifndef HEADLESS130X11SDOps *xsdo;131132J2dTraceLn(J2D_TRACE_INFO, "in XRSurfaceData_freeXSDOPicture");133134xsdo = X11SurfaceData_GetOps(env, xsd);135if (xsdo == NULL) {136return;137}138139if(xsdo->xrPic != None) {140XRenderFreePicture(awt_display, xsdo->xrPic);141xsdo->xrPic = None;142}143#endif /* !HEADLESS */144}145146147