From 98d8d686e871c2d3ec4f4103fb894e1ccd25ddc8 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Thu, 16 Sep 2010 20:53:15 +0200 Subject: [PATCH] pygimp: don't use gimp_image,layer_scale_full() --- plug-ins/pygimp/pygimp-drawable.c | 29 +++++++++++++++-------------- plug-ins/pygimp/pygimp-image.c | 26 ++++++++++++++------------ 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/plug-ins/pygimp/pygimp-drawable.c b/plug-ins/pygimp/pygimp-drawable.c index a849f93eb4..beced64722 100644 --- a/plug-ins/pygimp/pygimp-drawable.c +++ b/plug-ins/pygimp/pygimp-drawable.c @@ -1420,21 +1420,22 @@ lay_scale(PyGimpLayer *self, PyObject *args, PyObject *kwargs) return NULL; if (interpolation != -1) { - if (!gimp_layer_scale_full(self->ID, - new_width, new_height, - local_origin, interpolation)) { - PyErr_Format(pygimp_error, - "could not scale layer (ID %d) to size %dx%d", - self->ID, new_width, new_height); - return NULL; - } - } else { - if (!gimp_layer_scale(self->ID, new_width, new_height, local_origin)) { - PyErr_Format(pygimp_error, - "could not scale layer (ID %d) to size %dx%d", - self->ID, new_width, new_height); - return NULL; + gimp_context_push(); + gimp_context_set_interpolation(interpolation); + } + + if (!gimp_layer_scale(self->ID, new_width, new_height, local_origin)) { + PyErr_Format(pygimp_error, + "could not scale layer (ID %d) to size %dx%d", + self->ID, new_width, new_height); + if (interpolation != -1) { + gimp_context_pop(); } + return NULL; + } + + if (interpolation != -1) { + gimp_context_pop(); } Py_INCREF(Py_None); diff --git a/plug-ins/pygimp/pygimp-image.c b/plug-ins/pygimp/pygimp-image.c index 9b3f340549..5eac026255 100644 --- a/plug-ins/pygimp/pygimp-image.c +++ b/plug-ins/pygimp/pygimp-image.c @@ -20,7 +20,6 @@ # include #endif -#undef GIMP_DISABLE_DEPRECATED #include "pygimp.h" static PyObject * @@ -510,18 +509,21 @@ img_scale(PyGimpImage *self, PyObject *args, PyObject *kwargs) return NULL; if (interpolation != -1) { - if (!gimp_image_scale_full(self->ID, - new_width, new_height, interpolation)) { - PyErr_Format(pygimp_error, "could not scale image (ID %d) to %dx%d", - self->ID, new_width, new_height); - return NULL; - } - } else { - if (!gimp_image_scale(self->ID, new_width, new_height)) { - PyErr_Format(pygimp_error, "could not scale image (ID %d) to %dx%d", - self->ID, new_width, new_height); - return NULL; + gimp_context_push(); + gimp_context_set_interpolation(interpolation); + } + + if (!gimp_image_scale(self->ID, new_width, new_height)) { + PyErr_Format(pygimp_error, "could not scale image (ID %d) to %dx%d", + self->ID, new_width, new_height); + if (interpolation != -1) { + gimp_context_pop(); } + return NULL; + } + + if (interpolation != -1) { + gimp_context_pop(); } Py_INCREF(Py_None);