[evince/wip/gpoo/gtk4-rebase-port: 31/96] ev-utils: port to gtk4
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/gpoo/gtk4-rebase-port: 31/96] ev-utils: port to gtk4
- Date: Sun, 20 Mar 2022 21:50:29 +0000 (UTC)
commit dc57bce2208c5e25e0e2f746e2b2094758d84770
Author: Qiu Wenbo <qiuwenbo kylinos com cn>
Date: Thu Nov 18 09:41:51 2021 +0800
ev-utils: port to gtk4
Signed-off-by: Qiu Wenbo <qiuwenbo kylinos com cn>
shell/ev-utils.c | 30 ++++++++++++++++--------------
shell/ev-utils.h | 3 ++-
2 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/shell/ev-utils.c b/shell/ev-utils.c
index d4e22a3ad..83d7dfe1f 100644
--- a/shell/ev-utils.c
+++ b/shell/ev-utils.c
@@ -46,13 +46,13 @@ create_blur_filter (int radius)
ConvFilter *filter;
int x, y;
double sum;
-
+
filter = g_new0 (ConvFilter, 1);
filter->size = radius * 2 + 1;
filter->data = g_new (double, filter->size * filter->size);
sum = 0.0;
-
+
for (y = 0 ; y < filter->size; y++)
{
for (x = 0 ; x < filter->size; x++)
@@ -72,7 +72,7 @@ create_blur_filter (int radius)
}
return filter;
-
+
}
static GdkPixbuf *
@@ -85,7 +85,7 @@ create_shadow (GdkPixbuf *src, int blur_radius,
static ConvFilter *filter = NULL;
int src_rowstride, dest_rowstride;
int src_bpp, dest_bpp;
-
+
guchar *src_pixels, *dest_pixels;
if (!filter)
@@ -93,26 +93,26 @@ create_shadow (GdkPixbuf *src, int blur_radius,
if (x_offset < 0)
x_offset = (blur_radius * 4) / 5;
-
+
if (y_offset < 0)
y_offset = (blur_radius * 4) / 5;
-
+
width = gdk_pixbuf_get_width (src) + blur_radius * 2 + x_offset;
height = gdk_pixbuf_get_height (src) + blur_radius * 2 + y_offset;
dest = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src), TRUE,
gdk_pixbuf_get_bits_per_sample (src),
width, height);
- gdk_pixbuf_fill (dest, 0);
+ gdk_pixbuf_fill (dest, 0);
src_pixels = gdk_pixbuf_get_pixels (src);
src_rowstride = gdk_pixbuf_get_rowstride (src);
src_bpp = gdk_pixbuf_get_has_alpha (src) ? 4 : 3;
-
+
dest_pixels = gdk_pixbuf_get_pixels (dest);
dest_rowstride = gdk_pixbuf_get_rowstride (dest);
dest_bpp = gdk_pixbuf_get_has_alpha (dest) ? 4 : 3;
-
+
for (y = 0; y < height; y++)
{
for (x = 0; x < width; x++)
@@ -138,7 +138,7 @@ create_shadow (GdkPixbuf *src, int blur_radius,
filter->data [i * filter->size + j];
else
suma += 0xff;
-
+
}
}
@@ -148,7 +148,7 @@ create_shadow (GdkPixbuf *src, int blur_radius,
}
}
-
+
return dest;
}
@@ -157,7 +157,7 @@ ev_pixbuf_add_shadow (GdkPixbuf *src, int size,
int x_offset, int y_offset, double opacity)
{
GdkPixbuf *dest;
-
+
dest = create_shadow (src, size, x_offset, y_offset, opacity);
gdk_pixbuf_composite (src, dest,
@@ -201,6 +201,7 @@ ev_print_region_contents (cairo_region_t *region)
}
}
+#if 0
/**
* ev_gui_menu_popup_at_tree_view_selection:
* @menu: a #GtkMenu to show
@@ -241,6 +242,7 @@ ev_gui_menu_popup_at_tree_view_selection (GtkMenu *menu,
NULL);
}
}
+#endif
static void
file_filter_add_mime_types (GdkPixbufFormat *format, GtkFileFilter *filter,
@@ -257,7 +259,7 @@ file_filter_add_mime_types (GdkPixbufFormat *format, GtkFileFilter *filter,
g_strfreev (mime_types);
}
-void
+void
file_chooser_dialog_add_writable_pixbuf_formats (GtkFileChooser *chooser)
{
GSList *pixbuf_formats = NULL;
@@ -307,7 +309,7 @@ get_gdk_pixbuf_format_by_extension (const gchar *uri)
for (iter = pixbuf_formats; iter; iter = iter->next) {
gchar **extension_list;
GdkPixbufFormat *format = iter->data;
-
+
if (gdk_pixbuf_format_is_disabled (format) ||
!gdk_pixbuf_format_is_writable (format))
continue;
diff --git a/shell/ev-utils.h b/shell/ev-utils.h
index 8eb6bdff3..ebdff35aa 100644
--- a/shell/ev-utils.h
+++ b/shell/ev-utils.h
@@ -30,9 +30,10 @@ GdkPixbuf* ev_pixbuf_add_shadow (GdkPixbuf *src, int size,
void ev_print_region_contents (cairo_region_t *region);
+#if 0
void ev_gui_menu_popup_at_tree_view_selection (GtkMenu *menu,
GtkTreeView *tree_view);
-
+#endif
void file_chooser_dialog_add_writable_pixbuf_formats (GtkFileChooser *chooser);
GdkPixbufFormat* get_gdk_pixbuf_format_by_extension (const gchar *uri);
gchar* ev_str_replace (const char *str, const char *substr, const char *repl);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]