summaryrefslogtreecommitdiff
path: root/media-gfx/gpicview
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-03-20 14:27:17 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-03-20 14:27:17 +0000
commit5bb9ff1ee56d2b5e75e01a7f066d8b0cec84ec02 (patch)
tree66e860a5099bcad013f1cf667255dc372a7c11b3 /media-gfx/gpicview
parent7218e1b46bceac05841e90472501742d905fb3fc (diff)
gentoo resync : 20.03.2021
Diffstat (limited to 'media-gfx/gpicview')
-rw-r--r--media-gfx/gpicview/Manifest2
-rw-r--r--media-gfx/gpicview/files/Fix-displaying-images-with-GTK3.patch172
-rw-r--r--media-gfx/gpicview/gpicview-0.2.5-r2.ebuild27
3 files changed, 201 insertions, 0 deletions
diff --git a/media-gfx/gpicview/Manifest b/media-gfx/gpicview/Manifest
index 184a7383ebd1..c70d288759fe 100644
--- a/media-gfx/gpicview/Manifest
+++ b/media-gfx/gpicview/Manifest
@@ -1,4 +1,6 @@
+AUX Fix-displaying-images-with-GTK3.patch 6119 BLAKE2B 84733027ba1740eb78e4d62e67b6ca0dbae58dfac1c3bf44b1dd07a7b33248a255728e2b9c6b87f534ef1463b20d2f5df8f2e07bb619b97b428fc14e9f8939e4 SHA512 6eb044a143acc0decd64f90578b98a41a82c05a0bbf90e35646af1007e685d0d37a08ad3e90674bc6b5fedf460695b27f771a2776bfb391af03f6c1674592060
DIST gpicview-0.2.5.tar.xz 349536 BLAKE2B c215e812693a30d55d3e606b9958d308b5d7f564ba0c3fc60e7606c492ec3ddd9997ae63f0865a6bebdf79c0a18e6a8b26a1e2c8d5dd7e2174d211130dbbe817 SHA512 afc7e67c7ae1252f9c1816ee46fe69e96ea7be9a60e03406a539f17b2e4f0e4b93a028c6f3f1c455f5433d6d7d78a58dcee2cb0ac91ea53093a21935bf454afd
EBUILD gpicview-0.2.5-r1.ebuild 652 BLAKE2B 543b90065074488e91faa5ae0f310d10a0bcd84913c3a0143f9fce8c367c8a6b1659c69c2b824c012b889163a5afce282d5b49f38fa7c7352ebcda245fb448d8 SHA512 5b7a0856bb9cfa2296c4d588bb4e2232204c50955928a10f6c94507aba495452937b89ba5d49bb32fcbdeb7a92ad938aa70ba638e14ddf41396972f0e47b053c
+EBUILD gpicview-0.2.5-r2.ebuild 580 BLAKE2B d3637083f6dc2f4e0b5b83ab113089470f6095b6aeaf52e06909ca30cf63c9b95a5532ddcdb575573f9794603d296d5e146b115e4ad82c47990712d3e472bee9 SHA512 b3a64073f6fa8fad7c1c21077c6f2b0f4da2884e5cd8954e390a661a3c8ec4bbdcd7e06272a922522d102114e7acd88495502887b1e8aa10d0be36380ff6bc24
EBUILD gpicview-0.2.5.ebuild 548 BLAKE2B 7402a49ee6252fdc380528d96b8fb251da0f2f10c21c87867f8376630bceeaf025c26a2cf9b926be879184849c5786d752a4f42570e7f9b1a5de6feffd86ed5d SHA512 c65d2217ad28d00169b53997497ed000d0fd90d42c121071a69e7c7ff5d4305d8169c3b749409afa0aaa1fd3a3bea76a2ab33ad5e92e45940a7f93d24f6e00b0
MISC metadata.xml 326 BLAKE2B dbbd9ecc73f5ec8f23b39346f657c68efd9b673e1faee5930e503a9a5694cc9f8931a97083e282006a931a30bdb577d1b347b6c2a8dd3cc959011e4837dab9be SHA512 0a80530a6a1e3884352fb68ea8e4f0cd0fbf685201ef28de590233fd43b111c23f6f5a2a3eccc450c0bc9f08d58c565c90e80f04418cbf8880b101f93ca1aa3b
diff --git a/media-gfx/gpicview/files/Fix-displaying-images-with-GTK3.patch b/media-gfx/gpicview/files/Fix-displaying-images-with-GTK3.patch
new file mode 100644
index 000000000000..b832d364b3ed
--- /dev/null
+++ b/media-gfx/gpicview/files/Fix-displaying-images-with-GTK3.patch
@@ -0,0 +1,172 @@
+From 2a497a06d9297712778b9bfde3f21a2bd867967c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor@gmail.com>
+Date: Tue, 21 Feb 2017 01:06:06 +0100
+Subject: [PATCH] Fix displaying images with GTK3
+
+We have to use the cairo context provided by the draw event, otherwise the scrolling does not work properly.
+
+Don't paint the whole image when scale == 1, it's unneeded and slow.
+---
+ src/image-view.c | 86 +++++++++++++++++++++++++++++---------------------------
+ 1 file changed, 44 insertions(+), 42 deletions(-)
+
+diff --git a/src/image-view.c b/src/image-view.c
+index b367f2a..820b843 100644
+--- a/src/image-view.c
++++ b/src/image-view.c
+@@ -24,11 +24,10 @@
+ static void image_view_finalize(GObject *iv);
+
+ static void image_view_clear( ImageView* iv );
+-static gboolean on_idle( ImageView* iv );
+ static void calc_image_area( ImageView* iv );
+-static void paint( ImageView* iv, GdkRectangle* invalid_rect, GdkInterpType type );
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
++static void paint( ImageView* iv, GdkRectangle* invalid_rect, GdkInterpType type, cairo_t* cr );
+
+ static void image_view_paint( ImageView* iv, cairo_t* cr );
+
+@@ -37,6 +36,8 @@ static void on_get_preferred_height( GtkWidget* widget, gint* minimal_height, gi
+ static gboolean on_draw_event(GtkWidget* widget, cairo_t* cr);
+
+ #else // GTK2
++static gboolean on_idle( ImageView* iv );
++static void paint( ImageView* iv, GdkRectangle* invalid_rect, GdkInterpType type );
+
+ static void image_view_paint( ImageView* iv, GdkEventExpose* evt );
+
+@@ -268,16 +269,13 @@ void image_view_paint( ImageView* iv, cairo_t *cr )
+ {
+ cairo_rectangle_int_t rectangle;
+ cairo_region_get_rectangle(region, i, &rectangle);
+- paint( iv, &rectangle, GDK_INTERP_NEAREST );
++ paint( iv, &rectangle, GDK_INTERP_NEAREST, cr );
+ }
+
+ cairo_region_destroy (region);
+-
+- if( 0 == iv->idle_handler )
+- iv->idle_handler = g_idle_add( (GSourceFunc)on_idle, iv );
+ }
+ }
+-#else
++#else // GTK2
+
+ gboolean on_expose_event( GtkWidget* widget, GdkEventExpose* evt )
+ {
+@@ -390,6 +388,8 @@ void image_view_set_scale( ImageView* iv, gdouble new_scale, GdkInterpType type
+ }
+ }
+
++#if GTK_CHECK_VERSION(3, 0, 0)
++#else // GTK2
+ gboolean on_idle( ImageView* iv )
+ {
+ GDK_THREADS_ENTER();
+@@ -435,6 +435,7 @@ gboolean on_idle( ImageView* iv )
+ iv->idle_handler = 0;
+ return FALSE;
+ }
++#endif
+
+ void calc_image_area( ImageView* iv )
+ {
+@@ -460,7 +461,11 @@ void calc_image_area( ImageView* iv )
+ }
+ }
+
++#if GTK_CHECK_VERSION(3, 0, 0)
++void paint( ImageView* iv, GdkRectangle* invalid_rect, GdkInterpType type, cairo_t* cr )
++#else // GTK2
+ void paint( ImageView* iv, GdkRectangle* invalid_rect, GdkInterpType type )
++#endif
+ {
+ GdkRectangle rect;
+ if( ! gdk_rectangle_intersect( invalid_rect, &iv->img_area, &rect ) )
+@@ -470,51 +475,48 @@ void paint( ImageView* iv, GdkRectangle* invalid_rect, GdkInterpType type )
+ int dest_y;
+
+ GdkPixbuf* src_pix = NULL;
+- if( iv->scale == 1.0 ) // original size
+- {
+- src_pix = (GdkPixbuf*)g_object_ref( iv->pix );
+- dest_x = iv->img_area.x;
+- dest_y = iv->img_area.y;
+- }
+- else // scaling is needed
++ GdkPixbuf* scaled_pix = NULL;
++
++ dest_x = rect.x;
++ dest_y = rect.y;
++
++ rect.x -= iv->img_area.x;
++ rect.y -= iv->img_area.y;
++
++ int src_x = (int)floor( ((gdouble)rect.x) / iv->scale + 0.5 );
++ int src_y = (int)floor( ((gdouble)rect.y) / iv->scale + 0.5 );
++ int src_w = (int)floor( ((gdouble)rect.width) / iv->scale + 0.5 );
++ int src_h = (int)floor( ((gdouble)rect.height) / iv->scale + 0.5 );
++ if( src_y > gdk_pixbuf_get_height( iv->pix ) )
++ src_y = gdk_pixbuf_get_height( iv->pix );
++ if( src_x + src_w > gdk_pixbuf_get_width( iv->pix ) )
++ src_w = gdk_pixbuf_get_width( iv->pix ) - src_x;
++ if( src_y + src_h > gdk_pixbuf_get_height( iv->pix ) )
++ src_h = gdk_pixbuf_get_height( iv->pix ) - src_y;
++ //g_debug("orig src: x=%d, y=%d, w=%d, h=%d",
++ // src_x, src_y, src_w, src_h );
++
++ if ((src_w > 0) && (src_h > 0))
+ {
+- dest_x = rect.x;
+- dest_y = rect.y;
+-
+- rect.x -= iv->img_area.x;
+- rect.y -= iv->img_area.y;
+-
+- GdkPixbuf* scaled_pix = NULL;
+- int src_x = (int)floor( ((gdouble)rect.x) / iv->scale + 0.5 );
+- int src_y = (int)floor( ((gdouble)rect.y) / iv->scale + 0.5 );
+- int src_w = (int)floor( ((gdouble)rect.width) / iv->scale + 0.5 );
+- int src_h = (int)floor( ((gdouble)rect.height) / iv->scale + 0.5 );
+- if( src_y > gdk_pixbuf_get_height( iv->pix ) )
+- src_y = gdk_pixbuf_get_height( iv->pix );
+- if( src_x + src_w > gdk_pixbuf_get_width( iv->pix ) )
+- src_w = gdk_pixbuf_get_width( iv->pix ) - src_x;
+- if( src_y + src_h > gdk_pixbuf_get_height( iv->pix ) )
+- src_h = gdk_pixbuf_get_height( iv->pix ) - src_y;
+- //g_debug("orig src: x=%d, y=%d, w=%d, h=%d",
+- // src_x, src_y, src_w, src_h );
+-
+- if ((src_w > 0) && (src_h > 0))
+- {
+- src_pix = gdk_pixbuf_new_subpixbuf( iv->pix, src_x, src_y, src_w, src_h );
+- scaled_pix = gdk_pixbuf_scale_simple( src_pix, rect.width, rect.height, type );
+- g_object_unref( src_pix );
+- src_pix = scaled_pix;
+- }
+-
++ src_pix = gdk_pixbuf_new_subpixbuf( iv->pix, src_x, src_y, src_w, src_h );
++ scaled_pix = gdk_pixbuf_scale_simple( src_pix, rect.width, rect.height, type );
++ g_object_unref( src_pix );
++ src_pix = scaled_pix;
+ }
+
+ if( G_LIKELY(src_pix) )
+ {
+ GtkWidget* widget = (GtkWidget*)iv;
++#if GTK_CHECK_VERSION(3, 0, 0)
++#else // GTK2
+ cairo_t *cr = gdk_cairo_create (gtk_widget_get_window(widget));
++#endif
+ gdk_cairo_set_source_pixbuf (cr, src_pix, dest_x, dest_y);
+ cairo_paint (cr);
++#if GTK_CHECK_VERSION(3, 0, 0)
++#else // GTK2
+ cairo_destroy (cr);
++#endif
+
+ g_object_unref( src_pix );
+ }
+--
+2.11.1
diff --git a/media-gfx/gpicview/gpicview-0.2.5-r2.ebuild b/media-gfx/gpicview/gpicview-0.2.5-r2.ebuild
new file mode 100644
index 000000000000..5b657769e158
--- /dev/null
+++ b/media-gfx/gpicview/gpicview-0.2.5-r2.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit xdg
+
+DESCRIPTION="A Simple and Fast Image Viewer for X"
+HOMEPAGE="http://lxde.sourceforge.net/gpicview"
+SRC_URI="mirror://sourceforge/lxde/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc ~x86"
+
+RDEPEND="virtual/jpeg:0
+ x11-libs/gtk+:3"
+DEPEND="${RDEPEND}
+ >=dev-util/intltool-0.40
+ sys-devel/gettext
+ virtual/pkgconfig"
+
+PATCHES=( "${FILESDIR}/Fix-displaying-images-with-GTK3.patch" )
+
+src_configure() {
+ econf --enable-gtk3
+}