gimp r26294 - in branches/soc-2008-python: . plug-ins/pygimp
- From: larsc svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26294 - in branches/soc-2008-python: . plug-ins/pygimp
- Date: Wed, 23 Jul 2008 15:40:12 +0000 (UTC)
Author: larsc
Date: Wed Jul 23 15:40:12 2008
New Revision: 26294
URL: http://svn.gnome.org/viewvc/gimp?rev=26294&view=rev
Log:
2008-07-23 Lars-Peter Clausen <lars metafoo de>
* plug-ins/pygimp/pygimp-drawable.c: Fixed usage of GimpDrawable
Modified:
branches/soc-2008-python/ChangeLog
branches/soc-2008-python/plug-ins/pygimp/pygimp-drawable.c
Modified: branches/soc-2008-python/plug-ins/pygimp/pygimp-drawable.c
==============================================================================
--- branches/soc-2008-python/plug-ins/pygimp/pygimp-drawable.c (original)
+++ branches/soc-2008-python/plug-ins/pygimp/pygimp-drawable.c Wed Jul 23 15:40:12 2008
@@ -31,18 +31,16 @@
#include <glib-object.h>
-static void
+/*static void
ensure_drawable(PyGimpDrawable *self)
{
if (!self->drawable)
self->drawable = gimp_drawable_get(self->ID);
-}
+}*/
static PyObject *
drw_flush(PyGimpDrawable *self)
{
- ensure_drawable(self);
-
gimp_drawable_flush(self->drawable);
Py_INCREF(Py_None);
@@ -129,8 +127,6 @@
&shadow, &row, &col))
return NULL;
- ensure_drawable(self);
-
t = gimp_drawable_get_tile(self->drawable, shadow, row, col);
return pygimp_tile_new(t, self);
}
@@ -147,8 +143,6 @@
&shadow, &x ,&y))
return NULL;
- ensure_drawable(self);
-
t = gimp_drawable_get_tile2(self->drawable, shadow, x, y);
return pygimp_tile_new(t, self);
}
@@ -166,8 +160,6 @@
&x, &y, &width, &height, &dirty, &shadow))
return NULL;
- ensure_drawable(self);
-
return pygimp_pixel_rgn_new(self, x, y, width, height, dirty, shadow);
}
@@ -578,7 +570,7 @@
"clip_result", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "diiii|iii:transform_rotate", kwlist,
+ "diiiii|iii:transform_rotate", kwlist,
&angle, &auto_center, ¢er_x, ¢er_y,
&transform_direction, &interpolation,
&supersample, &recursion_level,
@@ -1200,29 +1192,36 @@
PyObject *
pygimp_drawable_new(GimpDrawable *drawable, gint32 ID)
{
- PyObject *self;
+ PyObject *self = NULL;
if (drawable != NULL)
ID = drawable->drawable_id;
if (!gimp_drawable_is_valid(ID)) {
+ if (drawable)
+ gimp_drawable_detach(drawable);
Py_INCREF(Py_None);
return Py_None;
}
/* create the appropriate object type */
if (gimp_drawable_is_layer(ID))
- self = pygimp_layer_new(ID);
- else
- self = pygimp_channel_new(ID);
-
- if (self == NULL)
+ self = (PyObject*)PyObject_NEW(PyGimpLayer, &PyGimpLayer_Type);
+ else if (gimp_drawable_is_channel(ID))
+ self = (PyObject*)PyObject_NEW(PyGimpChannel, &PyGimpChannel_Type);
+
+ if (self == NULL) {
+ if (drawable)
+ gimp_drawable_detach(drawable);
return NULL;
+ }
+
+ ((PyGimpDrawable*)self)->ID = ID;
if (drawable)
((PyGimpDrawable*)self)->drawable = drawable;
- else if(((PyGimpDrawable*)self)->drawable == NULL)
- ((PyGimpDrawable*)self)->drawable = gimp_drawable_get(((PyGimpDrawable*)self)->ID);
+ else
+ ((PyGimpDrawable*)self)->drawable = gimp_drawable_get(ID);
return self;
}
@@ -1789,6 +1788,7 @@
self->ID = ID;
self->drawable = gimp_drawable_get(ID);
+
return (PyObject *)self;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]