author | ohair |
Tue, 28 Dec 2010 15:53:50 -0800 | |
changeset 7668 | d4a77089c587 |
parent 5580 | 629274e4c99f |
permissions | -rw-r--r-- |
557
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
1 |
/* |
7668 | 2 |
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
557
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
4 |
* |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
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 |
557
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
557
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
10 |
* |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
15 |
* accompanied this code). |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
16 |
* |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
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. |
|
557
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
24 |
*/ |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
25 |
|
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
26 |
|
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
27 |
package sun.java2d; |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
28 |
|
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
29 |
import java.awt.GraphicsConfiguration; |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
30 |
|
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
31 |
import sun.awt.image.SunVolatileImage; |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
32 |
import sun.awt.image.VolatileSurfaceManager; |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
33 |
import sun.java2d.opengl.GLXGraphicsConfig; |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
34 |
import sun.java2d.opengl.GLXVolatileSurfaceManager; |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
35 |
import sun.java2d.x11.X11VolatileSurfaceManager; |
5579
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
557
diff
changeset
|
36 |
import sun.java2d.xr.*; |
557
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
37 |
|
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
38 |
/** |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
39 |
* The SurfaceManagerFactory that creates VolatileSurfaceManager |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
40 |
* implementations for the Unix volatile images. |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
41 |
*/ |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
42 |
public class UnixSurfaceManagerFactory extends SurfaceManagerFactory { |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
43 |
|
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
44 |
/** |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
45 |
* Creates a new instance of a VolatileSurfaceManager given any |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
46 |
* arbitrary SunVolatileImage. An optional context Object can be supplied |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
47 |
* as a way for the caller to pass pipeline-specific context data to |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
48 |
* the VolatileSurfaceManager (such as a backbuffer handle, for example). |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
49 |
* |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
50 |
* For Unix platforms, this method returns either an X11- or a GLX- |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
51 |
* specific VolatileSurfaceManager based on the GraphicsConfiguration |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
52 |
* under which the SunVolatileImage was created. |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
53 |
*/ |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
54 |
public VolatileSurfaceManager createVolatileManager(SunVolatileImage vImg, |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
55 |
Object context) |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
56 |
{ |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
57 |
GraphicsConfiguration gc = vImg.getGraphicsConfig(); |
5579
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
557
diff
changeset
|
58 |
|
557
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
59 |
if (gc instanceof GLXGraphicsConfig) { |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
60 |
return new GLXVolatileSurfaceManager(vImg, context); |
5579
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
557
diff
changeset
|
61 |
} else if(gc instanceof XRGraphicsConfig) { |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
557
diff
changeset
|
62 |
return new XRVolatileSurfaceManager(vImg, context); |
1a5e995a710b
6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents:
557
diff
changeset
|
63 |
}else { |
557
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
64 |
return new X11VolatileSurfaceManager(vImg, context); |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
65 |
} |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
66 |
} |
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
67 |
|
800259d3792b
6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents:
diff
changeset
|
68 |
} |