[gimp] pygimp: don't use gimp_image,layer_scale_full()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] pygimp: don't use gimp_image,layer_scale_full()
- Date: Thu, 16 Sep 2010 18:54:09 +0000 (UTC)
commit 98d8d686e871c2d3ec4f4103fb894e1ccd25ddc8
Author: Michael Natterer <mitch gimp org>
Date: Thu Sep 16 20:53:15 2010 +0200
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 a849f93..beced64 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 9b3f340..5eac026 100644
--- a/plug-ins/pygimp/pygimp-image.c
+++ b/plug-ins/pygimp/pygimp-image.c
@@ -20,7 +20,6 @@
# include <config.h>
#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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]