Skip to content

Commit

Permalink
add scalar offset (#2)
Browse files Browse the repository at this point in the history
* add offset to scalar field fn

* make offset optional

* remove unused list
  • Loading branch information
Owen committed Jan 17, 2023
1 parent 54e5201 commit ed054b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/drawing/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion third-party/sicgl
Submodule sicgl updated from 5bff77 to 853089

0 comments on commit ed054b3

Please sign in to comment.