Skip to content

Commit e84723a

Browse files
committed
Bug fixes related to input parameter handling x1,y1. Update comments
1 parent 0c17680 commit e84723a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

locale/circuitpython.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-08-14 13:42-0500\n"
11+
"POT-Creation-Date: 2020-08-14 14:20-0500\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"

shared-bindings/displayio/Bitmap.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val
182182
//| :param bitmap source_bitmap: Source bitmap that contains the graphical region to be copied
183183
//| : param int x1: Minimum x-value for rectangular bounding box to be copied from the source bitmap
184184
//| : param int y1: Minimum y-value for rectangular bounding box to be copied from the source bitmap
185-
//| : param int x2: Maximum x-value for rectangular bounding box to be copied from the source bitmap
186-
//| : param int y2: Maximum y-value for rectangular bounding box to be copied from the source bitmap
185+
//| : param int x2: Maximum x-value (exclusive) for rectangular bounding box to be copied from the source bitmap
186+
//| : param int y2: Maximum y-value (exclusive) for rectangular bounding box to be copied from the source bitmap
187187
//| : param int skip_index: bitmap palette index in the source that will not be copied,
188188
//| set `None` to copy all pixels"""
189189
//| ...
@@ -195,8 +195,8 @@ STATIC mp_obj_t displayio_bitmap_obj_blit(size_t n_args, const mp_obj_t *pos_arg
195195
{MP_QSTR_x, MP_ARG_REQUIRED | MP_ARG_INT},
196196
{MP_QSTR_y, MP_ARG_REQUIRED | MP_ARG_INT},
197197
{MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ},
198-
{MP_QSTR_x1, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = 0} },
199-
{MP_QSTR_y1, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = 0} },
198+
{MP_QSTR_x1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
199+
{MP_QSTR_y1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
200200
{MP_QSTR_x2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->width
201201
{MP_QSTR_y2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->height
202202
{MP_QSTR_skip_index, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj=mp_const_none} },
@@ -216,7 +216,9 @@ STATIC mp_obj_t displayio_bitmap_obj_blit(size_t n_args, const mp_obj_t *pos_arg
216216
mp_raise_ValueError(translate("Cannot blit: source palette too large."));
217217
}
218218

219-
int16_t x1, y1, x2, y2;
219+
int16_t x1 = args[ARG_x1].u_int;
220+
int16_t y1 = args[ARG_y1].u_int;
221+
int16_t x2, y2;
220222
// if x2 or y2 is None, then set as the maximum size of the source bitmap
221223
if ( args[ARG_x2].u_obj == mp_const_none ) {
222224
x2 = source->width;

0 commit comments

Comments
 (0)