author | ohair |
Wed, 06 Apr 2011 22:06:11 -0700 | |
changeset 9035 | 1255eb81cc2f |
parent 8356 | 64c792dbf671 |
child 11103 | e156ce2c4a96 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
9035
1255eb81cc2f
7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents:
8356
diff
changeset
|
2 |
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
#include "SurfaceData.h" |
|
27 |
||
28 |
#include "awt_p.h" |
|
29 |
#include "awt_GraphicsEnv.h" |
|
30 |
||
31 |
#include <jdga.h> |
|
32 |
||
5579
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
33 |
#include <X11/extensions/Xrender.h> |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
34 |
|
2 | 35 |
/** |
36 |
* This include file contains support declarations for loops using the |
|
37 |
* X11 extended SurfaceData interface to talk to an X11 drawable from |
|
38 |
* native code. |
|
39 |
*/ |
|
40 |
||
41 |
#ifdef HEADLESS |
|
42 |
#define X11SDOps void |
|
43 |
#else /* HEADLESS */ |
|
44 |
typedef struct _X11SDOps X11SDOps; |
|
45 |
||
46 |
/* |
|
47 |
* This function returns an X11 Drawable which transparent pixels |
|
48 |
* (if there are any) were set to the specified color. |
|
49 |
* |
|
50 |
* The env parameter should be the JNIEnv of the surrounding JNI context. |
|
51 |
* |
|
52 |
* The xsdo parameter should be a pointer to the ops object upon which |
|
53 |
* this function is being invoked. |
|
54 |
* |
|
55 |
* The pixel parameter should be a color to which the transparent |
|
56 |
* pixels of the image should be se set to. |
|
57 |
*/ |
|
58 |
typedef Drawable GetPixmapBgFunc(JNIEnv *env, |
|
59 |
X11SDOps *xsdo, |
|
60 |
jint pixel); |
|
61 |
||
62 |
/* |
|
63 |
* This function releases the lock set by GetPixmapBg |
|
64 |
* function of the indicated X11SDOps structure. |
|
65 |
* |
|
66 |
* The env parameter should be the JNIEnv of the surrounding JNI context. |
|
67 |
* |
|
68 |
* The ops parameter should be a pointer to the ops object upon which |
|
69 |
* this function is being invoked. |
|
70 |
*/ |
|
71 |
typedef void ReleasePixmapBgFunc(JNIEnv *env, |
|
72 |
X11SDOps *xsdo); |
|
73 |
||
74 |
||
75 |
#ifdef MITSHM |
|
76 |
typedef struct { |
|
77 |
XShmSegmentInfo *shmSegInfo; /* Shared Memory Segment Info */ |
|
78 |
jint bytesPerLine; /* needed for ShMem lock */ |
|
79 |
jboolean xRequestSent; /* true if x request is sent w/o XSync */ |
|
80 |
jint pmSize; |
|
81 |
||
82 |
jboolean usingShmPixmap; |
|
83 |
Drawable pixmap; |
|
84 |
Drawable shmPixmap; |
|
85 |
jint numBltsSinceRead; |
|
86 |
jint pixelsReadSinceBlt; |
|
87 |
jint pixelsReadThreshold; |
|
88 |
jint numBltsThreshold; |
|
89 |
} ShmPixmapData; |
|
90 |
#endif /* MITSHM */ |
|
91 |
||
92 |
struct _X11SDOps { |
|
93 |
SurfaceDataOps sdOps; |
|
94 |
GetPixmapBgFunc *GetPixmapWithBg; |
|
95 |
ReleasePixmapBgFunc *ReleasePixmapWithBg; |
|
96 |
jboolean invalid; |
|
97 |
jboolean isPixmap; |
|
98 |
jobject peer; |
|
99 |
Drawable drawable; |
|
100 |
Widget widget; |
|
101 |
GC javaGC; /* used for Java-level GC validation */ |
|
102 |
GC cachedGC; /* cached for use in X11SD_Unlock() */ |
|
103 |
jint depth; |
|
104 |
jint pixelmask; |
|
105 |
JDgaSurfaceInfo surfInfo; |
|
106 |
AwtGraphicsConfigData *configData; |
|
107 |
ColorData *cData; |
|
108 |
jboolean dgaAvailable; |
|
109 |
void *dgaDev; |
|
110 |
Pixmap bitmask; |
|
111 |
jint bgPixel; /* bg pixel for the pixmap */ |
|
112 |
jboolean isBgInitialized; /* whether the bg pixel is valid */ |
|
113 |
jint pmWidth; /* width, height of the */ |
|
114 |
jint pmHeight; /* pixmap */ |
|
5579
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
115 |
Picture xrPic; |
2 | 116 |
#ifdef MITSHM |
117 |
ShmPixmapData shmPMData; /* data for switching between shm/nonshm pixmaps*/ |
|
118 |
#endif /* MITSHM */ |
|
119 |
}; |
|
120 |
||
121 |
#define X11SD_LOCK_UNLOCKED 0 /* surface is not locked */ |
|
122 |
#define X11SD_LOCK_BY_NULL 1 /* surface locked for NOP */ |
|
123 |
#define X11SD_LOCK_BY_XIMAGE 2 /* surface locked by Get/PutImage */ |
|
124 |
#define X11SD_LOCK_BY_DGA 3 /* surface locked by DGA */ |
|
125 |
#define X11SD_LOCK_BY_SHMEM 4 /* surface locked by ShMemExt */ |
|
126 |
||
127 |
#ifdef MITSHM |
|
8356
64c792dbf671
7018364: XShmGetImage with image's > drawable's size causes BadMatch
prr
parents:
7668
diff
changeset
|
128 |
XImage * X11SD_GetSharedImage (X11SDOps *xsdo, |
64c792dbf671
7018364: XShmGetImage with image's > drawable's size causes BadMatch
prr
parents:
7668
diff
changeset
|
129 |
jint width, jint height, |
64c792dbf671
7018364: XShmGetImage with image's > drawable's size causes BadMatch
prr
parents:
7668
diff
changeset
|
130 |
jint maxWidth, jint maxHeight, |
64c792dbf671
7018364: XShmGetImage with image's > drawable's size causes BadMatch
prr
parents:
7668
diff
changeset
|
131 |
jboolean readBits); |
2 | 132 |
XImage * X11SD_CreateSharedImage (X11SDOps *xsdo, jint width, jint height); |
133 |
Drawable X11SD_CreateSharedPixmap (X11SDOps *xsdo); |
|
134 |
void X11SD_DropSharedSegment (XShmSegmentInfo *shminfo); |
|
135 |
void X11SD_PuntPixmap (X11SDOps *xsdo, jint width, jint height); |
|
136 |
void X11SD_UnPuntPixmap (X11SDOps *xsdo); |
|
8356
64c792dbf671
7018364: XShmGetImage with image's > drawable's size causes BadMatch
prr
parents:
7668
diff
changeset
|
137 |
jboolean X11SD_CachedXImageFits (jint width, jint height, |
64c792dbf671
7018364: XShmGetImage with image's > drawable's size causes BadMatch
prr
parents:
7668
diff
changeset
|
138 |
jint maxWidth, jint maxHeight, |
64c792dbf671
7018364: XShmGetImage with image's > drawable's size causes BadMatch
prr
parents:
7668
diff
changeset
|
139 |
jint depth, jboolean readBits); |
2 | 140 |
XImage * X11SD_GetCachedXImage (jint width, jint height, jboolean readBits); |
141 |
#endif /* MITSHM */ |
|
8356
64c792dbf671
7018364: XShmGetImage with image's > drawable's size causes BadMatch
prr
parents:
7668
diff
changeset
|
142 |
jint X11SD_InitWindow(JNIEnv *env, X11SDOps *xsdo); |
2 | 143 |
void X11SD_DisposeOrCacheXImage (XImage * image); |
144 |
void X11SD_DisposeXImage(XImage * image); |
|
145 |
void X11SD_DirectRenderNotify(JNIEnv *env, X11SDOps *xsdo); |
|
146 |
#endif /* !HEADLESS */ |
|
147 |
||
5579
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
148 |
jboolean XShared_initIDs(JNIEnv *env, jboolean allowShmPixmaps); |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
149 |
jboolean XShared_initSurface(JNIEnv *env, X11SDOps *xsdo, jint depth, jint width, jint height, jlong drawable); |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
2
diff
changeset
|
150 |
|
2 | 151 |
/* |
152 |
* This function returns a pointer to a native X11SDOps structure |
|
153 |
* for accessing the indicated X11 SurfaceData Java object. It |
|
154 |
* verifies that the indicated SurfaceData object is an instance |
|
155 |
* of X11SurfaceData before returning and will return NULL if the |
|
156 |
* wrong SurfaceData object is being accessed. This function will |
|
157 |
* throw the appropriate Java exception if it returns NULL so that |
|
158 |
* the caller can simply return. |
|
159 |
* |
|
160 |
* Note to callers: |
|
161 |
* This function uses JNI methods so it is important that the |
|
162 |
* caller not have any outstanding GetPrimitiveArrayCritical or |
|
163 |
* GetStringCritical locks which have not been released. |
|
164 |
* |
|
165 |
* The caller may continue to use JNI methods after this method |
|
166 |
* is called since this function will not leave any outstanding |
|
167 |
* JNI Critical locks unreleased. |
|
168 |
*/ |
|
169 |
JNIEXPORT X11SDOps * JNICALL |
|
170 |
X11SurfaceData_GetOps(JNIEnv *env, jobject sData); |