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".
This commit is contained in:
Michael Natterer
2014-06-04 01:23:41 +02:00
parent e2628b9bd0
commit 2c4d5e4391
3 changed files with 53 additions and 5 deletions

View File

@ -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

View File

@ -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");

View File

@ -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