Commit 62811c66 authored by Paolo Bacchilega's avatar Paolo Bacchilega

removed the use of many deprecated functions

parent 0d6352d5
......@@ -64,7 +64,7 @@ CLUTTER_REQUIRED=1.0.0
CLUTTER_GTK_REQUIRED=1.0.0
GSTREAMER_REQUIRED=1.0.0
LIBRAW_REQUIRED=0.14
LIBSOUP_REQUIRED=2.36
LIBSOUP_REQUIRED=2.42
LIBSECRET_REQUIRED=0.11
LIBBRASERO_REQUIRED=3.2.0
LIBCHAMPLAIN_REQUIRED=0.12.0
......@@ -502,16 +502,10 @@ AC_ARG_ENABLE([libsoup],
[enable_libsoup=yes])
if test x$enable_libsoup = xyes ; then
PKG_CHECK_MODULES(LIBSOUP_GNOME,
[libsoup-gnome-2.4 >= $LIBSOUP_REQUIRED],
[LIBSOUP_CFLAGS="$LIBSOUP_GNOME_CFLAGS"
LIBSOUP_LIBS="$LIBSOUP_GNOME_LIBS"
AC_DEFINE(HAVE_LIBSOUP_GNOME, 1, [Have libsoup-gnome])
enable_libsoup=yes],
[PKG_CHECK_MODULES(LIBSOUP,
[libsoup-2.4 >= $LIBSOUP_REQUIRED],
[enable_libsoup=yes],
[enable_libsoup=no])])
PKG_CHECK_MODULES(LIBSOUP,
[libsoup-2.4 >= $LIBSOUP_REQUIRED],
[enable_libsoup=yes],
[enable_libsoup=no])
fi
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)
......
......@@ -85,7 +85,7 @@ static int *YCbCr_R_Cr_Tab = NULL;
static int *YCbCr_G_Cb_Tab = NULL;
static int *YCbCr_G_Cr_Tab = NULL;
static int *YCbCr_B_Cb_Tab = NULL;
static GStaticMutex Tables_Mutex = G_STATIC_MUTEX_INIT;
static GMutex Tables_Mutex;
#define SCALE_FACTOR 16
......@@ -97,7 +97,7 @@ static GStaticMutex Tables_Mutex = G_STATIC_MUTEX_INIT;
static void
CMYK_table_init (void)
{
g_static_mutex_lock (&Tables_Mutex);
g_mutex_lock (&Tables_Mutex);
if (CMYK_Tab == NULL) {
int v, k, i;
......@@ -114,14 +114,14 @@ CMYK_table_init (void)
}
}
g_static_mutex_unlock (&Tables_Mutex);
g_mutex_unlock (&Tables_Mutex);
}
static void
YCbCr_tables_init (void)
{
g_static_mutex_lock (&Tables_Mutex);
g_mutex_lock (&Tables_Mutex);
if (YCbCr_R_Cr_Tab == NULL) {
int i, v;
......@@ -139,7 +139,7 @@ YCbCr_tables_init (void)
}
}
g_static_mutex_unlock (&Tables_Mutex);
g_mutex_unlock (&Tables_Mutex);
}
......
......@@ -37,8 +37,6 @@
#define TILE_WIDTH 64
#define MAX_TILE_SIZE (TILE_WIDTH * TILE_WIDTH * 4 * 1.5)
#define ADD_ALPHA(v, a) (add_alpha_table[v][a])
#define MIN3(x,y,z) ((y) <= (z) ? MIN ((x), (y)) : MIN ((x), (z)))
#define MAX3(x,y,z) ((y) >= (z) ? MAX ((x), (y)) : MAX ((x), (z)))
#define DISSOLVE_SEED 737893334
#define CLAMP_TEMP(x, min, max) (temp = (x), CLAMP (temp, min, max))
#define ABS_TEMP2(x) (temp2 = (x), (temp2 < 0) ? -temp2: temp2)
......@@ -313,200 +311,6 @@ gimp_layer_free (GimpLayer *layer)
/* -- _cairo_image_surface_create_from_xcf -- */
/* RGB <-> HSV */
static void
gimp_rgb_to_hsv (guchar red,
guchar green,
guchar blue,
guchar *hue,
guchar *sat,
guchar *val)
{
guchar min, max;
min = MIN3 (red, green, blue);
max = MAX3 (red, green, blue);
*val = max;
if (*val == 0) {
*hue = *sat = 0;
return;
}
*sat = 255 * (long)(max - min) / *val;
if (*sat == 0) {
*hue = 0;
return;
}
if (max == min)
*hue = 0;
else if (max == red)
*hue = 0 + 43 * (green - blue) / (max - min);
else if (max == green)
*hue = 85 + 43 * (blue - red) / (max - min);
else if (max == blue)
*hue = 171 + 43 * (red - green) / (max - min);
}
static void
gimp_hsv_to_rgb (guchar hue,
guchar sat,
guchar val,
guchar *red,
guchar *green,
guchar *blue)
{
guchar region, remainder, p, q, t;
if (sat == 0) {
*red = *green = *blue = val;
return;
}
region = hue / 43;
remainder = (hue - (region * 43)) * 6;
p = (val * (255 - sat)) >> 8;
q = (val * (255 - ((sat * remainder) >> 8))) >> 8;
t = (val * (255 - ((sat * (255 - remainder)) >> 8))) >> 8;
switch (region) {
case 0:
*red = val;
*green = t;
*blue = p;
break;
case 1:
*red = q;
*green = val;
*blue = p;
break;
case 2:
*red = p;
*green = val;
*blue = t;
break;
case 3:
*red = p;
*green = q;
*blue = val;
break;
case 4:
*red = t;
*green = p;
*blue = val;
break;
default:
*red = val;
*green = p;
*blue = q;
break;
}
}
/* RGB <-> HSL */
static void
gimp_rgb_to_hsl (guchar red,
guchar green,
guchar blue,
guchar *hue,
guchar *sat,
guchar *lum)
{
guchar min, max;
min = MIN3 (red, green, blue);
max = MAX3 (red, green, blue);
*lum = (max + min) / 2;
if (max == min) {
*hue = *sat = 0;
return;
}
if (*lum < 128)
*sat = 255 * (long) (max - min) / (max + min);
else
*sat = 255 * (long) (max - min) / (512 - max - min);
if (max == min)
*hue = 0;
else if (max == red)
*hue = 0 + 43 * (green - blue) / (max - min);
else if (max == green)
*hue = 85 + 43 * (blue - red) / (max - min);
else if (max == blue)
*hue = 171 + 43 * (red - green) / (max - min);
}
static inline gint
gimp_hsl_value (gdouble n1,
gdouble n2,
gdouble hue)
{
gdouble value;
if (hue > 255)
hue -= 255;
else if (hue < 0)
hue += 255;
if (hue < 42.5)
value = n1 + (n2 - n1) * (hue / 42.5);
else if (hue < 127.5)
value = n2;
else if (hue < 170)
value = n1 + (n2 - n1) * ((170 - hue) / 42.5);
else
value = n1;
return value * 255.0;
}
static void
gimp_hsl_to_rgb (guchar hue,
guchar sat,
guchar lum,
guchar *red,
guchar *green,
guchar *blue)
{
if (sat == 0) {
*red = lum;
*green = lum;
*blue = lum;
}
else {
gdouble h, s, l, m1, m2;
h = hue;
s = sat;
l = lum;
if (l < 128)
m2 = (l * (255 + s)) / 65025.0;
else
m2 = (l + s - (l * s) / 255.0) / 255.0;
m1 = (l / 127.5) - m2;
*red = gimp_hsl_value (m1, m2, h + 85);
*green = gimp_hsl_value (m1, m2, h);
*blue = gimp_hsl_value (m1, m2, h - 85);
}
}
static void
_cairo_image_surface_paint_layer (cairo_surface_t *image,
GimpLayer *layer)
......
......@@ -226,11 +226,12 @@ video_area_draw_cb (GtkWidget *widget,
cairo_fill (cr);
if (self->priv->icon != NULL) {
int icon_w, icon_h;
int text_w;
int icon_x, icon_y;
PangoRectangle logical_rect;
int x, y;
int icon_w, icon_h;
int text_w;
int icon_x, icon_y;
PangoRectangle logical_rect;
int x, y;
PangoFontDescription *font;
icon_w = gdk_pixbuf_get_width (self->priv->icon);
icon_h = gdk_pixbuf_get_height (self->priv->icon);
......@@ -250,7 +251,8 @@ video_area_draw_cb (GtkWidget *widget,
cairo_fill (cr);
cairo_move_to (cr, x, y);
pango_layout_set_font_description (self->priv->caption_layout, gtk_style_context_get_font (style_context, gtk_widget_get_state (widget)));
gtk_style_context_get (style_context, gtk_widget_get_state (widget), "font", &font, NULL);
pango_layout_set_font_description (self->priv->caption_layout, font);
pango_cairo_layout_path (cr, self->priv->caption_layout);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
cairo_fill (cr);
......
......@@ -24,11 +24,7 @@
#include <glib.h>
#ifdef HAVE_LIBSOUP_GNOME
#include <libsoup/soup-gnome.h>
#else
#include <libsoup/soup.h>
#endif /* HAVE_LIBSOUP_GNOME */
#include "oauth-account.h"
#include "oauth-service.h"
......
......@@ -22,11 +22,7 @@
#include <config.h>
#include <glib.h>
#include <glib/gi18n.h>
#ifdef HAVE_LIBSOUP_GNOME
#include <libsoup/soup-gnome.h>
#else
#include <libsoup/soup.h>
#endif /* HAVE_LIBSOUP_GNOME */
#ifdef HAVE_LIBSECRET
#include <libsecret/secret.h>
#endif /* HAVE_LIBSECRET */
......@@ -844,11 +840,7 @@ _web_service_send_message (WebService *self,
gpointer soup_session_cb_data)
{
if (self->priv->session == NULL) {
self->priv->session = soup_session_async_new_with_options (
#ifdef HAVE_LIBSOUP_GNOME
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_GNOME,
#endif
NULL);
self->priv->session = soup_session_new ();
#ifdef DEBUG_WEB_CONNECTION
{
......
......@@ -25,6 +25,7 @@ PUBLIC_HEADER_FILES = \
$(PUBLIC_BUILT_HEADER_FILES) \
cairo-scale.h \
cairo-utils.h \
color-utils.h \
dom.h \
gedit-message-area.h \
gfixed.h \
......@@ -157,6 +158,7 @@ gthumb_SOURCES = \
$(RESOURCES) \
cairo-scale.c \
cairo-utils.c \
color-utils.c \
dlg-location.c \
dlg-personalize-filters.c \
dlg-preferences.c \
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2012 The Free Software Foundation, Inc.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "color-utils.h"
#include "glib-utils.h"
/* RGB <-> HSV */
void
gimp_rgb_to_hsv (guchar red,
guchar green,
guchar blue,
guchar *hue,
guchar *sat,
guchar *val)
{
guchar min, max;
min = MIN3 (red, green, blue);
max = MAX3 (red, green, blue);
*val = max;
if (*val == 0) {
*hue = *sat = 0;
return;
}
*sat = 255 * (long)(max - min) / *val;
if (*sat == 0) {
*hue = 0;
return;
}
if (max == min)
*hue = 0;
else if (max == red)
*hue = 0 + 43 * (green - blue) / (max - min);
else if (max == green)
*hue = 85 + 43 * (blue - red) / (max - min);
else if (max == blue)
*hue = 171 + 43 * (red - green) / (max - min);
}
void
gimp_hsv_to_rgb (guchar hue,
guchar sat,
guchar val,
guchar *red,
guchar *green,
guchar *blue)
{
guchar region, remainder, p, q, t;
if (sat == 0) {
*red = *green = *blue = val;
return;
}
region = hue / 43;
remainder = (hue - (region * 43)) * 6;
p = (val * (255 - sat)) >> 8;
q = (val * (255 - ((sat * remainder) >> 8))) >> 8;
t = (val * (255 - ((sat * (255 - remainder)) >> 8))) >> 8;
switch (region) {
case 0:
*red = val;
*green = t;
*blue = p;
break;
case 1:
*red = q;
*green = val;
*blue = p;
break;
case 2:
*red = p;
*green = val;
*blue = t;
break;
case 3:
*red = p;
*green = q;
*blue = val;
break;
case 4:
*red = t;
*green = p;
*blue = val;
break;
default:
*red = val;
*green = p;
*blue = q;
break;
}
}
/* RGB <-> HSL */
void
gimp_rgb_to_hsl (guchar red,
guchar green,
guchar blue,
guchar *hue,
guchar *sat,
guchar *lum)
{
guchar min, max;
min = MIN3 (red, green, blue);
max = MAX3 (red, green, blue);
*lum = (max + min) / 2;
if (max == min) {
*hue = *sat = 0;
return;
}
if (*lum < 128)
*sat = 255 * (long) (max - min) / (max + min);
else
*sat = 255 * (long) (max - min) / (512 - max - min);
if (max == min)
*hue = 0;
else if (max == red)
*hue = 0 + 43 * (green - blue) / (max - min);
else if (max == green)
*hue = 85 + 43 * (blue - red) / (max - min);
else if (max == blue)
*hue = 171 + 43 * (red - green) / (max - min);
}
inline gint
gimp_hsl_value (gdouble n1,
gdouble n2,
gdouble hue)
{
gdouble value;
if (hue > 255)
hue -= 255;
else if (hue < 0)
hue += 255;
if (hue < 42.5)
value = n1 + (n2 - n1) * (hue / 42.5);
else if (hue < 127.5)
value = n2;
else if (hue < 170)
value = n1 + (n2 - n1) * ((170 - hue) / 42.5);
else
value = n1;
return value * 255.0;
}
void
gimp_hsl_to_rgb (guchar hue,
guchar sat,
guchar lum,
guchar *red,
guchar *green,
guchar *blue)
{
if (sat == 0) {
*red = lum;
*green = lum;
*blue = lum;
}
else {
gdouble h, s, l, m1, m2;
h = hue;
s = sat;
l = lum;
if (l < 128)
m2 = (l * (255 + s)) / 65025.0;
else
m2 = (l + s - (l * s) / 255.0) / 255.0;
m1 = (l / 127.5) - m2;
*red = gimp_hsl_value (m1, m2, h + 85);
*green = gimp_hsl_value (m1, m2, h);
*blue = gimp_hsl_value (m1, m2, h - 85);
}
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2013 Free Software Foundation, Inc.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef COLOR_UTILS_H
#define COLOR_UTILS_H
#include <glib.h>
void gimp_rgb_to_hsv (guchar red,
guchar green,
guchar blue,
guchar *hue,