pygimp: don't use gimp_image,layer_scale_full()

This commit is contained in:
Michael Natterer 2010-09-16 20:53:15 +02:00
parent aa55a98249
commit 98d8d686e8
2 changed files with 29 additions and 26 deletions

View file

@ -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);

View file

@ -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);