src/share/classes/sun/java2d/pipe/RenderingEngine.java
Print this page
*** 30,40 ****
import java.awt.geom.PathIterator;
import java.awt.geom.AffineTransform;
import java.security.PrivilegedAction;
import java.security.AccessController;
- import java.util.ServiceLoader;
import sun.security.action.GetPropertyAction;
import sun.awt.geom.PathConsumer2D;
/**
--- 30,39 ----
*** 95,110 ****
* <pre>
* java -Dsun.java2d.renderer=<classname>
* </pre>
*
* If no specific {@code RenderingEngine} is specified on the command
! * or Ductus renderer is specified, it will attempt loading the
! * sun.dc.DuctusRenderingEngine class using Class.forName as a fastpath;
! * if not found, use the ServiceLoader.
! * If no specific {@code RenderingEngine} is specified on the command
! * line then the last one returned by enumerating all subclasses of
! * {@code RenderingEngine} known to the ServiceLoader is used.
* <p>
* Runtime tracing of the actions of the {@code RenderingEngine}
* can be enabled by specifying the runtime flag:
* <pre>
* java -Dsun.java2d.renderer.trace=<any string>
--- 94,106 ----
* <pre>
* java -Dsun.java2d.renderer=<classname>
* </pre>
*
* If no specific {@code RenderingEngine} is specified on the command
! * or Ductus renderer is specified, it will first attempt loading the
! * sun.dc.DuctusRenderingEngine class using Class.forName, if that
! * is not found, then it will look for Pisces.
* <p>
* Runtime tracing of the actions of the {@code RenderingEngine}
* can be enabled by specifying the runtime flag:
* <pre>
* java -Dsun.java2d.renderer.trace=<any string>
*** 118,151 ****
}
reImpl =
AccessController.doPrivileged(new PrivilegedAction<RenderingEngine>() {
public RenderingEngine run() {
final String ductusREClass = "sun.dc.DuctusRenderingEngine";
! String reClass =
! System.getProperty("sun.java2d.renderer", ductusREClass);
! if (reClass.equals(ductusREClass)) {
try {
! Class<?> cls = Class.forName(ductusREClass);
return (RenderingEngine) cls.newInstance();
} catch (ReflectiveOperationException ignored) {
// not found
}
}
! ServiceLoader<RenderingEngine> reLoader =
! ServiceLoader.loadInstalled(RenderingEngine.class);
!
! RenderingEngine service = null;
!
! for (RenderingEngine re : reLoader) {
! service = re;
! if (re.getClass().getName().equals(reClass)) {
! break;
! }
! }
! return service;
}
});
if (reImpl == null) {
throw new InternalError("No RenderingEngine module found");
--- 114,146 ----
}
reImpl =
AccessController.doPrivileged(new PrivilegedAction<RenderingEngine>() {
public RenderingEngine run() {
+ /* Look first for ductus or an app-override renderer,
+ * if not specified or present, then look for pisces.
+ */
final String ductusREClass = "sun.dc.DuctusRenderingEngine";
! final String piscesREClass = "sun.java2d.pisces.PiscesRenderingEngine";
! String reClass = System.getProperty("sun.java2d.renderer");
! if (reClass == null) {
! reClass = ductusREClass;
! }
try {
! Class<?> cls = Class.forName(reClass);
return (RenderingEngine) cls.newInstance();
} catch (ReflectiveOperationException ignored) {
// not found
}
+ try {
+ Class<?> cls = Class.forName(piscesREClass);
+ return (RenderingEngine) cls.newInstance();
+ } catch (ReflectiveOperationException ignored) {
+ // not found
}
! return null;
}
});
if (reImpl == null) {
throw new InternalError("No RenderingEngine module found");