gegl r2772 - in trunk: . bin examples
- From: ok svn gnome org
- To: svn-commits-list gnome org
- Subject: gegl r2772 - in trunk: . bin examples
- Date: Sun, 16 Nov 2008 19:48:36 +0000 (UTC)
Author: ok
Date: Sun Nov 16 19:48:36 2008
New Revision: 2772
URL: http://svn.gnome.org/viewvc/gegl?rev=2772&view=rev
Log:
* bin/gegl-view.c: (gegl_view_class_init), (set_property),
(get_property), (expose_event): added a "block" property that makes
GeglView not blit dirt cache data but always block for a re-render.
* bin/editor.c: (create_window): make the testbed use blocking render.
* examples/gegl-paint.c: (main): make backing buffer be in "RaGaBaA
float".
Modified:
trunk/ChangeLog
trunk/bin/editor.c
trunk/bin/gegl-view.c
trunk/examples/gegl-paint.c
Modified: trunk/bin/editor.c
==============================================================================
--- trunk/bin/editor.c (original)
+++ trunk/bin/editor.c Sun Nov 16 19:48:36 2008
@@ -1801,7 +1801,7 @@
vbox2 = gtk_vbox_new (FALSE, 1);
hpaned_top = gtk_vpaned_new ();
hpaned_top_level = gtk_hpaned_new ();
- view = g_object_new (GEGL_TYPE_VIEW, NULL);
+ view = g_object_new (GEGL_TYPE_VIEW, "block", TRUE, NULL);
property_scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (property_scroll), editor->property_editor);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (property_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
Modified: trunk/bin/gegl-view.c
==============================================================================
--- trunk/bin/gegl-view.c (original)
+++ trunk/bin/gegl-view.c Sun Nov 16 19:48:36 2008
@@ -32,7 +32,8 @@
PROP_NODE,
PROP_X,
PROP_Y,
- PROP_SCALE
+ PROP_SCALE,
+ PROP_BLOCK
};
@@ -42,6 +43,8 @@
gint x;
gint y;
gdouble scale;
+ gboolean block; /* blocking render */
+
gint screen_x; /* coordinates of drag start */
gint screen_y;
@@ -137,6 +140,12 @@
G_TYPE_OBJECT,
G_PARAM_CONSTRUCT |
G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, PROP_BLOCK,
+ g_param_spec_boolean ("block",
+ "Blocking render",
+ "Make sure all data requested to blit is generated.",
+ FALSE,
+ G_PARAM_READWRITE));
gegl_view_signals[DETECTED] =
g_signal_new ("detected",
@@ -253,6 +262,9 @@
priv->x = g_value_get_int (value);
gtk_widget_queue_draw (GTK_WIDGET (self));
break;
+ case PROP_BLOCK:
+ priv->block = g_value_get_boolean (value);
+ break;
case PROP_Y:
priv->y = g_value_get_int (value);
gtk_widget_queue_draw (GTK_WIDGET (self));
@@ -285,6 +297,9 @@
case PROP_X:
g_value_set_int (value, priv->x);
break;
+ case PROP_BLOCK:
+ g_value_set_boolean (value, priv->block);
+ break;
case PROP_Y:
g_value_set_int (value, priv->y);
break;
@@ -449,7 +464,7 @@
babl_format ("R'G'B' u8"),
(gpointer)buf,
GEGL_AUTO_ROWSTRIDE,
- GEGL_BLIT_CACHE|GEGL_BLIT_DIRTY);
+ GEGL_BLIT_CACHE|(priv->block?0:GEGL_BLIT_DIRTY));
gdk_draw_rgb_image (widget->window,
widget->style->black_gc,
Modified: trunk/examples/gegl-paint.c
==============================================================================
--- trunk/examples/gegl-paint.c (original)
+++ trunk/examples/gegl-paint.c Sun Nov 16 19:48:36 2008
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
- * Copyright (C) 2003, 2004, 2006 Ãyvind KolÃs
+ * Copyright (C) 2003, 2004, 2006, 2008 Ãyvind KolÃs
*/
#include <string.h>
@@ -133,19 +133,17 @@
gegl_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window), "GEGL painter");
-
- /*gegl = gegl_node_new_from_xml ("<gegl><rectangle width='512' height='512' color='red'/></gegl>", NULL);*/
+ gtk_window_set_title (GTK_WINDOW (window), "GEGL destructive painter");
if (argv[1] == NULL)
{
- gchar *buf = NULL;
+ gpointer buf;
+
buffer = gegl_buffer_new (&(GeglRectangle){0, 0, 512, 512},
- babl_format("RGBA float"));
- buf = g_malloc(512 * 512);
+ babl_format("RaGaBaA float"));
+ buf = gegl_buffer_linear_open (buffer, NULL, NULL, babl_format ("Y' u8"));
memset (buf, 255, 512 * 512); /* FIXME: we need a babl_buffer_paint () */
- gegl_buffer_set (buffer, NULL, babl_format ("Y' u8"), buf, 0);
- g_free (buf);
+ gegl_buffer_linear_close (buffer, buf);
}
else
{
@@ -185,7 +183,6 @@
g_object_unref (gegl);
gegl_buffer_destroy (buffer);
-
gegl_exit ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]