summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>2016-03-06 17:06:38 -0800
committerSøren Sandmann Pedersen <soren.sandmann@gmail.com>2016-03-11 00:00:45 -0500
commit69f2e9b8d2eed96bf1bb3f8c779df38e6957d9be (patch)
tree10bf5e5a240dc67be92f1839e5298e0bdc650614
parentff3f8238ace11b1ff804087ede4d109dc26d6081 (diff)
demos/scale: Only generate filters when used for separable
This makes the speed of the demo more accurate, as the filter generation is a visible fraction of the time it takes to do a transform. This also prevents the output of unused filters in the gnuplot option in the next patch. Note this is not dependent on other patches, as use can choose linear and bilinear in the existing version. Signed-off-by: Bill Spitzak <spitzak@gmail.com> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
-rw-r--r--demos/scale.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/demos/scale.c b/demos/scale.c
index 85c12e42..0c6b533f 100644
--- a/demos/scale.c
+++ b/demos/scale.c
@@ -256,16 +256,25 @@ rescale (GtkWidget *may_be_null, app_t *app)
pixman_transform_from_pixman_f_transform (&transform, &ftransform);
pixman_image_set_transform (app->original, &transform);
- params = pixman_filter_create_separable_convolution (
- &n_params,
- sx * 65536.0 + 0.5,
- sy * 65536.0 + 0.5,
- get_value (app, filters, "reconstruct_x_combo_box"),
- get_value (app, filters, "reconstruct_y_combo_box"),
- get_value (app, filters, "sample_x_combo_box"),
- get_value (app, filters, "sample_y_combo_box"),
- gtk_adjustment_get_value (app->subsample_adjustment),
- gtk_adjustment_get_value (app->subsample_adjustment));
+ if (get_value (app, filter_types, "filter_combo_box") ==
+ PIXMAN_FILTER_SEPARABLE_CONVOLUTION)
+ {
+ params = pixman_filter_create_separable_convolution (
+ &n_params,
+ sx * 65536.0 + 0.5,
+ sy * 65536.0 + 0.5,
+ get_value (app, filters, "reconstruct_x_combo_box"),
+ get_value (app, filters, "reconstruct_y_combo_box"),
+ get_value (app, filters, "sample_x_combo_box"),
+ get_value (app, filters, "sample_y_combo_box"),
+ gtk_adjustment_get_value (app->subsample_adjustment),
+ gtk_adjustment_get_value (app->subsample_adjustment));
+ }
+ else
+ {
+ params = 0;
+ n_params = 0;
+ }
pixman_image_set_filter (app->original,
get_value (app, filter_types, "filter_combo_box"),