[gimp] app: make projection chunk size and display render chunk size configurable
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make projection chunk size and display render chunk size configurable
- Date: Tue, 3 Jun 2014 23:28:06 +0000 (UTC)
commit 2c4d5e4391f0578be4de2ea46e7c8b152b7b31af
Author: Michael Natterer <mitch gimp org>
Date: Wed Jun 4 01:23:41 2014 +0200
app: make projection chunk size and display render chunk size configurable
Set the GIMP_PROJECTION_CHUNK_SIZE and GIMP_DISPLAY_RENDER_BUF_SIZE
environment variables to "WIDTHxHEIGHT".
app/core/gimpprojection.c | 28 +++++++++++++++++++++++++---
app/display/gimpdisplayxfer.c | 26 ++++++++++++++++++++++++++
app/display/gimpdisplayxfer.h | 4 ++--
3 files changed, 53 insertions(+), 5 deletions(-)
---
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 87abc48..d6b435f 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -17,6 +17,9 @@
#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
@@ -44,13 +47,13 @@
#define GIMP_PROJECTION_IDLE_PRIORITY (G_PRIORITY_HIGH_IDLE + 20 + 1)
/* chunk size for one iteration of the chunk renderer */
-#define GIMP_PROJECTION_CHUNK_WIDTH 256
-#define GIMP_PROJECTION_CHUNK_HEIGHT 128
+static gint GIMP_PROJECTION_CHUNK_WIDTH = 256;
+static gint GIMP_PROJECTION_CHUNK_HEIGHT = 128;
/* how much time, in seconds, do we allow chunk rendering to take,
* aiming for 15fps
*/
-#define GIMP_PROJECTION_CHUNK_TIME 0.0666
+static gint GIMP_PROJECTION_CHUNK_TIME = 0.0666;
enum
@@ -176,6 +179,7 @@ gimp_projection_class_init (GimpProjectionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
+ const gchar *env;
projection_signals[UPDATE] =
g_signal_new ("update",
@@ -200,6 +204,24 @@ gimp_projection_class_init (GimpProjectionClass *klass)
g_object_class_override_property (object_class, PROP_BUFFER, "buffer");
g_type_class_add_private (klass, sizeof (GimpProjectionPrivate));
+
+ env = g_getenv ("GIMP_DISPLAY_RENDER_BUF_SIZE");
+ if (env)
+ {
+ gint width = atoi (env);
+ gint height = width;
+
+ env = strchr (env, 'x');
+ if (env)
+ height = atoi (env);
+
+ if (width > 0 && width <= 8192 &&
+ height > 0 && height <= 8192)
+ {
+ GIMP_PROJECTION_CHUNK_WIDTH = width;
+ GIMP_PROJECTION_CHUNK_HEIGHT = height;
+ }
+ }
}
static void
diff --git a/app/display/gimpdisplayxfer.c b/app/display/gimpdisplayxfer.c
index cb2f4a9..352314e 100644
--- a/app/display/gimpdisplayxfer.c
+++ b/app/display/gimpdisplayxfer.c
@@ -17,6 +17,9 @@
#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+
#include <gegl.h>
#include <gtk/gtk.h>
@@ -52,6 +55,10 @@ struct _GimpDisplayXfer
};
+gint GIMP_DISPLAY_RENDER_BUF_WIDTH = 256;
+gint GIMP_DISPLAY_RENDER_BUF_HEIGHT = 256;
+
+
static RTreeNode *
rtree_node_create (RTree *rtree,
RTreeNode **prev,
@@ -203,6 +210,25 @@ gimp_display_xfer_realize (GtkWidget *widget)
{
GdkScreen *screen;
GimpDisplayXfer *xfer;
+ const gchar *env;
+
+ env = g_getenv ("GIMP_DISPLAY_RENDER_BUF_SIZE");
+ if (env)
+ {
+ gint width = atoi (env);
+ gint height = width;
+
+ env = strchr (env, 'x');
+ if (env)
+ height = atoi (env);
+
+ if (width > 0 && width <= 8192 &&
+ height > 0 && height <= 8192)
+ {
+ GIMP_DISPLAY_RENDER_BUF_WIDTH = width;
+ GIMP_DISPLAY_RENDER_BUF_HEIGHT = height;
+ }
+ }
screen = gtk_widget_get_screen (widget);
xfer = g_object_get_data (G_OBJECT (screen), "gimp-display-xfer");
diff --git a/app/display/gimpdisplayxfer.h b/app/display/gimpdisplayxfer.h
index df1b890..f380b33 100644
--- a/app/display/gimpdisplayxfer.h
+++ b/app/display/gimpdisplayxfer.h
@@ -19,8 +19,8 @@
#define __GIMP_DISPLAY_XFER_H__
-#define GIMP_DISPLAY_RENDER_BUF_WIDTH 256
-#define GIMP_DISPLAY_RENDER_BUF_HEIGHT 256
+extern gint GIMP_DISPLAY_RENDER_BUF_WIDTH;
+extern gint GIMP_DISPLAY_RENDER_BUF_HEIGHT;
#define GIMP_DISPLAY_RENDER_MAX_SCALE 4.0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]