[gegl] buffer: add files missing from previous commit
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: add files missing from previous commit
- Date: Mon, 24 Sep 2018 13:49:55 +0000 (UTC)
commit d903c54895972ac6849c8c4414f765ad279d95d2
Author: Øyvind Kolås <pippin gimp org>
Date: Mon Sep 24 15:49:37 2018 +0200
buffer: add files missing from previous commit
gegl/buffer/gegl-buffer-config.c | 206 +++++++++++++++++++++++++++++++++++++++
gegl/buffer/gegl-buffer-config.h | 62 ++++++++++++
2 files changed, 268 insertions(+)
---
diff --git a/gegl/buffer/gegl-buffer-config.c b/gegl/buffer/gegl-buffer-config.c
new file mode 100644
index 000000000..deea092fc
--- /dev/null
+++ b/gegl/buffer/gegl-buffer-config.c
@@ -0,0 +1,206 @@
+/* This file is part of GEGL.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
+ *
+ * Copyright 2006, 2007, 2018 Øyvind Kolås <pippin gimp org>
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <glib-object.h>
+#include <glib/gprintf.h>
+
+#include "gegl.h"
+#include "gegl-buffer-config.h"
+
+#include "opencl/gegl-cl.h"
+
+G_DEFINE_TYPE (GeglBufferConfig, gegl_buffer_config, G_TYPE_OBJECT)
+
+static GObjectClass * parent_class = NULL;
+
+enum
+{
+ PROP_0,
+ PROP_TILE_CACHE_SIZE,
+ PROP_SWAP,
+ PROP_TILE_WIDTH,
+ PROP_TILE_HEIGHT,
+ PROP_QUEUE_SIZE,
+};
+
+static void
+gegl_buffer_config_get_property (GObject *gobject,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GeglBufferConfig *config = GEGL_BUFFER_CONFIG (gobject);
+
+ switch (property_id)
+ {
+ case PROP_TILE_CACHE_SIZE:
+ g_value_set_uint64 (value, config->tile_cache_size);
+ break;
+
+ case PROP_TILE_WIDTH:
+ g_value_set_int (value, config->tile_width);
+ break;
+
+ case PROP_TILE_HEIGHT:
+ g_value_set_int (value, config->tile_height);
+ break;
+
+ case PROP_SWAP:
+ g_value_set_string (value, config->swap);
+ break;
+
+ case PROP_QUEUE_SIZE:
+ g_value_set_int (value, config->queue_size);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gegl_buffer_config_set_property (GObject *gobject,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GeglBufferConfig *config = GEGL_BUFFER_CONFIG (gobject);
+
+ switch (property_id)
+ {
+ case PROP_TILE_CACHE_SIZE:
+ config->tile_cache_size = g_value_get_uint64 (value);
+ break;
+ case PROP_TILE_WIDTH:
+ config->tile_width = g_value_get_int (value);
+ break;
+ case PROP_TILE_HEIGHT:
+ config->tile_height = g_value_get_int (value);
+ break;
+ case PROP_QUEUE_SIZE:
+ config->queue_size = g_value_get_int (value);
+ break;
+ case PROP_SWAP:
+ g_free (config->swap);
+ config->swap = g_value_dup_string (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gegl_buffer_config_finalize (GObject *gobject)
+{
+ GeglBufferConfig *config = GEGL_BUFFER_CONFIG (gobject);
+
+ g_free (config->swap);
+
+ G_OBJECT_CLASS (gegl_buffer_config_parent_class)->finalize (gobject);
+}
+
+static void
+gegl_buffer_config_class_init (GeglBufferConfigClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ gobject_class->set_property = gegl_buffer_config_set_property;
+ gobject_class->get_property = gegl_buffer_config_get_property;
+ gobject_class->finalize = gegl_buffer_config_finalize;
+
+
+ g_object_class_install_property (gobject_class, PROP_TILE_WIDTH,
+ g_param_spec_int ("tile-width",
+ "Tile width",
+ "default tile width for created buffers.",
+ 0, G_MAXINT, 128,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (gobject_class, PROP_TILE_HEIGHT,
+ g_param_spec_int ("tile-height",
+ "Tile height",
+ "default tile height for created buffers.",
+ 0, G_MAXINT, 128,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (gobject_class, PROP_TILE_CACHE_SIZE,
+ g_param_spec_uint64 ("tile-cache-size",
+ "Tile Cache size",
+ "size of tile cache in bytes",
+ 0, G_MAXUINT64, 512 * 1024 * 1024,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (gobject_class, PROP_SWAP,
+ g_param_spec_string ("swap",
+ "Swap",
+ "where gegl stores it's swap files",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (gobject_class, PROP_QUEUE_SIZE,
+ g_param_spec_int ("queue-size",
+ "Queue size",
+ "Maximum size of a file backend's writer thread queue
(in bytes)",
+ 2, G_MAXINT, 50 * 1024 *1024,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+}
+
+static void
+gegl_buffer_config_init (GeglBufferConfig *self)
+{
+}
+
+
+static GeglBufferConfig *config = NULL;
+
+
+static void gegl_buffer_config_set_defaults (GeglBufferConfig *config)
+{
+ gchar *swapdir = g_build_filename (g_get_user_cache_dir(),
+ GEGL_LIBRARY,
+ "swap",
+ NULL);
+ g_object_set (config,
+ "swap", swapdir,
+ NULL);
+
+ g_free (swapdir);
+}
+
+GeglBufferConfig *gegl_buffer_config (void)
+{
+ if (!config)
+ {
+ config = g_object_new (GEGL_TYPE_BUFFER_CONFIG, NULL);
+ gegl_buffer_config_set_defaults (config);
+ }
+ return config;
+}
diff --git a/gegl/buffer/gegl-buffer-config.h b/gegl/buffer/gegl-buffer-config.h
new file mode 100644
index 000000000..5e3855c00
--- /dev/null
+++ b/gegl/buffer/gegl-buffer-config.h
@@ -0,0 +1,62 @@
+/* This file is part of GEGL.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
+ *
+ * Copyright 2006, 2007 Øyvind Kolås <pippin gimp org>
+ */
+
+#ifndef __GEGL_BUFFER_CONFIG_H__
+#define __GEGL_BUFFER_CONFIG_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GEGL_BUFFER_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_BUFFER_CONFIG,
GeglBufferConfigClass))
+#define GEGL_IS_BUFFER_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_BUFFER_CONFIG))
+#define GEGL_BUFFER_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_BUFFER_CONFIG,
GeglBufferConfigClass))
+GType gegl_buffer_config_get_type (void) G_GNUC_CONST;
+#define GEGL_TYPE_BUFFER_CONFIG (gegl_buffer_config_get_type ())
+#define GEGL_BUFFER_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_BUFFER_CONFIG,
GeglBufferConfig))
+#define GEGL_IS_BUFFER_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_BUFFER_CONFIG))
+
+
+typedef struct _GeglBufferConfig GeglBufferConfig;
+
+
+
+typedef struct _GeglBufferConfigClass GeglBufferConfigClass;
+
+struct _GeglBufferConfig
+{
+ GObject parent_instance;
+
+ gchar *swap;
+ guint64 tile_cache_size;
+ gint tile_width;
+ gint tile_height;
+ gint queue_size;
+};
+
+struct _GeglBufferConfigClass
+{
+ GObjectClass parent_class;
+};
+
+GeglBufferConfig *gegl_buffer_config (void);
+
+G_END_DECLS
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]