/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @author Charlton Innovations, Inc.
*/
/**
* GraphicsComponentMgr provides services to
* 1. register primitives for later use
* 2. locate an instance of a primitve based on characteristics
*/
public final class GraphicsPrimitiveMgr {
private static final boolean debugTrace = false;
private static boolean needssort = true;
private static native void registerNativeLoops();
static {
initIDs(GraphicsPrimitive.class,
SurfaceType.class,
CompositeType.class,
SunGraphics2D.class,
XORComposite.class,
}
private static class PrimitiveSpec {
public int uniqueID;
}
}
};
}
};
/**
* Ensure that noone can instantiate this class.
*/
private GraphicsPrimitiveMgr() {
}
{
int oldSize = 0;
if (debugTrace) {
for (int i = 0; i < newSize; i++) {
}
}
if (devCollection != null) {
}
if (devCollection != null) {
}
needssort = true;
primitives = temp;
}
if (generalPrimitives == null) {
return;
}
}
{
return locate(primTypeID,
dsttype);
}
{
/*
System.out.println("Looking for:");
System.out.println(" method: "+signature);
System.out.println(" from: "+srctype);
System.out.println(" by: "+comptype);
System.out.println(" to: "+dsttype);
*/
//System.out.println("Trying general loop");
}
}
}
return prim;
}
public synchronized static GraphicsPrimitive
{
/*
System.out.println("Looking for:");
System.out.println(" method: "+signature);
System.out.println(" from: "+srctype);
System.out.println(" by: "+comptype);
System.out.println(" to: "+dsttype);
*/
/*
System.out.println("Trying:");
System.out.println(" method: "+spec.methodSignature);
System.out.println(" from: "+spec.sourceType);
System.out.println(" by: "+spec.compType);
System.out.println(" to: "+spec.destType);
*/
//System.out.println("<GPMgr> Found: " + prim + " in " + i + " steps");
return prim;
}
}
}
}
return null;
}
if (generalPrimitives == null) {
return null;
}
return prim;
}
}
return null;
//throw new InternalError("No general handler registered for"+signature);
}
if (needssort) {
}
}
needssort = false;
}
if (devCollection == null) {
return null;
}
if (index >= 0) {
if (prim instanceof GraphicsPrimitiveProxy) {
if (debugTrace) {
}
}
if (debugTrace) {
}
return prim;
}
if (debugTrace) {
writeLog("Lookup found nothing for:");
}
return null;
}
if (debugTrace) {
}
}
/**
* Test that all of the GraphicsPrimitiveProxy objects actually
* resolve to something. Throws a RuntimeException if anything
* is wrong, an has no effect if all is well.
*/
// This is only really meant to be called from GraphicsPrimitiveProxyTest
// in the regression tests directory, but it has to be here because
// it needs access to a private data structure. It is not very
// big, though.
public static void testPrimitiveInstantiation() {
testPrimitiveInstantiation(false);
}
int resolved = 0;
int unresolved = 0;
GraphicsPrimitive p = prims[j];
if (p instanceof GraphicsPrimitiveProxy) {
r.getUniqueID() != p.getUniqueID()) {
throw new RuntimeException("Primitive " + p
+ " returns wrong signature for "
+ r.getClass());
}
// instantiate checks that p.satisfiesSameAs(r)
unresolved++;
p = r;
if (verbose) {
}
} else {
if (verbose) {
}
resolved++;
}
}
" graphics primitives were not proxied.");
" proxied graphics primitives resolved correctly.");
" total graphics primitives");
}
// REMIND: Should trigger loading of platform primitives somehow...
if (needssort) {
needssort = false;
}
}
}