aboutsummaryrefslogtreecommitdiff
path: root/hw/display/sm501_template.h
diff options
context:
space:
mode:
authorBALATON Zoltan <balaton@eik.bme.hu>2017-04-21 17:18:09 +0200
committerPeter Maydell <peter.maydell@linaro.org>2017-04-24 12:32:12 +0100
commit01d2d584c9e1d051892de115ab20787da62baf6a (patch)
treedba63e29e6b5a7e3ddd0a63b681b9f659df7fdeb /hw/display/sm501_template.h
parent6a2a5aae02b9a0b53807b9ad91f15cd4988781f9 (diff)
sm501: Misc clean ups
- Rename a variable - Move variable declarations out of loop to the beginning in draw_hwc_line Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Aurelien Jarno <aurelien@aurel32.net> Message-id: 187c9e4e09d9bc2967b2454b36bb088ceef0b8bc.1492787889.git.balaton@eik.bme.hu Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/display/sm501_template.h')
-rw-r--r--hw/display/sm501_template.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/hw/display/sm501_template.h b/hw/display/sm501_template.h
index fa0d6a92c0..a60abad019 100644
--- a/hw/display/sm501_template.h
+++ b/hw/display/sm501_template.h
@@ -96,7 +96,7 @@ static void glue(draw_hwc_line_, PIXEL_NAME)(uint8_t *d, const uint8_t *s,
int width, const uint8_t *palette, int c_x, int c_y)
{
int i;
- uint8_t bitset = 0;
+ uint8_t r, g, b, v, bitset = 0;
/* get cursor position */
assert(0 <= c_y && c_y < SM501_HWC_HEIGHT);
@@ -104,8 +104,6 @@ static void glue(draw_hwc_line_, PIXEL_NAME)(uint8_t *d, const uint8_t *s,
d += c_x * BPP;
for (i = 0; i < SM501_HWC_WIDTH && c_x + i < width; i++) {
- uint8_t v;
-
/* get pixel value */
if (i % 4 == 0) {
bitset = ldub_p(s);
@@ -117,9 +115,9 @@ static void glue(draw_hwc_line_, PIXEL_NAME)(uint8_t *d, const uint8_t *s,
/* write pixel */
if (v) {
v--;
- uint8_t r = palette[v * 3 + 0];
- uint8_t g = palette[v * 3 + 1];
- uint8_t b = palette[v * 3 + 2];
+ r = palette[v * 3 + 0];
+ g = palette[v * 3 + 1];
+ b = palette[v * 3 + 2];
*(PIXEL_TYPE *)d = glue(rgb_to_pixel, PIXEL_NAME)(r, g, b);
}
d += BPP;