diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/lib/gray_core.c | 17 | ||||
-rw-r--r-- | apps/plugins/lib/gray_draw.c | 5 |
2 files changed, 10 insertions, 12 deletions
diff --git a/apps/plugins/lib/gray_core.c b/apps/plugins/lib/gray_core.c index 413b66c65d..2f5f165fbd 100644 --- a/apps/plugins/lib/gray_core.c +++ b/apps/plugins/lib/gray_core.c | |||
@@ -403,7 +403,7 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, | |||
403 | #ifdef SIMULATOR | 403 | #ifdef SIMULATOR |
404 | if (!buffered) | 404 | if (!buffered) |
405 | { | 405 | { |
406 | long orig_size = depth * plane_size + (depth + 1) * sizeof(long); | 406 | long orig_size = MULU16(depth, plane_size) + (depth + 1) * sizeof(long); |
407 | 407 | ||
408 | plane_size = MULU16(width, height); | 408 | plane_size = MULU16(width, height); |
409 | if (plane_size > orig_size) | 409 | if (plane_size > orig_size) |
@@ -420,7 +420,7 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, | |||
420 | } | 420 | } |
421 | else | 421 | else |
422 | #endif | 422 | #endif |
423 | buftaken += depth * plane_size + (depth + 1) * sizeof(long); | 423 | buftaken += MULU16(depth, plane_size) + (depth + 1) * sizeof(long); |
424 | 424 | ||
425 | _gray_info.x = 0; | 425 | _gray_info.x = 0; |
426 | _gray_info.y = 0; | 426 | _gray_info.y = 0; |
@@ -439,8 +439,8 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, | |||
439 | _gray_info.cur_plane = 0; | 439 | _gray_info.cur_plane = 0; |
440 | _gray_info.plane_size = plane_size; | 440 | _gray_info.plane_size = plane_size; |
441 | _gray_info.plane_data = gbuf; | 441 | _gray_info.plane_data = gbuf; |
442 | _gray_rb->memset(gbuf, 0, depth * plane_size); | 442 | _gray_rb->memset(gbuf, 0, MULU16(depth, plane_size)); |
443 | gbuf += depth * plane_size; | 443 | gbuf += MULU16(depth, plane_size); |
444 | _gray_info.bitpattern = (unsigned long *)gbuf; | 444 | _gray_info.bitpattern = (unsigned long *)gbuf; |
445 | 445 | ||
446 | i = depth - 1; | 446 | i = depth - 1; |
@@ -1072,11 +1072,11 @@ void gray_update_rect(int x, int y, int width, int height) | |||
1072 | 1072 | ||
1073 | #if CONFIG_CPU == SH7034 | 1073 | #if CONFIG_CPU == SH7034 |
1074 | asm volatile ( | 1074 | asm volatile ( |
1075 | "mov.l @%[cbuf], r1 \n" | ||
1076 | "mov.l @%[bbuf], r2 \n" | 1075 | "mov.l @%[bbuf], r2 \n" |
1076 | "mov.l @%[cbuf], r1 \n" | ||
1077 | "mov.l @(4,%[bbuf]), %[chg]\n" | ||
1077 | "xor r1, r2 \n" | 1078 | "xor r1, r2 \n" |
1078 | "mov.l @(4,%[cbuf]), r1 \n" | 1079 | "mov.l @(4,%[cbuf]), r1 \n" |
1079 | "mov.l @(4,%[bbuf]), %[chg]\n" | ||
1080 | "xor r1, %[chg] \n" | 1080 | "xor r1, %[chg] \n" |
1081 | "or r2, %[chg] \n" | 1081 | "or r2, %[chg] \n" |
1082 | : /* outputs */ | 1082 | : /* outputs */ |
@@ -1110,11 +1110,10 @@ void gray_update_rect(int x, int y, int width, int height) | |||
1110 | "cmp/eq r0, r1 \n" /* no change? */ | 1110 | "cmp/eq r0, r1 \n" /* no change? */ |
1111 | "bt .ur_skip \n" /* -> skip */ | 1111 | "bt .ur_skip \n" /* -> skip */ |
1112 | 1112 | ||
1113 | "mov #75, r1 \n" | ||
1114 | "mulu r1, %[rnd] \n" /* multiply by 75 */ | ||
1113 | "shll2 r0 \n" /* pixel value -> pattern offset */ | 1115 | "shll2 r0 \n" /* pixel value -> pattern offset */ |
1114 | "mov.l @(r0,%[bpat]), r4 \n" /* r4 = bitpattern[byte]; */ | 1116 | "mov.l @(r0,%[bpat]), r4 \n" /* r4 = bitpattern[byte]; */ |
1115 | |||
1116 | "mov #75, r0 \n" | ||
1117 | "mulu r0, %[rnd] \n" /* multiply by 75 */ | ||
1118 | "sts macl, %[rnd] \n" | 1117 | "sts macl, %[rnd] \n" |
1119 | "add #74, %[rnd] \n" /* add another 74 */ | 1118 | "add #74, %[rnd] \n" /* add another 74 */ |
1120 | /* Since the lower bits are not very random: */ | 1119 | /* Since the lower bits are not very random: */ |
diff --git a/apps/plugins/lib/gray_draw.c b/apps/plugins/lib/gray_draw.c index bd8ea4f1ce..e501618e8d 100644 --- a/apps/plugins/lib/gray_draw.c +++ b/apps/plugins/lib/gray_draw.c | |||
@@ -1303,14 +1303,13 @@ static void _writearray(unsigned char *address, const unsigned char *src, | |||
1303 | "bf .wa_skip \n" /* skip this pixel */ | 1303 | "bf .wa_skip \n" /* skip this pixel */ |
1304 | 1304 | ||
1305 | "mov.b @%[src], r0 \n" /* load src byte */ | 1305 | "mov.b @%[src], r0 \n" /* load src byte */ |
1306 | "mov #75, r1 \n" | ||
1306 | "extu.b r0, r0 \n" /* extend unsigned */ | 1307 | "extu.b r0, r0 \n" /* extend unsigned */ |
1307 | "mov.b @(r0,%[trns]), r0 \n" /* idxtable into pattern index */ | 1308 | "mov.b @(r0,%[trns]), r0 \n" /* idxtable into pattern index */ |
1309 | "mulu r1, %[rnd] \n" /* multiply by 75 */ | ||
1308 | "extu.b r0, r0 \n" /* extend unsigned */ | 1310 | "extu.b r0, r0 \n" /* extend unsigned */ |
1309 | "shll2 r0 \n" | 1311 | "shll2 r0 \n" |
1310 | "mov.l @(r0,%[bpat]), r4 \n" /* r4 = bitpattern[byte]; */ | 1312 | "mov.l @(r0,%[bpat]), r4 \n" /* r4 = bitpattern[byte]; */ |
1311 | |||
1312 | "mov #75, r0 \n" | ||
1313 | "mulu r0, %[rnd] \n" /* multiply by 75 */ | ||
1314 | "sts macl, %[rnd] \n" | 1313 | "sts macl, %[rnd] \n" |
1315 | "add #74, %[rnd] \n" /* add another 74 */ | 1314 | "add #74, %[rnd] \n" /* add another 74 */ |
1316 | /* Since the lower bits are not very random: */ | 1315 | /* Since the lower bits are not very random: */ |