[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ff-cvs] fenfire/org/fenfire functional/Functional.java ...
From: |
Tuomas J. Lukka |
Subject: |
[ff-cvs] fenfire/org/fenfire functional/Functional.java ... |
Date: |
Fri, 31 Oct 2003 07:30:35 -0500 |
CVSROOT: /cvsroot/fenfire
Module name: fenfire
Branch:
Changes by: Tuomas J. Lukka <address@hidden> 03/10/31 07:30:35
Modified files:
org/fenfire/functional: Functional.java
org/fenfire/spanimages/gl: benchpapers.py
org/fenfire/util: PaperMillFunction.java
Log message:
Sync
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/functional/Functional.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/spanimages/gl/benchpapers.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/util/PaperMillFunction.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: fenfire/org/fenfire/functional/Functional.java
diff -u fenfire/org/fenfire/functional/Functional.java:1.4
fenfire/org/fenfire/functional/Functional.java:1.5
--- fenfire/org/fenfire/functional/Functional.java:1.4 Sat Oct 18 02:06:30 2003
+++ fenfire/org/fenfire/functional/Functional.java Fri Oct 31 07:30:34 2003
@@ -27,6 +27,9 @@
package org.fenfire.functional;
import org.fenfire.util.*;
import java.lang.reflect.*;
+import java.util.Collections;
+import java.util.Map;
+import java.util.HashMap;
/** An object that manages a DAG of Function instances, enabling
* transparent and super-lazy caching.
@@ -38,6 +41,36 @@
public static boolean dbg = false;
private void p(String s) { System.out.println(s); }
+ /** The id of the hint for which background thread group
+ * a function should use, if it's not run directly.
+ * This is useful for using Libvob OpenGL, since
+ * OpenGL objects should only be handled in one thread.
+ * The value for the OpenGL thread is "OPENGL".
+ */
+ public final static String HINT_BGGROUP=
+ "urn:urn-5:Avc8CAG5IlAxiPld5A-eHFpe33lA".intern();
+
+ /** The id of the hint about function speed.
+ * If non-null, assumes the function is slow.
+ */
+ public final static String HINT_SLOW=
+ "urn:urn-5:6tZ8QgByvj22e8zbzPb4FMb0ATUJ".intern();
+
+ /** The id of the hint for the placeholder return object.
+ * The object this hint is set to
+ * is returned for super-lazily cached
+ * functions when the value is not in the cache.
+ */
+ public final static String HINT_PLACEHOLDER=
+ "urn:urn-5:VXY-8ssXNGZFa488N3+dpuMK95GE".intern();
+
+ /** The id of the hint for the error placeholder return object.
+ * If an error has occurred evaluating the function,
+ * the value of this hint is returned.
+ */
+ public final static String HINT_ERRORPLACEHOLDER=
+ "urn:urn-5:eqali8fJteYllPEPaU+0jSooXUOP".intern();
+
/** Hints about a Function class.
* Hints tell the Functional API about a Function: is it slow to evaluate,
* does it need to be evaluated in the OpenGL thread &c.
@@ -53,48 +86,34 @@
protected static class DefaultHints implements Hints {
public DefaultHints(HintsMaker maker) {
- this.bgGroup = maker.bgGroup;
- this.isSlow = maker.isSlow;
- this.placeholder = maker.placeholder;
+ hints = Collections.unmodifiableMap(
+ (Map)(maker.hints.clone()));
}
- public final Object bgGroup;
- public final boolean isSlow;
- public final Object placeholder;
+ public final Map hints;
}
/** An interface for creating Hints objects.
+ * This interface is structured so it can be used as follows:
+ * <pre>
+ * public class FooFunction implements Function {
+ * static public Functional.Hints functionalHints =
+ * (new Functional.HintsMaker())
+ * .setHint(Functional.HINT_PLACEHOLDER,
"X")
+ * .setHint(Functional.HINT_BGGROUP,
"OPENGL")
+ * .make();
+ *
+ * }
+ * </pre>
*/
public static class HintsMaker {
- private Object bgGroup = null;
- private boolean isSlow = false;
- private Object placeholder = null;
-
- /** This function must be run in a background object
- * of the given group if it's not run directly.
- * This is useful for using Libvob OpenGL, since
- * OpenGL objects should only be handled in one thread.
- * Default: null.
- */
- public void setBackgroundGroup(Object id) {
- this.bgGroup = id;
- }
-
- /** Whether this function usually consumes considerable time
- * to generate its output, given all its inputs.
- * Evaluations of functions given as parameters to this function
- * are not counted.
- * Default: not slow.
- */
- public void setSlow(boolean isSlow) {
- this.isSlow = isSlow;
- }
+ HashMap hints = new HashMap();
- /** Set the placeholder object to be returned if the function value
- * is not ready yet.
- * Default: null.
+ /** Set the value of a hint.
+ * @return this object
*/
- public void setPlaceholder(Object o) {
- this.placeholder = o;
+ public HintsMaker setHint(String id, Object value) {
+ hints.put(id, value);
+ return this;
}
/** Create the Hints object.
Index: fenfire/org/fenfire/spanimages/gl/benchpapers.py
diff -u fenfire/org/fenfire/spanimages/gl/benchpapers.py:1.2
fenfire/org/fenfire/spanimages/gl/benchpapers.py:1.3
--- fenfire/org/fenfire/spanimages/gl/benchpapers.py:1.2 Sun Aug 17
15:55:01 2003
+++ fenfire/org/fenfire/spanimages/gl/benchpapers.py Fri Oct 31 07:30:34 2003
@@ -39,6 +39,7 @@
img = scrollimager.getSingleImage(span, poolManager)
poolManager.locked.add(img)
+ # XXX Doesn't work!
img.loader.loadToBaseLevelSynch(0)
spanImageFactory = spi.DefaultSpanImageFactory(scrollimager)
@@ -52,6 +53,8 @@
spanImageFactory.paperMaker = papermakers.fancyHalo(w)
elif paper == 3:
spanImageFactory.paperMaker = papermakers.fancyBlur(w)
+ elif paper == 4:
+ spanImageFactory.paperMaker = papermakers.nvFancyBlur(w)
else: assert 0==1, paper
layout = ff.view.PageSpanLayout(
@@ -66,5 +69,5 @@
args = {
"nquads" : (10, 100),
- "paper" : (0, 1, 2, 3)
+ "paper" : (0, 4)
}
Index: fenfire/org/fenfire/util/PaperMillFunction.java
diff -u fenfire/org/fenfire/util/PaperMillFunction.java:1.2
fenfire/org/fenfire/util/PaperMillFunction.java:1.3
--- fenfire/org/fenfire/util/PaperMillFunction.java:1.2 Sat Oct 18 02:06:31 2003
+++ fenfire/org/fenfire/util/PaperMillFunction.java Fri Oct 31 07:30:35 2003
@@ -38,13 +38,11 @@
private boolean useOptimized;
private PaperMill paperMill;
- static public Functional.Hints functionalHints;
- static {
- Functional.HintsMaker hintsMaker = new Functional.HintsMaker();
- hintsMaker.setBackgroundGroup("OPENGL");
- hintsMaker.setPlaceholder(
- SpecialPapers.solidPaper(java.awt.Color.white));
- }
+ static public Functional.Hints functionalHints =
+ (new Functional.HintsMaker())
+ .setHint(Functional.HINT_BGGROUP, "OPENGL")
+ .setHint(Functional.HINT_PLACEHOLDER, null)
+ .make();
public PaperMillFunction(PaperMill paperMill, boolean useOptimized) {
this.paperMill = paperMill;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [ff-cvs] fenfire/org/fenfire functional/Functional.java ...,
Tuomas J. Lukka <=