Skip to content

Commit

Permalink
artist: checkpatch and newline style fixes
Browse files Browse the repository at this point in the history
Ensure that subsequent patches do not cause checkpatch to fail and also tidy up
extra/missing newlines.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220504153708.10352-2-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  • Loading branch information
mcayland committed May 8, 2022
1 parent 297d410 commit 5d61789
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions hw/display/artist.c
Expand Up @@ -211,8 +211,9 @@ static void artist_invalidate_lines(struct vram_buffer *buf,
int start = starty * buf->width;
int size;

if (starty + height > buf->height)
if (starty + height > buf->height) {
height = buf->height - starty;
}

size = height * buf->width;

Expand Down Expand Up @@ -321,8 +322,9 @@ static void artist_get_cursor_pos(ARTISTState *s, int *x, int *y)
}

lx = artist_get_x(s->cursor_pos);
if (lx < offset)
if (lx < offset) {
offset = lx;
}
*x = (lx - offset) / 2;

*y = 1146 - artist_get_y(s->cursor_pos);
Expand All @@ -343,6 +345,7 @@ static void artist_get_cursor_pos(ARTISTState *s, int *x, int *y)
static void artist_invalidate_cursor(ARTISTState *s)
{
int x, y;

artist_get_cursor_pos(s, &x, &y);
artist_invalidate_lines(&s->vram_buffer[ARTIST_BUFFER_AP],
y, s->cursor_height);
Expand Down Expand Up @@ -470,10 +473,9 @@ static void draw_line(ARTISTState *s,

if ((x1 >= buf->width && x2 >= buf->width) ||
(y1 >= buf->height && y2 >= buf->height)) {
return;
return;
}


if (update_start) {
s->vram_start = (x2 << 16) | y2;
}
Expand Down Expand Up @@ -553,15 +555,15 @@ static void draw_line(ARTISTState *s,
x++;
} while (x <= x2 && (max_pix == -1 || --max_pix > 0));

if (c1)
if (c1) {
artist_invalidate_lines(buf, x1, x2 - x1);
else
} else {
artist_invalidate_lines(buf, y1 > y2 ? y2 : y1, x2 - x1);
}
}

static void draw_line_pattern_start(ARTISTState *s)
{

int startx = artist_get_x(s->vram_start);
int starty = artist_get_y(s->vram_start);
int endx = artist_get_x(s->blockmove_size);
Expand All @@ -574,7 +576,6 @@ static void draw_line_pattern_start(ARTISTState *s)

static void draw_line_pattern_next(ARTISTState *s)
{

int startx = artist_get_x(s->vram_start);
int starty = artist_get_y(s->vram_start);
int endx = artist_get_x(s->blockmove_size);
Expand All @@ -589,7 +590,6 @@ static void draw_line_pattern_next(ARTISTState *s)

static void draw_line_size(ARTISTState *s, bool update_start)
{

int startx = artist_get_x(s->vram_start);
int starty = artist_get_y(s->vram_start);
int endx = artist_get_x(s->line_size);
Expand All @@ -600,7 +600,6 @@ static void draw_line_size(ARTISTState *s, bool update_start)

static void draw_line_xy(ARTISTState *s, bool update_start)
{

int startx = artist_get_x(s->vram_start);
int starty = artist_get_y(s->vram_start);
int sizex = artist_get_x(s->blockmove_size);
Expand Down Expand Up @@ -650,7 +649,6 @@ static void draw_line_xy(ARTISTState *s, bool update_start)

static void draw_line_end(ARTISTState *s, bool update_start)
{

int startx = artist_get_x(s->vram_start);
int starty = artist_get_y(s->vram_start);
int endx = artist_get_x(s->line_end);
Expand Down Expand Up @@ -835,6 +833,7 @@ static void artist_vram_write(void *opaque, hwaddr addr, uint64_t val,
unsigned size)
{
ARTISTState *s = opaque;

s->vram_char_y = 0;
trace_artist_vram_write(size, addr, val);
vram_bit_write(opaque, addr, 0, val, size);
Expand Down Expand Up @@ -1244,7 +1243,6 @@ static void artist_update_display(void *opaque)
DisplaySurface *surface = qemu_console_surface(s->con);
int first = 0, last;


framebuffer_update_display(surface, &s->fbsection, s->width, s->height,
s->width, s->width * 4, 0, 0, artist_draw_line,
s, &first, &last);
Expand All @@ -1258,6 +1256,7 @@ static void artist_invalidate(void *opaque)
{
ARTISTState *s = ARTIST(opaque);
struct vram_buffer *buf = &s->vram_buffer[ARTIST_BUFFER_AP];

memory_region_set_dirty(&buf->mr, 0, buf->size);
}

Expand Down

0 comments on commit 5d61789

Please sign in to comment.