gnome-scan r712 - in trunk: . lib
- From: bersace svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-scan r712 - in trunk: . lib
- Date: Sat, 20 Dec 2008 15:23:45 +0000 (UTC)
Author: bersace
Date: Sat Dec 20 15:23:45 2008
New Revision: 712
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=712&view=rev
Log:
Allow scanner not to use gegl op to acquire.
Modified:
trunk/ChangeLog
trunk/lib/gnome-scan-job.vala
trunk/lib/gnome-scan-scanner.vala
Modified: trunk/lib/gnome-scan-job.vala
==============================================================================
--- trunk/lib/gnome-scan-job.vala (original)
+++ trunk/lib/gnome-scan-job.vala Sat Dec 20 15:23:45 2008
@@ -58,6 +58,7 @@
}
private bool cancelled = false;
+ private Gegl.Node load_buffer;
private SList<Gegl.Node> graph;
private Gegl.Node gegl_sink;
private Gegl.Processor processor = null;
@@ -121,9 +122,24 @@
}
}
+ double progress = 0.0;
+ bool scanner_is_node = this._scanner.nodes.length() == 0;
+ if (scanner_is_node) {
+ while(!this.cancelled && this._scanner.work(out progress)) {
+ debug("%.2f%%", progress*100);
+ this._progress = progress/3.0;
+ }
+ this.load_buffer.set("operation", "gegl:load-buffer",
+ "buffer", this._scanner.buffer);
+ }
+
processor = new Gegl.Processor(this.gegl_sink, null);
- while(!this.cancelled && processor.work(out this._progress))
- debug("%.2f%%", this._progress);
+ while(!this.cancelled && processor.work(out progress)) {
+ if (scanner_is_node)
+ this._progress = 0.333 + progress*2/3;
+ else
+ this._progress = progress;
+ }
foreach(weak Gnome.Scan.Node node in this.nodes)
node.end_frame();
@@ -166,32 +182,43 @@
if ((int)this._status < (int)Status.READY)
return;
+ weak Gegl.Node prev = null;
+
// remove all children from current graph
foreach(Gegl.Node node in this.graph) {
- node.disconnect("input");
+ if (prev != null)
+ node.disconnect("input");
+ prev = node;
}
this.graph = null;
// list all nodes
- weak Gegl.Node prev = null;
+ prev = null;
+ if (this._scanner.nodes.length() == 0) {
+ this.load_buffer = new Gegl.Node();
+ this.load_buffer.set("operation", "gegl:load-buffer");
+ prev = this.load_buffer;
+ }
+ else {
+ this.load_buffer = null;
+ }
+
foreach(weak Gnome.Scan.Node gsnode in this.nodes) {
foreach(weak Gegl.Node gnode in gsnode.nodes) {
this.graph.append(gnode);
if (prev != null) {
- debug("Link %s to %s", prev.operation, gnode.operation);
prev.link(gnode);
}
prev = gnode;
}
}
this.gegl_sink = prev;
- debug("Sink is %s", this.gegl_sink.operation);
}
private void check_nodes_status()
{
Status status;
- if (this._scanner == null || this._scanner.nodes.length() == 0
+ if (this._scanner == null
|| this._sink == null || this._sink.nodes.length() == 0)
this.status = Status.UNCONFIGURED;
else {
Modified: trunk/lib/gnome-scan-scanner.vala
==============================================================================
--- trunk/lib/gnome-scan-scanner.vala (original)
+++ trunk/lib/gnome-scan-scanner.vala Sat Dec 20 15:23:45 2008
@@ -26,5 +26,14 @@
public string name {set; get;}
public string blurb {set; get;}
public string icon_name {set; get;}
+ public Gegl.Buffer buffer {set; get;}
+
+ // return true while there is more work to do.
+ public virtual bool work(out double progress)
+ {
+ progress = 1.0;
+ warning("Fake processor for %s", this.get_type().name());
+ return false;
+ }
}
-}
\ No newline at end of file
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]