Skip to content

Commit 7285799

Browse files
committed
change skip_index to skip_source_index
1 parent 16d92dd commit 7285799

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

shared-bindings/bitmaptools/__init__.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_circle_obj, 0, bitmaptools_obj_draw_
959959
//| y1: int,
960960
//| x2: int,
961961
//| y2: int,
962-
//| skip_index: int,
962+
//| skip_source_index: int,
963963
//| skip_dest_index: int
964964
//| ) -> None:
965965
//| """Inserts the source_bitmap region defined by rectangular boundaries
@@ -975,14 +975,14 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_circle_obj, 0, bitmaptools_obj_draw_
975975
//| :param int y1: Minimum y-value for rectangular bounding box to be copied from the source bitmap
976976
//| :param int x2: Maximum x-value (exclusive) for rectangular bounding box to be copied from the source bitmap
977977
//| :param int y2: Maximum y-value (exclusive) for rectangular bounding box to be copied from the source bitmap
978-
//| :param int skip_index: bitmap palette index in the source that will not be copied,
978+
//| :param int skip_source_index: bitmap palette index in the source that will not be copied,
979979
//| set to None to copy all pixels
980980
//| :param int skip_dest_index: bitmap palette index in the destination bitmap that will not get overwritten
981981
//| by the pixels from the source"""
982982
//| ...
983983
//|
984984
STATIC mp_obj_t bitmaptools_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
985-
enum {ARG_destination, ARG_source, ARG_x, ARG_y, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_index, ARG_skip_dest_index};
985+
enum {ARG_destination, ARG_source, ARG_x, ARG_y, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_source_index, ARG_skip_dest_index};
986986
static const mp_arg_t allowed_args[] = {
987987
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
988988
{MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
@@ -992,7 +992,7 @@ STATIC mp_obj_t bitmaptools_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp
992992
{MP_QSTR_y1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
993993
{MP_QSTR_x2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->width
994994
{MP_QSTR_y2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->height
995-
{MP_QSTR_skip_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
995+
{MP_QSTR_skip_source_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
996996
{MP_QSTR_skip_dest_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
997997
};
998998
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
@@ -1045,15 +1045,15 @@ STATIC mp_obj_t bitmaptools_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp
10451045
y1 = temp;
10461046
}
10471047

1048-
uint32_t skip_index;
1049-
bool skip_index_none; // flag whether skip_value was None
1048+
uint32_t skip_source_index;
1049+
bool skip_source_index_none; // flag whether skip_value was None
10501050

1051-
if (args[ARG_skip_index].u_obj == mp_const_none) {
1052-
skip_index = 0;
1053-
skip_index_none = true;
1051+
if (args[ARG_skip_source_index].u_obj == mp_const_none) {
1052+
skip_source_index = 0;
1053+
skip_source_index_none = true;
10541054
} else {
1055-
skip_index = mp_obj_get_int(args[ARG_skip_index].u_obj);
1056-
skip_index_none = false;
1055+
skip_source_index = mp_obj_get_int(args[ARG_skip_source_index].u_obj);
1056+
skip_source_index_none = false;
10571057
}
10581058

10591059
uint32_t skip_dest_index;
@@ -1067,7 +1067,7 @@ STATIC mp_obj_t bitmaptools_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp
10671067
skip_dest_index_none = false;
10681068
}
10691069

1070-
common_hal_bitmaptools_blit(destination, source, x, y, x1, y1, x2, y2, skip_index, skip_index_none, skip_dest_index,
1070+
common_hal_bitmaptools_blit(destination, source, x, y, x1, y1, x2, y2, skip_source_index, skip_source_index_none, skip_dest_index,
10711071
skip_dest_index_none);
10721072

10731073
return mp_const_none;

shared-bindings/bitmaptools/__init__.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void common_hal_bitmaptools_draw_circle(displayio_bitmap_t *destination,
7171

7272
void common_hal_bitmaptools_blit(displayio_bitmap_t *destination, displayio_bitmap_t *source, int16_t x, int16_t y,
7373
int16_t x1, int16_t y1, int16_t x2, int16_t y2,
74-
uint32_t skip_index, bool skip_index_none, uint32_t skip_self_index, bool skip_self_index_none);
74+
uint32_t skip_source_index, bool skip_source_index_none, uint32_t skip_dest_index, bool skip_dest_index_none);
7575

7676
void common_hal_bitmaptools_draw_polygon(displayio_bitmap_t *destination, void *xs, void *ys, size_t points_len, int point_size, uint32_t value, bool close);
7777
void common_hal_bitmaptools_readinto(displayio_bitmap_t *self, mp_obj_t *file, int element_size, int bits_per_pixel, bool reverse_pixels_in_word, bool swap_bytes, bool reverse_rows);

shared-module/bitmaptools/__init__.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ void common_hal_bitmaptools_draw_circle(displayio_bitmap_t *destination,
984984
}
985985

986986
void common_hal_bitmaptools_blit(displayio_bitmap_t *destination, displayio_bitmap_t *source, int16_t x, int16_t y,
987-
int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_index, bool skip_index_none, uint32_t skip_dest_index,
987+
int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_source_index, bool skip_source_index_none, uint32_t skip_dest_index,
988988
bool skip_dest_index_none) {
989989

990990
if (destination->read_only) {
@@ -1034,13 +1034,13 @@ void common_hal_bitmaptools_blit(displayio_bitmap_t *destination, displayio_bitm
10341034
if ((yd_index >= 0) && (yd_index < destination->height)) {
10351035
uint32_t value = common_hal_displayio_bitmap_get_pixel(source, xs_index, ys_index);
10361036
if (skip_dest_index_none) { // if skip_dest_index is none, then only check source skip
1037-
if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True
1037+
if ((skip_source_index_none) || (value != skip_source_index)) { // write if skip_value_none is True
10381038
displayio_bitmap_write_pixel(destination, xd_index, yd_index, value);
10391039
}
10401040
} else { // check dest_value index against skip_dest_index and skip if they match
10411041
uint32_t dest_value = common_hal_displayio_bitmap_get_pixel(destination, xd_index, yd_index);
10421042
if (dest_value != skip_dest_index) {
1043-
if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True
1043+
if ((skip_source_index_none) || (value != skip_source_index)) { // write if skip_value_none is True
10441044
displayio_bitmap_write_pixel(destination, xd_index, yd_index, value);
10451045
}
10461046
}

0 commit comments

Comments
 (0)