Commit f58a70a9 authored by Cosimo Cecchi's avatar Cosimo Cecchi

eel: remove unused eel_pixbuf_render()

parent 8b13a044
......@@ -119,107 +119,3 @@ eel_gdk_pixbuf_load_from_stream_at_size (GInputStream *stream,
return pixbuf;
}
static guchar
eel_gdk_pixbuf_lighten_pixbuf_component (guchar cur_value,
guint lighten_value)
{
int new_value = cur_value;
if (lighten_value > 0) {
new_value += lighten_value + (new_value >> 3);
if (new_value > 255) {
new_value = 255;
}
}
return (guchar) new_value;
}
static GdkPixbuf *
eel_gdk_pixbuf_lighten (GdkPixbuf* src,
guint lighten_value)
{
GdkPixbuf *dest;
int i, j;
int width, height, has_alpha, src_row_stride, dst_row_stride;
guchar *target_pixels, *original_pixels;
guchar *pixsrc, *pixdest;
g_assert (gdk_pixbuf_get_colorspace (src) == GDK_COLORSPACE_RGB);
g_assert ((!gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 3)
|| (gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 4));
g_assert (gdk_pixbuf_get_bits_per_sample (src) == 8);
dest = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
gdk_pixbuf_get_has_alpha (src),
gdk_pixbuf_get_bits_per_sample (src),
gdk_pixbuf_get_width (src),
gdk_pixbuf_get_height (src));
has_alpha = gdk_pixbuf_get_has_alpha (src);
width = gdk_pixbuf_get_width (src);
height = gdk_pixbuf_get_height (src);
dst_row_stride = gdk_pixbuf_get_rowstride (dest);
src_row_stride = gdk_pixbuf_get_rowstride (src);
target_pixels = gdk_pixbuf_get_pixels (dest);
original_pixels = gdk_pixbuf_get_pixels (src);
for (i = 0; i < height; i++) {
pixdest = target_pixels + i * dst_row_stride;
pixsrc = original_pixels + i * src_row_stride;
for (j = 0; j < width; j++) {
*pixdest++ = eel_gdk_pixbuf_lighten_pixbuf_component (*pixsrc++, lighten_value);
*pixdest++ = eel_gdk_pixbuf_lighten_pixbuf_component (*pixsrc++, lighten_value);
*pixdest++ = eel_gdk_pixbuf_lighten_pixbuf_component (*pixsrc++, lighten_value);
if (has_alpha) {
*pixdest++ = *pixsrc++;
}
}
}
return dest;
}
GdkPixbuf *
eel_gdk_pixbuf_render (GdkPixbuf *pixbuf,
guint render_mode,
guint saturation,
guint brightness,
guint lighten_value,
GdkRGBA *color)
{
GdkPixbuf *temp_pixbuf, *old_pixbuf;
if (render_mode == 1) {
/* lighten icon */
temp_pixbuf = eel_create_spotlight_pixbuf (pixbuf);
}
else if (render_mode == 2) {
/* colorize icon */
temp_pixbuf = eel_create_colorized_pixbuf (pixbuf, color);
} else if (render_mode == 3) {
/* monochromely colorize icon */
old_pixbuf = eel_create_darkened_pixbuf (pixbuf, 0, 255);
temp_pixbuf = eel_create_colorized_pixbuf (old_pixbuf, color);
g_object_unref (old_pixbuf);
} else {
temp_pixbuf = NULL;
}
if (saturation < 255 || brightness < 255 || temp_pixbuf == NULL) { // temp_pixbuf == NULL just for safer code (return copy)
old_pixbuf = temp_pixbuf;
temp_pixbuf = eel_create_darkened_pixbuf (temp_pixbuf ? temp_pixbuf : pixbuf, saturation, brightness);
if (old_pixbuf) {
g_object_unref (old_pixbuf);
}
}
if (lighten_value > 0) {
old_pixbuf = temp_pixbuf;
temp_pixbuf = eel_gdk_pixbuf_lighten (temp_pixbuf ? temp_pixbuf : pixbuf, lighten_value);
if (old_pixbuf) {
g_object_unref (old_pixbuf);
}
}
return temp_pixbuf;
}
......@@ -29,18 +29,8 @@
#include <gdk/gdk.h>
#include <gio/gio.h>
#define EEL_OPACITY_FULLY_TRANSPARENT 0
#define EEL_OPACITY_FULLY_OPAQUE 255
/* Loading a GdkPixbuf with a URI. */
GdkPixbuf * eel_gdk_pixbuf_load_from_stream_at_size (GInputStream *stream,
int size);
GdkPixbuf * eel_gdk_pixbuf_render (GdkPixbuf *pixbuf,
guint render_mode,
guint saturation,
guint brightness,
guint lighten_value,
GdkRGBA *color);
#endif /* EEL_GDK_PIXBUF_EXTENSIONS_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment