re-format with uncrustify
This commit is contained in:
parent
542fb58673
commit
97b6664201
@ -115,37 +115,77 @@ void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16
|
||||
will be on the destination to get a bounding box for scanning */
|
||||
dx = -cosAngle * px * scale + sinAngle * py * scale + ox;
|
||||
dy = -sinAngle * px * scale - cosAngle * py * scale + oy;
|
||||
if(dx < minx) minx = (int16_t)dx;
|
||||
if(dx > maxx) maxx = (int16_t)dx;
|
||||
if(dy < miny) miny = (int16_t)dy;
|
||||
if(dy > maxy) maxy = (int16_t)dy;
|
||||
if (dx < minx) {
|
||||
minx = (int16_t)dx;
|
||||
}
|
||||
if (dx > maxx) {
|
||||
maxx = (int16_t)dx;
|
||||
}
|
||||
if (dy < miny) {
|
||||
miny = (int16_t)dy;
|
||||
}
|
||||
if (dy > maxy) {
|
||||
maxy = (int16_t)dy;
|
||||
}
|
||||
|
||||
dx = cosAngle * (source->width - px) * scale + sinAngle * py * scale + ox;
|
||||
dy = sinAngle * (source->width - px) * scale - cosAngle * py * scale + oy;
|
||||
if(dx < minx) minx = (int16_t)dx;
|
||||
if(dx > maxx) maxx = (int16_t)dx;
|
||||
if(dy < miny) miny = (int16_t)dy;
|
||||
if(dy > maxy) maxy = (int16_t)dy;
|
||||
if (dx < minx) {
|
||||
minx = (int16_t)dx;
|
||||
}
|
||||
if (dx > maxx) {
|
||||
maxx = (int16_t)dx;
|
||||
}
|
||||
if (dy < miny) {
|
||||
miny = (int16_t)dy;
|
||||
}
|
||||
if (dy > maxy) {
|
||||
maxy = (int16_t)dy;
|
||||
}
|
||||
|
||||
dx = cosAngle * (source->width - px) * scale - sinAngle * (source->height - py) * scale + ox;
|
||||
dy = sinAngle * (source->width - px) * scale + cosAngle * (source->height - py) * scale + oy;
|
||||
if(dx < minx) minx = (int16_t)dx;
|
||||
if(dx > maxx) maxx = (int16_t)dx;
|
||||
if(dy < miny) miny = (int16_t)dy;
|
||||
if(dy > maxy) maxy = (int16_t)dy;
|
||||
if (dx < minx) {
|
||||
minx = (int16_t)dx;
|
||||
}
|
||||
if (dx > maxx) {
|
||||
maxx = (int16_t)dx;
|
||||
}
|
||||
if (dy < miny) {
|
||||
miny = (int16_t)dy;
|
||||
}
|
||||
if (dy > maxy) {
|
||||
maxy = (int16_t)dy;
|
||||
}
|
||||
|
||||
dx = -cosAngle * px * scale - sinAngle * (source->height - py) * scale + ox;
|
||||
dy = -sinAngle * px * scale + cosAngle * (source->height - py) * scale + oy;
|
||||
if(dx < minx) minx = (int16_t)dx;
|
||||
if(dx > maxx) maxx = (int16_t)dx;
|
||||
if(dy < miny) miny = (int16_t)dy;
|
||||
if(dy > maxy) maxy = (int16_t)dy;
|
||||
if (dx < minx) {
|
||||
minx = (int16_t)dx;
|
||||
}
|
||||
if (dx > maxx) {
|
||||
maxx = (int16_t)dx;
|
||||
}
|
||||
if (dy < miny) {
|
||||
miny = (int16_t)dy;
|
||||
}
|
||||
if (dy > maxy) {
|
||||
maxy = (int16_t)dy;
|
||||
}
|
||||
|
||||
/* Clipping */
|
||||
if(minx < dest_clip0_x) minx = dest_clip0_x;
|
||||
if(maxx > dest_clip1_x - 1) maxx = dest_clip1_x - 1;
|
||||
if(miny < dest_clip0_y) miny = dest_clip0_y;
|
||||
if(maxy > dest_clip1_y - 1) maxy = dest_clip1_y - 1;
|
||||
if (minx < dest_clip0_x) {
|
||||
minx = dest_clip0_x;
|
||||
}
|
||||
if (maxx > dest_clip1_x - 1) {
|
||||
maxx = dest_clip1_x - 1;
|
||||
}
|
||||
if (miny < dest_clip0_y) {
|
||||
miny = dest_clip0_y;
|
||||
}
|
||||
if (maxy > dest_clip1_y - 1) {
|
||||
maxy = dest_clip1_y - 1;
|
||||
}
|
||||
|
||||
float dvCol = cosAngle / scale;
|
||||
float duCol = sinAngle / scale;
|
||||
@ -277,8 +317,7 @@ void common_hal_bitmaptools_draw_line(displayio_bitmap_t *destination,
|
||||
for (y = y0; y < (y1 + 1); y++) { // write a horizontal line
|
||||
displayio_bitmap_write_pixel(destination, x0, y, value);
|
||||
}
|
||||
}
|
||||
else if (y0 == y1) { // horizontal line
|
||||
} else if (y0 == y1) { // horizontal line
|
||||
if (x0 > x1) { // ensure y1 > y0
|
||||
temp = x0;
|
||||
x0 = x1;
|
||||
@ -287,8 +326,7 @@ void common_hal_bitmaptools_draw_line(displayio_bitmap_t *destination,
|
||||
for (x = x0; x < (x1 + 1); x++) { // write a horizontal line
|
||||
displayio_bitmap_write_pixel(destination, x, y0, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
bool steep;
|
||||
steep = (abs(y1 - y0) > abs(x1 - x0));
|
||||
|
||||
@ -318,16 +356,14 @@ void common_hal_bitmaptools_draw_line(displayio_bitmap_t *destination,
|
||||
|
||||
if (y0 < y1) {
|
||||
ystep = 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ystep = -1;
|
||||
}
|
||||
|
||||
for (x = x0; x < (x1 + 1); x++) {
|
||||
if (steep) {
|
||||
displayio_bitmap_write_pixel(destination, y0, x, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
displayio_bitmap_write_pixel(destination, x, y0, value);
|
||||
}
|
||||
err -= dy;
|
||||
@ -407,24 +443,21 @@ void common_hal_bitmaptools_readinto(displayio_bitmap_t *self, pyb_file_obj_t* f
|
||||
for (int x = 0; x < self->width; x++) {
|
||||
int value = 0;
|
||||
switch (bits_per_pixel) {
|
||||
case 1:
|
||||
{
|
||||
case 1: {
|
||||
int byte_offset = x / 8;
|
||||
int bit_offset = reverse_pixels_in_element ? (7 - x % 8) : x % 8;
|
||||
|
||||
value = (rowdata8[byte_offset] >> bit_offset) & 1;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
case 2: {
|
||||
int byte_offset = x / 4;
|
||||
int bit_offset = 2 * (reverse_pixels_in_element ? (3 - x % 4) : x % 4);
|
||||
|
||||
value = (rowdata8[byte_offset] >> bit_offset) & 3;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
case 4: {
|
||||
int byte_offset = x / 2;
|
||||
int bit_offset = 4 * (reverse_pixels_in_element ? (1 - x % 2) : x % 2);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user