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 23 * questions. 24 */ 25 26 #include "SurfaceData.h" 27 28 #include "awt_p.h" 29 #include "awt_GraphicsEnv.h" 30 31 #include <jdga.h> 32 33 #ifdef HEADLESS 34 #include "GLXGraphicsConfig.h" 35 #endif 36 37 #include <X11/extensions/Xrender.h> 38 39 /** 40 * This include file contains support declarations for loops using the 41 * X11 extended SurfaceData interface to talk to an X11 drawable from 42 * native code. 43 */ 44 45 #ifdef HEADLESS 46 #define X11SDOps void 47 #else /* HEADLESS */ 48 typedef struct _X11SDOps X11SDOps; 49 50 /* 51 * This function returns an X11 Drawable which transparent pixels 52 * (if there are any) were set to the specified color. 88 Drawable shmPixmap; 89 jint numBltsSinceRead; 90 jint pixelsReadSinceBlt; 91 jint pixelsReadThreshold; 92 jint numBltsThreshold; 93 } ShmPixmapData; 94 #endif /* MITSHM */ 95 96 struct _X11SDOps { 97 SurfaceDataOps sdOps; 98 GetPixmapBgFunc *GetPixmapWithBg; 99 ReleasePixmapBgFunc *ReleasePixmapWithBg; 100 jboolean invalid; 101 jboolean isPixmap; 102 jobject peer; 103 Drawable drawable; 104 GC javaGC; /* used for Java-level GC validation */ 105 GC cachedGC; /* cached for use in X11SD_Unlock() */ 106 jint depth; 107 jint pixelmask; 108 JDgaSurfaceInfo surfInfo; 109 AwtGraphicsConfigData *configData; 110 ColorData *cData; 111 jboolean dgaAvailable; 112 void *dgaDev; 113 Pixmap bitmask; 114 jint bgPixel; /* bg pixel for the pixmap */ 115 jboolean isBgInitialized; /* whether the bg pixel is valid */ 116 jint pmWidth; /* width, height of the */ 117 jint pmHeight; /* pixmap */ 118 Picture xrPic; 119 #ifdef MITSHM 120 ShmPixmapData shmPMData; /* data for switching between shm/nonshm pixmaps*/ 121 #endif /* MITSHM */ 122 }; 123 124 #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 */ 129 130 #ifdef MITSHM 131 XImage * X11SD_GetSharedImage (X11SDOps *xsdo, 132 jint width, jint height, 133 jint maxWidth, jint maxHeight, 134 jboolean readBits); 135 XImage * X11SD_CreateSharedImage (X11SDOps *xsdo, jint width, jint height); 136 Drawable X11SD_CreateSharedPixmap (X11SDOps *xsdo); 137 void X11SD_DropSharedSegment (XShmSegmentInfo *shminfo); 138 void X11SD_PuntPixmap (X11SDOps *xsdo, jint width, jint height); 139 void X11SD_UnPuntPixmap (X11SDOps *xsdo); 140 jboolean X11SD_CachedXImageFits (jint width, jint height, 141 jint maxWidth, jint maxHeight, 142 jint depth, jboolean readBits); 143 XImage * X11SD_GetCachedXImage (jint width, jint height, jboolean readBits); 144 #endif /* MITSHM */ 145 jint X11SD_InitWindow(JNIEnv *env, X11SDOps *xsdo); 146 void X11SD_DisposeOrCacheXImage (XImage * image); 147 void X11SD_DisposeXImage(XImage * image); | 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 23 * questions. 24 */ 25 26 #include "SurfaceData.h" 27 28 #include "awt_p.h" 29 #include "awt_GraphicsEnv.h" 30 31 #ifdef HEADLESS 32 #include "GLXGraphicsConfig.h" 33 #endif 34 35 #include <X11/extensions/Xrender.h> 36 37 /** 38 * This include file contains support declarations for loops using the 39 * X11 extended SurfaceData interface to talk to an X11 drawable from 40 * native code. 41 */ 42 43 #ifdef HEADLESS 44 #define X11SDOps void 45 #else /* HEADLESS */ 46 typedef struct _X11SDOps X11SDOps; 47 48 /* 49 * This function returns an X11 Drawable which transparent pixels 50 * (if there are any) were set to the specified color. 86 Drawable shmPixmap; 87 jint numBltsSinceRead; 88 jint pixelsReadSinceBlt; 89 jint pixelsReadThreshold; 90 jint numBltsThreshold; 91 } ShmPixmapData; 92 #endif /* MITSHM */ 93 94 struct _X11SDOps { 95 SurfaceDataOps sdOps; 96 GetPixmapBgFunc *GetPixmapWithBg; 97 ReleasePixmapBgFunc *ReleasePixmapWithBg; 98 jboolean invalid; 99 jboolean isPixmap; 100 jobject peer; 101 Drawable drawable; 102 GC javaGC; /* used for Java-level GC validation */ 103 GC cachedGC; /* cached for use in X11SD_Unlock() */ 104 jint depth; 105 jint pixelmask; 106 AwtGraphicsConfigData *configData; 107 ColorData *cData; 108 Pixmap bitmask; 109 jint bgPixel; /* bg pixel for the pixmap */ 110 jboolean isBgInitialized; /* whether the bg pixel is valid */ 111 jint pmWidth; /* width, height of the */ 112 jint pmHeight; /* pixmap */ 113 Picture xrPic; 114 #ifdef MITSHM 115 ShmPixmapData shmPMData; /* data for switching between shm/nonshm pixmaps*/ 116 #endif /* MITSHM */ 117 }; 118 119 #define X11SD_LOCK_UNLOCKED 0 /* surface is not locked */ 120 #define X11SD_LOCK_BY_NULL 1 /* surface locked for NOP */ 121 #define X11SD_LOCK_BY_XIMAGE 2 /* surface locked by Get/PutImage */ 122 #define X11SD_LOCK_BY_SHMEM 4 /* surface locked by ShMemExt */ 123 124 #ifdef MITSHM 125 XImage * X11SD_GetSharedImage (X11SDOps *xsdo, 126 jint width, jint height, 127 jint maxWidth, jint maxHeight, 128 jboolean readBits); 129 XImage * X11SD_CreateSharedImage (X11SDOps *xsdo, jint width, jint height); 130 Drawable X11SD_CreateSharedPixmap (X11SDOps *xsdo); 131 void X11SD_DropSharedSegment (XShmSegmentInfo *shminfo); 132 void X11SD_PuntPixmap (X11SDOps *xsdo, jint width, jint height); 133 void X11SD_UnPuntPixmap (X11SDOps *xsdo); 134 jboolean X11SD_CachedXImageFits (jint width, jint height, 135 jint maxWidth, jint maxHeight, 136 jint depth, jboolean readBits); 137 XImage * X11SD_GetCachedXImage (jint width, jint height, jboolean readBits); 138 #endif /* MITSHM */ 139 jint X11SD_InitWindow(JNIEnv *env, X11SDOps *xsdo); 140 void X11SD_DisposeOrCacheXImage (XImage * image); 141 void X11SD_DisposeXImage(XImage * image); |