From ed054b3b672a2cf88588a40619bef7841f06b5db Mon Sep 17 00:00:00 2001 From: Owen Date: Mon, 16 Jan 2023 20:05:13 -0800 Subject: [PATCH] add scalar offset (#2) * add offset to scalar field fn * make offset optional * remove unused list --- src/drawing/field.c | 11 ++++++----- src/field.c | 1 - third-party/sicgl | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/drawing/field.c b/src/drawing/field.c index 3c137f3..5d66956 100644 --- a/src/drawing/field.c +++ b/src/drawing/field.c @@ -16,14 +16,14 @@ PyObject* scalar_field(PyObject* self_in, PyObject* args, PyObject* kwds) { ScalarFieldObject* scalar_field_obj; ColorSequenceObject* color_sequence_obj; unsigned int interp_type = 0; + double offset = 0.0; char* keywords[] = { - "field", "scalars", "color_sequence", "interp_type", NULL, + "field", "scalars", "color_sequence", "interp_type", "offset", NULL, }; - PyObject* colors_obj = PyList_New(0); if (!PyArg_ParseTupleAndKeywords( - args, kwds, "O!O!O!|I", keywords, &ScreenType, &field_obj, + args, kwds, "O!O!O!|Id", keywords, &ScreenType, &field_obj, &ScalarFieldType, &scalar_field_obj, &ColorSequenceType, - &color_sequence_obj, &interp_type)) { + &color_sequence_obj, &interp_type, &offset)) { return NULL; } @@ -67,7 +67,8 @@ PyObject* scalar_field(PyObject* self_in, PyObject* args, PyObject* kwds) { // apply the field ret = sicgl_scalar_field( - &self->interface, field_obj->screen, scalars, &sequence, interp_map_fn); + &self->interface, field_obj->screen, scalars, offset, &sequence, + interp_map_fn); if (0 != ret) { PyErr_SetNone(PyExc_OSError); return NULL; diff --git a/src/field.c b/src/field.c index 06c439a..5f3e0eb 100644 --- a/src/field.c +++ b/src/field.c @@ -136,7 +136,6 @@ static int mp_ass_subscript(PyObject* self_in, PyObject* key, PyObject* v) { return 0; } - static void tp_dealloc(PyObject* self_in) { ScalarFieldObject* self = (ScalarFieldObject*)self_in; PyBuffer_Release(&self->_scalars_buffer); diff --git a/third-party/sicgl b/third-party/sicgl index 5bff770..8530898 160000 --- a/third-party/sicgl +++ b/third-party/sicgl @@ -1 +1 @@ -Subproject commit 5bff770bf80d3295e91240a3f409241e4c8a1790 +Subproject commit 853089889f8145690b13c700e1fe3d60c5021d8c