[gtk+/wip/baedert/gtkimageview: 121/135] imageview: Don't use negative scale values
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/gtkimageview: 121/135] imageview: Don't use negative scale values
- Date: Tue, 19 Jul 2016 12:51:02 +0000 (UTC)
commit e535277564ec0cdbae05511753a3f68029585ac4
Author: Timm Bäder <mail baedert org>
Date: Mon Mar 21 11:09:57 2016 +0100
imageview: Don't use negative scale values
gtk/gtkimageview.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkimageview.c b/gtk/gtkimageview.c
index e070396..d82811d 100644
--- a/gtk/gtkimageview.c
+++ b/gtk/gtkimageview.c
@@ -466,8 +466,8 @@ gtk_image_view_fix_anchor (GtkImageView *image_view,
double hupper_delta_angle, vupper_delta_angle;
double cur_scale = gtk_image_view_get_real_scale (image_view);
- g_assert (old_state->hupper > 0);
- g_assert (old_state->vupper > 0);
+ g_assert (old_state->hupper >= 0);
+ g_assert (old_state->vupper >= 0);
g_assert (priv->hadjustment);
g_assert (priv->vadjustment);
g_assert (priv->size_valid);
@@ -1015,8 +1015,11 @@ gtk_image_view_draw (GtkWidget *widget, cairo_t *ct)
int w = gtk_adjustment_get_upper (priv->hadjustment);
int h = gtk_adjustment_get_upper (priv->vadjustment);
- gtk_render_background (sc, ct, x, y, w, h);
- gtk_render_frame (sc, ct, x, y, w, h);
+ if (w > 0 && h > 0)
+ {
+ gtk_render_background (sc, ct, x, y, w, h);
+ gtk_render_frame (sc, ct, x, y, w, h);
+ }
}
else
{
@@ -1808,7 +1811,7 @@ gtk_image_view_scroll_event (GtkWidget *widget,
{
GtkImageView *image_view = GTK_IMAGE_VIEW (widget);
GtkImageViewPrivate *priv = gtk_image_view_get_instance_private (image_view);
- double new_scale = priv->scale - (0.1 * event->delta_y);
+ double new_scale = MAX (0, priv->scale - (0.1 * event->delta_y));
State state;
if (!priv->image ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]