/*
* 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.
*/
/**
* defines interface for primitives which can be placed into
* the graphic component manager framework
*/
public abstract class GraphicsPrimitive {
protected static interface GeneralBinaryOp {
/**
* This method allows the setupGeneralBinaryOp method to set
* the converters into the General version of the Primitive.
*/
/**
* These 4 methods are implemented automatically for any
* GraphicsPrimitive. They are used by setupGeneralBinaryOp
* to retrieve the information needed to find the right
* converter primitives.
*/
public int getPrimTypeID();
}
protected static interface GeneralUnaryOp {
/**
* This method allows the setupGeneralUnaryOp method to set
* the converters into the General version of the Primitive.
*/
/**
* These 3 methods are implemented automatically for any
* GraphicsPrimitive. They are used by setupGeneralUnaryOp
* to retrieve the information needed to find the right
* converter primitives.
*/
public int getPrimTypeID();
}
/**
* INSTANCE DATA MEMBERS DESCRIBING CHARACTERISTICS OF THIS PRIMITIVE
**/
// Making these be instance data members (instead of virtual methods
// overridden by subclasses) is actually cheaper, since each class
// is a singleton. As instance data members with final accessors,
// accesses can be inlined.
private int uniqueID;
public synchronized static final int makePrimTypeID() {
if (unusedPrimID > 255) {
throw new InternalError("primitive id overflow");
}
return unusedPrimID++;
}
{
return (primTypeID << 24) |
(src.getUniqueID());
}
/**
* Create a new GraphicsPrimitive with all of the required
* descriptive information.
*/
int primTypeID,
{
this.methodSignature = methodSignature;
this.sourceType = sourceType;
this.compositeType = compositeType;
} else {
destType);
}
}
/**
* Create a new GraphicsPrimitive for native invocation
* with all of the required descriptive information.
*/
int primTypeID,
{
this.pNativePrim = pNativePrim;
this.methodSignature = methodSignature;
this.sourceType = sourceType;
this.compositeType = compositeType;
} else {
destType);
}
}
/**
* METHODS TO DESCRIBE THE SURFACES PRIMITIVES
* CAN OPERATE ON AND THE FUNCTIONALITY THEY IMPLEMENT
**/
/**
* Gets instance ID of this graphics primitive.
*
* Instance ID is comprised of four distinct ids (ORed together)
* that uniquely identify each instance of a GraphicsPrimitive
* object. The four ids making up instance ID are:
* 1. primitive id - identifier shared by all primitives of the
* same type (eg. all Blits have the same primitive id)
* 2. sourcetype id - identifies source surface type
* 3. desttype id - identifies destination surface type
* 4. compositetype id - identifies composite used
*
* @return instance ID
*/
public final int getUniqueID() {
return uniqueID;
}
/**
*/
return methodSignature;
}
/**
* Gets unique id for this GraphicsPrimitive type.
*
* This id is used to identify the TYPE of primitive (Blit vs. BlitBg)
* as opposed to INSTANCE of primitive.
*
* @return primitive ID
*/
public final int getPrimTypeID() {
return uniqueID >>> 24;
}
/**
*/
public final long getNativePrim() {
return pNativePrim;
}
/**
*/
return sourceType;
}
/**
*/
return compositeType;
}
/**
*/
return destType;
}
/**
* Return true if this primitive can be used for the given signature
* surfaces, and composite.
*
* @param signature The signature of the given operation. Must be
* == (not just .equals) the signature string given by the
* abstract class that declares the operation.
* @param srctype The surface type for the source of the operation
* @param comptype The composite type for the operation
* @param dsttype The surface type for the destination of the operation
*/
{
if (signature != methodSignature) {
return false;
}
while (true) {
return false;
}
break;
}
}
while (true) {
return false;
}
break;
}
}
while (true) {
return false;
}
break;
}
}
return true;
}
//
// A version of satisfies used for regression testing
//
}
public static int traceflags;
static {
boolean verbose = false;
int traceflags = 0;
while (st.hasMoreTokens()) {
verbose = true;
} else {
}
"[log[,timestamp]],[count],"+
"[out:<filename>],[help],[verbose]");
}
}
if (verbose) {
} else {
}
} else {
}
} else {
}
} else {
}
}
}
}
public static boolean tracingEnabled() {
return (traceflags != 0);
}
Object o =
try {
return new FileOutputStream(tracefile);
} catch (FileNotFoundException e) {
return null;
}
}
});
if (o != null) {
} else {
}
} else {
}
}
return traceout;
}
public static void setShutdownHook() {
TraceReporter t = new TraceReporter();
return null;
}
});
}
public void run() {
long total = 0;
int numprims = 0;
} else {
}
numprims++;
}
if (numprims == 0) {
} else if (numprims > 1) {
numprims+" different primitives");
}
}
}
}
if (o == null) {
o = new int[1];
}
((int[]) o)[0]++;
}
}
}
}
convertdst = null;
convertres = null;
} else {
throw new InternalError("Cannot construct general op for "+
}
}
}
throw new InternalError("Cannot construct binary op for "+
}
}
{
return null;
}
throw new InternalError("Cannot construct converter for "+
}
return cv;
}
{
}
{
}
}
}
return dstData;
}
{
}
}
{
}
try {
return f.getName();
}
} catch (Exception e) {
}
}
}
}
}
if (cachedname == null) {
if (index >= 0) {
}
sig+"("+
}
return cachedname;
}
}