[Pixman] [PATCH v9 02/15] demos/scale: Added pulldown to choose PIXMAN_FILTER_* value

Oded Gabbay oded.gabbay at gmail.com
Mon Feb 1 05:51:43 PST 2016


On Fri, Jan 22, 2016 at 11:42 AM,  <spitzak at gmail.com> wrote:
> From: Bill Spitzak <spitzak at gmail.com>
>
> This allows testing of GOOD/BEST and to do comparisons between
> the basic filters and PIXMAN_FILTER_SEPARABLE_CONVOLUTION settings.
>
> Signed-off-by: Bill Spitzak <spitzak at gmail.com>
> ---
>  demos/scale.c  | 14 +++++++++++++-
>  demos/scale.ui | 40 ++++++++++++++++++++++++++++++----------
>  2 files changed, 43 insertions(+), 11 deletions(-)
>
> diff --git a/demos/scale.c b/demos/scale.c
> index 0995ad0..06821e3 100644
> --- a/demos/scale.c
> +++ b/demos/scale.c
> @@ -127,6 +127,15 @@ typedef struct
>      int                value;
>  } named_int_t;
>
> +static const named_int_t filter_types[] =
> +{
> +    { "Separable",             PIXMAN_FILTER_SEPARABLE_CONVOLUTION },
> +    { "Nearest",               PIXMAN_FILTER_NEAREST },
> +    { "Bilinear",              PIXMAN_FILTER_BILINEAR },
> +    { "Good",                  PIXMAN_FILTER_GOOD },
> +    { "Best",                  PIXMAN_FILTER_BEST },
> +};
> +
>  static const named_int_t filters[] =
>  {
>      { "Box",                   PIXMAN_KERNEL_BOX },
> @@ -260,7 +269,9 @@ rescale (GtkWidget *may_be_null, app_t *app)
>         gtk_adjustment_get_value (app->subsample_adjustment),
>         gtk_adjustment_get_value (app->subsample_adjustment));
>
> -    pixman_image_set_filter (app->original, PIXMAN_FILTER_SEPARABLE_CONVOLUTION, params, n_params);
> +    pixman_image_set_filter (app->original,
> +       get_value (app, filter_types, "filter_combo_box"),
> +       params, n_params);
>
>      pixman_image_set_repeat (
>          app->original, get_value (app, repeats, "repeat_combo_box"));
> @@ -402,6 +413,7 @@ app_new (pixman_image_t *original)
>      widget = get_widget (app, "drawing_area");
>      g_signal_connect (widget, "expose_event", G_CALLBACK (on_expose), app);
>
> +    set_up_combo_box (app, "filter_combo_box", G_N_ELEMENTS (filter_types), filter_types);
>      set_up_filter_box (app, "reconstruct_x_combo_box");
>      set_up_filter_box (app, "reconstruct_y_combo_box");
>      set_up_filter_box (app, "sample_x_combo_box");
> diff --git a/demos/scale.ui b/demos/scale.ui
> index ee985dd..b62cbfb 100644
> --- a/demos/scale.ui
> +++ b/demos/scale.ui
> @@ -191,12 +191,23 @@
>                      <property name="column_spacing">8</property>
>                      <property name="row_spacing">6</property>
>                      <child>
> +                      <object class="GtkLabel" id="labelF">
> +                        <property name="visible">True</property>
> +                        <property name="xalign">1</property>
> +                        <property name="label" translatable="yes"><b>Filter:</b></property>
> +                        <property name="use_markup">True</property>
> +                      </object>
> +                    </child>
> +                    <child>
>                        <object class="GtkLabel" id="label4">
>                          <property name="visible">True</property>
>                          <property name="xalign">1</property>
>                          <property name="label" translatable="yes"><b>Reconstruct X:</b></property>
>                          <property name="use_markup">True</property>
>                        </object>
> +                      <packing>
> +                        <property name="top_attach">1</property>
> +                      </packing>
>                      </child>
>                      <child>
>                        <object class="GtkLabel" id="label5">
> @@ -206,7 +217,7 @@
>                          <property name="use_markup">True</property>
>                        </object>
>                        <packing>
> -                        <property name="top_attach">1</property>
> +                        <property name="top_attach">2</property>
>                        </packing>
>                      </child>
>                      <child>
> @@ -217,7 +228,7 @@
>                          <property name="use_markup">True</property>
>                        </object>
>                        <packing>
> -                        <property name="top_attach">2</property>
> +                        <property name="top_attach">3</property>
>                        </packing>
>                      </child>
>                      <child>
> @@ -228,7 +239,7 @@
>                          <property name="use_markup">True</property>
>                        </object>
>                        <packing>
> -                        <property name="top_attach">3</property>
> +                        <property name="top_attach">4</property>
>                        </packing>
>                      </child>
>                      <child>
> @@ -239,7 +250,7 @@
>                          <property name="use_markup">True</property>
>                        </object>
>                        <packing>
> -                        <property name="top_attach">4</property>
> +                        <property name="top_attach">5</property>
>                        </packing>
>                      </child>
>                      <child>
> @@ -250,7 +261,15 @@
>                          <property name="use_markup">True</property>
>                        </object>
>                        <packing>
> -                        <property name="top_attach">5</property>
> +                        <property name="top_attach">6</property>
> +                      </packing>
> +                    </child>
> +                    <child>
> +                      <object class="GtkComboBox" id="filter_combo_box">
> +                        <property name="visible">True</property>
> +                      </object>
> +                      <packing>
> +                        <property name="left_attach">1</property>
>                        </packing>
>                      </child>
>                      <child>
> @@ -259,6 +278,7 @@
>                        </object>
>                        <packing>
>                          <property name="left_attach">1</property>
> +                        <property name="top_attach">1</property>
>                        </packing>
>                      </child>
>                      <child>
> @@ -267,7 +287,7 @@
>                        </object>
>                        <packing>
>                          <property name="left_attach">1</property>
> -                        <property name="top_attach">1</property>
> +                        <property name="top_attach">2</property>
>                        </packing>
>                      </child>
>                      <child>
> @@ -276,7 +296,7 @@
>                        </object>
>                        <packing>
>                          <property name="left_attach">1</property>
> -                        <property name="top_attach">2</property>
> +                        <property name="top_attach">3</property>
>                        </packing>
>                      </child>
>                      <child>
> @@ -285,7 +305,7 @@
>                        </object>
>                        <packing>
>                          <property name="left_attach">1</property>
> -                        <property name="top_attach">3</property>
> +                        <property name="top_attach">4</property>
>                        </packing>
>                      </child>
>                      <child>
> @@ -294,7 +314,7 @@
>                        </object>
>                        <packing>
>                          <property name="left_attach">1</property>
> -                        <property name="top_attach">4</property>
> +                        <property name="top_attach">5</property>
>                        </packing>
>                      </child>
>                      <child>
> @@ -304,7 +324,7 @@
>                        </object>
>                        <packing>
>                          <property name="left_attach">1</property>
> -                        <property name="top_attach">5</property>
> +                        <property name="top_attach">6</property>
>                        </packing>
>                      </child>
>                    </object>
> --
> 1.9.1
>
> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pixman

Reviewed-by: Oded Gabbay <oded.gabbay at gmail.com>


More information about the Pixman mailing list