Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.h
32288 views
/*1* Copyright (c) 2000, 2011, 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 "SurfaceData.h"2627#include "awt_p.h"28#include "awt_GraphicsEnv.h"2930#include <jdga.h>3132#ifdef HEADLESS33#include "GLXGraphicsConfig.h"34#endif3536#include <X11/extensions/Xrender.h>3738/**39* This include file contains support declarations for loops using the40* X11 extended SurfaceData interface to talk to an X11 drawable from41* native code.42*/4344#ifdef HEADLESS45#define X11SDOps void46#else /* HEADLESS */47typedef struct _X11SDOps X11SDOps;4849/*50* This function returns an X11 Drawable which transparent pixels51* (if there are any) were set to the specified color.52*53* The env parameter should be the JNIEnv of the surrounding JNI context.54*55* The xsdo parameter should be a pointer to the ops object upon which56* this function is being invoked.57*58* The pixel parameter should be a color to which the transparent59* pixels of the image should be se set to.60*/61typedef Drawable GetPixmapBgFunc(JNIEnv *env,62X11SDOps *xsdo,63jint pixel);6465/*66* This function releases the lock set by GetPixmapBg67* function of the indicated X11SDOps structure.68*69* The env parameter should be the JNIEnv of the surrounding JNI context.70*71* The ops parameter should be a pointer to the ops object upon which72* this function is being invoked.73*/74typedef void ReleasePixmapBgFunc(JNIEnv *env,75X11SDOps *xsdo);767778#ifdef MITSHM79typedef struct {80XShmSegmentInfo *shmSegInfo; /* Shared Memory Segment Info */81jint bytesPerLine; /* needed for ShMem lock */82jboolean xRequestSent; /* true if x request is sent w/o XSync */83jlong pmSize;8485jboolean usingShmPixmap;86Drawable pixmap;87Drawable shmPixmap;88jint numBltsSinceRead;89jint pixelsReadSinceBlt;90jint pixelsReadThreshold;91jint numBltsThreshold;92} ShmPixmapData;93#endif /* MITSHM */9495struct _X11SDOps {96SurfaceDataOps sdOps;97GetPixmapBgFunc *GetPixmapWithBg;98ReleasePixmapBgFunc *ReleasePixmapWithBg;99jboolean invalid;100jboolean isPixmap;101jobject peer;102Drawable drawable;103Widget widget;104GC javaGC; /* used for Java-level GC validation */105GC cachedGC; /* cached for use in X11SD_Unlock() */106jint depth;107jint pixelmask;108JDgaSurfaceInfo surfInfo;109AwtGraphicsConfigData *configData;110ColorData *cData;111jboolean dgaAvailable;112void *dgaDev;113Pixmap bitmask;114jint bgPixel; /* bg pixel for the pixmap */115jboolean isBgInitialized; /* whether the bg pixel is valid */116jint pmWidth; /* width, height of the */117jint pmHeight; /* pixmap */118Picture xrPic;119#ifdef MITSHM120ShmPixmapData shmPMData; /* data for switching between shm/nonshm pixmaps*/121#endif /* MITSHM */122};123124#define X11SD_LOCK_UNLOCKED 0 /* surface is not locked */125#define X11SD_LOCK_BY_NULL 1 /* surface locked for NOP */126#define X11SD_LOCK_BY_XIMAGE 2 /* surface locked by Get/PutImage */127#define X11SD_LOCK_BY_DGA 3 /* surface locked by DGA */128#define X11SD_LOCK_BY_SHMEM 4 /* surface locked by ShMemExt */129130#ifdef MITSHM131XImage * X11SD_GetSharedImage (X11SDOps *xsdo,132jint width, jint height,133jint maxWidth, jint maxHeight,134jboolean readBits);135XImage * X11SD_CreateSharedImage (X11SDOps *xsdo, jint width, jint height);136Drawable X11SD_CreateSharedPixmap (X11SDOps *xsdo);137void X11SD_DropSharedSegment (XShmSegmentInfo *shminfo);138void X11SD_PuntPixmap (X11SDOps *xsdo, jint width, jint height);139void X11SD_UnPuntPixmap (X11SDOps *xsdo);140jboolean X11SD_CachedXImageFits (jint width, jint height,141jint maxWidth, jint maxHeight,142jint depth, jboolean readBits);143XImage * X11SD_GetCachedXImage (jint width, jint height, jboolean readBits);144#endif /* MITSHM */145jint X11SD_InitWindow(JNIEnv *env, X11SDOps *xsdo);146void X11SD_DisposeOrCacheXImage (XImage * image);147void X11SD_DisposeXImage(XImage * image);148void X11SD_DirectRenderNotify(JNIEnv *env, X11SDOps *xsdo);149#endif /* !HEADLESS */150151jboolean XShared_initIDs(JNIEnv *env, jboolean allowShmPixmaps);152jboolean XShared_initSurface(JNIEnv *env, X11SDOps *xsdo, jint depth, jint width, jint height, jlong drawable);153154/*155* This function returns a pointer to a native X11SDOps structure156* for accessing the indicated X11 SurfaceData Java object. It157* verifies that the indicated SurfaceData object is an instance158* of X11SurfaceData before returning and will return NULL if the159* wrong SurfaceData object is being accessed. This function will160* throw the appropriate Java exception if it returns NULL so that161* the caller can simply return.162*163* Note to callers:164* This function uses JNI methods so it is important that the165* caller not have any outstanding GetPrimitiveArrayCritical or166* GetStringCritical locks which have not been released.167*168* The caller may continue to use JNI methods after this method169* is called since this function will not leave any outstanding170* JNI Critical locks unreleased.171*/172JNIEXPORT X11SDOps * JNICALL173X11SurfaceData_GetOps(JNIEnv *env, jobject sData);174175176