Fix #123: Limit image expansion in Fit To Window
[geeqie.git] / src / pixbuf-renderer.h
index 948f1c7..c399e1f 100644 (file)
@@ -1,13 +1,22 @@
 /*
- * Geeqie
- * (C) 2006 John Ellis
- * Copyright (C) 2008 - 2012 The Geeqie Team
+ * Copyright (C) 2006 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
  *
  * Author: John Ellis
  *
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #ifndef PIXBUF_RENDERER_H
@@ -20,9 +29,7 @@
 #define IS_PIXBUF_RENDERER_CLASS(klass)        (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_PIXBUF_RENDERER))
 #define PIXBUF_RENDERER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_PIXBUF_RENDERER, PixbufRendererClass))
 
-/* alpha channel checkerboard background (same as gimp) */
-#define PR_ALPHA_CHECK1 0x00999999
-#define PR_ALPHA_CHECK2 0x00666666
+/* alpha channel checkerboard (same as gimp) */
 #define PR_ALPHA_CHECK_SIZE 16
 /* when scaling image to below this size, use nearest pixel for scaling
  * (below about 4, the other scale types become slow generating their conversion tables)
@@ -72,22 +79,20 @@ typedef enum {
 
 struct _RendererFuncs
 {
-       void (*redraw)(void *renderer, gint x, gint y, gint w, gint h,
-                     gint clamp, ImageRenderType render, gboolean new_data, gboolean only_existing);
-        void (*area_changed)(void *renderer, gint src_x, gint src_y, gint src_w, gint src_h);
-       void (*queue_clear)(void *renderer);
-       void (*border_clear)(void *renderer);
-       void (*invalidate_all)(void *renderer);
+//     void (*redraw)(void *renderer, gint x, gint y, gint w, gint h,
+  //                   gint clamp, ImageRenderType render, gboolean new_data, gboolean only_existing);
+        void (*area_changed)(void *renderer, gint src_x, gint src_y, gint src_w, gint src_h); /* pixbuf area changed */
        void (*invalidate_region)(void *renderer, gint x, gint y, gint w, gint h);
-       void (*scroll)(void *renderer, gint x_off, gint y_off);
-       void (*update_sizes)(void *renderer);
+       void (*scroll)(void *renderer, gint x_off, gint y_off); /* scroll */
+       void (*update_viewport)(void *renderer); /* window / wiewport / border color has changed */
+       void (*update_pixbuf)(void *renderer, gboolean lazy); /* pixbuf has changed */
+       void (*update_zoom)(void *renderer, gboolean lazy); /* zoom has changed */
 
        gint (*overlay_add)(void *renderer, GdkPixbuf *pixbuf, gint x, gint y, OverlayRendererFlags flags);
        void (*overlay_set)(void *renderer, gint id, GdkPixbuf *pixbuf, gint x, gint y);
        gboolean (*overlay_get)(void *renderer, gint id, GdkPixbuf **pixbuf, gint *x, gint *y);
-       void (*overlay_draw)(void *renderer, gint x, gint y, gint w, gint h);
 
-       void (*stereo_set)(void *renderer, gint stereo_mode);
+       void (*stereo_set)(void *renderer, gint stereo_mode); /* set stereo mode */
 
        void (*free)(void *renderer);
 };
@@ -111,7 +116,7 @@ struct _PixbufRenderer
 
        gint x_offset;          /* offset of image start (non-zero when viewport < window) */
        gint y_offset;
-       
+
        gint x_mouse; /* coordinates of the mouse taken from GtkEvent */
        gint y_mouse;
 
@@ -126,7 +131,7 @@ struct _PixbufRenderer
 
        gdouble norm_center_x;  /* coordinates of viewport center in the image, in range 0.0 - 1.0 */
        gdouble norm_center_y;  /* these coordinates are used for PR_SCROLL_RESET_NOCHANGE and should be preserved over periods with NULL pixbuf */
-       
+
        gdouble subpixel_x_scroll; /* subpixel scroll alignment, used to prevent acumulation of rounding errors */
        gdouble subpixel_y_scroll;
 
@@ -141,10 +146,6 @@ struct _PixbufRenderer
        gboolean zoom_2pass;
        gboolean zoom_expand;
 
-#if !GTK_CHECK_VERSION(3,0,0)
-       GdkRgbDither dither_quality;
-#endif
-
        PixbufRendererScrollResetType scroll_reset;
 
        gboolean has_frame;
@@ -157,8 +158,9 @@ struct _PixbufRenderer
 
        gboolean autofit_limit;
        gint autofit_limit_size;
+       gint enlargement_limit_size;
 
-
+       GdkColor color;
 
        /*< private >*/
        gboolean in_drag;
@@ -199,7 +201,7 @@ struct _PixbufRenderer
        gint orientation;
 
        gint stereo_mode;
-       
+
        StereoPixbufData stereo_data;
        gboolean stereo_temp_disable;
        gint stereo_fixed_width;
@@ -208,7 +210,7 @@ struct _PixbufRenderer
        gint stereo_fixed_y_left;
        gint stereo_fixed_x_right;
        gint stereo_fixed_y_right;
-       
+
        RendererFuncs *renderer;
        RendererFuncs *renderer2;
 };
@@ -223,7 +225,7 @@ struct _PixbufRendererClass
        void (*update_pixel)(PixbufRenderer *pr);
 
        void (*render_complete)(PixbufRenderer *pr);
-       void (*drag)(PixbufRenderer *pr, GdkEventButton *event);
+       void (*drag)(PixbufRenderer *pr, GdkEventMotion *event);
 };
 
 
@@ -268,6 +270,7 @@ gint pixbuf_renderer_get_tiles(PixbufRenderer *pr);
 /* move image data from source to pr, source is then set to NULL image */
 
 void pixbuf_renderer_move(PixbufRenderer *pr, PixbufRenderer *source);
+void pixbuf_renderer_copy(PixbufRenderer *pr, PixbufRenderer *source);
 
 /* update region of existing image */