1 // SPDX-License-Identifier: MIT
7 #include "config_file/config_file.h"
9 #include "gpio/ps_protocol.h"
13 extern uint32_t rtg_address[8];
14 extern uint32_t rtg_address_adj[8];
15 extern uint8_t *rtg_mem; // FIXME
16 extern uint16_t rtg_display_format;
17 extern uint16_t rtg_user[8];
18 extern uint16_t rtg_x[8], rtg_y[8];
20 extern uint8_t realtime_graphics_debug;
22 uint8_t cursor_data[256 * 256];
24 void rtg_fillrect_solid(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint32_t color, uint16_t pitch, uint16_t format) {
25 uint8_t *dptr = &rtg_mem[rtg_address_adj[0] + (x << format) + (y * pitch)];
28 for (int xs = 0; xs < w; xs++) {
29 dptr[xs] = color & 0xFF;
34 color = htobe16((color & 0xFFFF));
35 uint16_t *ptr = (uint16_t *)dptr;
36 for (int xs = 0; xs < w; xs++) {
42 color = htobe32(color);
43 uint32_t *ptr = (uint32_t *)dptr;
44 for (int xs = 0; xs < w; xs++) {
50 for (int ys = 1; ys < h; ys++) {
52 memcpy(dptr, (void *)(size_t)(dptr - pitch), (w << format));
56 void rtg_fillrect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint32_t color, uint16_t pitch, uint16_t format, uint8_t mask) {
57 uint8_t *dptr = &rtg_mem[rtg_address_adj[0] + (x << format) + (y * pitch)];
59 for (int ys = 0; ys < h; ys++) {
60 for (int xs = 0; xs < w; xs++) {
61 SET_RTG_PIXEL_MASK(&dptr[xs], (color & 0xFF), format);
67 void rtg_invertrect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t pitch, uint16_t format, uint8_t mask) {
69 uint8_t *dptr = &rtg_mem[rtg_address_adj[0] + (x << format) + (y * pitch)];
70 for (int ys = 0; ys < h; ys++) {
73 for (int xs = 0; xs < w; xs++) {
79 for (int xs = 0; xs < w; xs++) {
80 ((uint16_t *)dptr)[xs] = ~((uint16_t *)dptr)[xs];
85 for (int xs = 0; xs < w; xs++) {
86 ((uint32_t *)dptr)[xs] = ~((uint32_t *)dptr)[xs];
95 void rtg_blitrect(uint16_t x, uint16_t y, uint16_t dx, uint16_t dy, uint16_t w, uint16_t h, uint16_t pitch, uint16_t format, uint8_t mask) {
97 uint8_t *sptr = &rtg_mem[rtg_address_adj[0] + (x << format) + (y * pitch)];
98 uint8_t *dptr = &rtg_mem[rtg_address_adj[0] + (dx << format) + (dy * pitch)];
100 uint32_t xdir = 1, pitchstep = pitch;
104 sptr += ((h - 1) * pitch);
105 dptr += ((h - 1) * pitch);
111 for (int ys = 0; ys < h; ys++) {
113 for (int xs = 0; xs < w; xs++) {
114 SET_RTG_PIXEL_MASK(&dptr[xs], sptr[xs], format);
118 for (int xs = w - 1; xs >= x; xs--) {
119 SET_RTG_PIXEL_MASK(&dptr[xs], sptr[xs], format);
127 void rtg_blitrect_solid(uint16_t x, uint16_t y, uint16_t dx, uint16_t dy, uint16_t w, uint16_t h, uint16_t pitch, uint16_t format) {
128 uint8_t *sptr = &rtg_mem[rtg_address_adj[0] + (x << format) + (y * pitch)];
129 uint8_t *dptr = &rtg_mem[rtg_address_adj[0] + (dx << format) + (dy * pitch)];
131 uint32_t xdir = 1, pitchstep = pitch;
135 sptr += ((h - 1) * pitch);
136 dptr += ((h - 1) * pitch);
142 for (int ys = 0; ys < h; ys++) {
144 memcpy(dptr, sptr, w << format);
146 memmove(dptr, sptr, w << format);
152 void rtg_blitrect_nomask_complete(uint16_t sx, uint16_t sy, uint16_t dx, uint16_t dy, uint16_t w, uint16_t h, uint16_t srcpitch, uint16_t dstpitch, uint32_t src_addr, uint32_t dst_addr, uint16_t format, uint8_t minterm) {
154 uint8_t *sptr = &rtg_mem[src_addr - (PIGFX_RTG_BASE + PIGFX_REG_SIZE) + (sx << format) + (sy * srcpitch)];
155 uint8_t *dptr = &rtg_mem[dst_addr - (PIGFX_RTG_BASE + PIGFX_REG_SIZE) + (dx << format) + (dy * dstpitch)];
157 uint32_t xdir = 1, src_pitchstep = srcpitch, dst_pitchstep = dstpitch;
158 uint8_t draw_mode = minterm;
159 uint32_t mask = 0xFF;
161 if (src_addr == dst_addr) {
163 src_pitchstep = -srcpitch;
164 sptr += ((h - 1) * srcpitch);
165 dst_pitchstep = -dstpitch;
166 dptr += ((h - 1) * dstpitch);
173 if (format == RTGFMT_RBG565)
175 if (format == RTGFMT_RGB32)
178 if (minterm == MINTERM_SRC) {
179 for (int ys = 0; ys < h; ys++) {
181 memcpy(dptr, sptr, w << format);
183 memmove(dptr, sptr, w << format);
184 sptr += src_pitchstep;
185 dptr += dst_pitchstep;
189 for (int ys = 0; ys < h; ys++) {
191 for (int xs = 0; xs < w; xs++) {
194 HANDLE_MINTERM_PIXEL(sptr[xs], dptr[xs], format);
197 HANDLE_MINTERM_PIXEL(((uint16_t *)sptr)[xs], ((uint16_t *)dptr)[xs], format);
200 HANDLE_MINTERM_PIXEL(((uint32_t *)sptr)[xs], ((uint32_t *)dptr)[xs], format);
206 for (int xs = w - 1; xs >= sx; xs--) {
209 HANDLE_MINTERM_PIXEL(sptr[xs], dptr[xs], format);
212 HANDLE_MINTERM_PIXEL(((uint16_t *)sptr)[xs], ((uint16_t *)dptr)[xs], format);
215 HANDLE_MINTERM_PIXEL(((uint32_t *)sptr)[xs], ((uint32_t *)dptr)[xs], format);
220 sptr += src_pitchstep;
221 dptr += src_pitchstep;
226 extern struct emulator_config *cfg;
228 void rtg_blittemplate(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint32_t src_addr, uint32_t fgcol, uint32_t bgcol, uint16_t pitch, uint16_t t_pitch, uint16_t format, uint16_t offset_x, uint8_t mask, uint8_t draw_mode) {
231 uint8_t *dptr = &rtg_mem[rtg_address_adj[1] + (x << format) + (y * pitch)];
232 uint8_t *sptr = NULL;
233 uint8_t cur_bit = 0, base_bit = 0, cur_byte = 0;
234 uint8_t invert = (draw_mode & DRAWMODE_INVERSVID);
239 tmpl_x = offset_x / 8;
240 cur_bit = base_bit = (0x80 >> (offset_x % 8));
242 if (realtime_graphics_debug) {
243 printf("DEBUG: BlitTemplate - %d, %d (%dx%d)\n", x, y, w, h);
244 printf("Src: %.8X (%.8X)\n", src_addr, rtg_address_adj[0]);
245 printf("Dest: %.8X (%.8X)\n", rtg_address[1], rtg_address_adj[1]);
246 printf("pitch: %d t_pitch: %d format: %d\n", pitch, t_pitch, format);
247 printf("offset_x: %d mask: %.2X draw_mode: %d\n", offset_x, mask, draw_mode);
250 uint32_t fg_color[3] = {
252 htobe16((fgcol & 0xFFFF)),
255 uint32_t bg_color[3] = {
257 htobe16((bgcol & 0xFFFF)),
261 if (src_addr >= (PIGFX_RTG_BASE + PIGFX_REG_SIZE)) {
262 sptr = &rtg_mem[src_addr - (PIGFX_RTG_BASE + PIGFX_REG_SIZE)];
263 if (realtime_graphics_debug) {
264 printf("Origin: %.8X\n", rtg_address[2]);
265 printf("Grabbing data from RTG memory.\nData:\n");
266 for (int i = 0; i < h; i++) {
267 for (int j = 0; j < t_pitch; j++) {
268 printf("%.2X", sptr[j + (i * t_pitch)]);
273 printf("Data available at origin:\n");
274 for (int i = 0; i < h; i++) {
275 for (int j = 0; j < w; j++) {
276 printf("%.2X", read8(rtg_address[2] + j + (i * t_pitch)));
284 int i = get_mapped_item_by_address(cfg, src_addr);
286 sptr = &cfg->map_data[i][src_addr - cfg->map_offset[i]];
287 if (realtime_graphics_debug) {
288 printf("Grabbing data from maping %d - offset %.8lX\nData:\n", i, src_addr - cfg->map_offset[i]);
289 for (int i = 0; i < h; i++) {
290 for (int j = 0; j < t_pitch; j++) {
291 printf("%.2X", sptr[j + (i * t_pitch)]);
298 printf("BlitTemplate: Failed to find mapped range for address %.8X\n", src_addr);
305 for (uint16_t ys = 0; ys < h; ys++) {
306 cur_byte = (invert) ? sptr[tmpl_x] ^ 0xFF : sptr[tmpl_x];
308 for (int xs = 0; xs < w; xs++) {
309 if (w >= 8 && cur_bit == 0x80 && xs < w - 8) {
310 if (mask == 0xFF || format != RTGFMT_8BIT) {
311 SET_RTG_PIXELS(&dptr[xs << format], fg_color[format], format);
314 SET_RTG_PIXELS_MASK(&dptr[xs], fg_color[format], format);
319 while (cur_bit > 0 && xs < w) {
320 if (cur_byte & cur_bit) {
321 if (mask == 0xFF || format != RTGFMT_8BIT) {
322 SET_RTG_PIXEL(&dptr[xs << format], fg_color[format], format);
325 SET_RTG_PIXEL_MASK(&dptr[xs], fg_color[format], format);
340 for (uint16_t ys = 0; ys < h; ys++) {
341 cur_byte = (invert) ? sptr[tmpl_x] ^ 0xFF : sptr[tmpl_x];
343 for (int xs = 0; xs < w; xs++) {
344 if (w >= 8 && cur_bit == 0x80 && xs < w - 8) {
345 if (mask == 0xFF || format != RTGFMT_8BIT) {
346 SET_RTG_PIXELS2_COND(&dptr[xs << format], fg_color[format], bg_color[format], format);
349 SET_RTG_PIXELS2_COND_MASK(&dptr[xs << format], fg_color[format], bg_color[format], format);
355 while (cur_bit > 0 && xs < w) {
356 if (mask == 0xFF || format != RTGFMT_8BIT) {
357 SET_RTG_PIXEL(&dptr[xs << format], (cur_byte & cur_bit) ? fg_color[format] : bg_color[format], format);
360 SET_RTG_PIXEL_MASK(&dptr[xs << format], (cur_byte & cur_bit) ? fg_color[format] : bg_color[format], format);
373 case DRAWMODE_COMPLEMENT:
374 for (uint16_t ys = 0; ys < h; ys++) {
375 cur_byte = (invert) ? sptr[tmpl_x] ^ 0xFF : sptr[tmpl_x];
377 for (int xs = 0; xs < w; xs++) {
378 if (w >= 8 && cur_bit == 0x80 && xs < w - 8) {
379 INVERT_RTG_PIXELS(&dptr[xs << format], format)
383 while (cur_bit > 0 && xs < w) {
384 if (cur_byte & cur_bit) {
385 INVERT_RTG_PIXEL(&dptr[xs << format], format)
401 void rtg_blitpattern(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint32_t src_addr, uint32_t fgcol, uint32_t bgcol, uint16_t pitch, uint16_t format, uint16_t offset_x, uint16_t offset_y, uint8_t mask, uint8_t draw_mode, uint8_t loop_rows) {
404 uint8_t *dptr = &rtg_mem[rtg_address_adj[1] + (x << format) + (y * pitch)];
405 uint8_t *sptr = NULL, *sptr_base = NULL;
406 uint8_t cur_bit = 0, base_bit = 0, cur_byte = 0;
407 uint8_t invert = (draw_mode & DRAWMODE_INVERSVID);
412 tmpl_x = (offset_x / 8) % 2;
413 cur_bit = base_bit = (0x80 >> (offset_x % 8));
415 uint32_t fg_color[3] = {
417 htobe16((fgcol & 0xFFFF)),
420 uint32_t bg_color[3] = {
422 htobe16((bgcol & 0xFFFF)),
427 if (src_addr >= (PIGFX_RTG_BASE + PIGFX_REG_SIZE))
428 sptr = &rtg_mem[src_addr - (PIGFX_RTG_BASE + PIGFX_REG_SIZE)];
430 int i = get_mapped_item_by_address(cfg, src_addr);
432 sptr = &cfg->map_data[i][src_addr - cfg->map_offset[i]];
435 printf("BlitPattern: Failed to find mapped range for address %.8X\n", src_addr);
441 sptr += (offset_y % loop_rows) * 2;
445 for (uint16_t ys = 0; ys < h; ys++) {
446 cur_byte = (invert) ? sptr[tmpl_x] ^ 0xFF : sptr[tmpl_x];
448 for (int xs = 0; xs < w; xs++) {
449 if (w >= 8 && cur_bit == 0x80 && xs < w - 8) {
450 if (mask == 0xFF || format != RTGFMT_8BIT) {
451 SET_RTG_PIXELS(&dptr[xs << format], fg_color[format], format);
454 SET_RTG_PIXELS_MASK(&dptr[xs], fg_color[format], format);
459 while (cur_bit > 0 && xs < w) {
460 if (cur_byte & cur_bit) {
461 if (mask == 0xFF || format != RTGFMT_8BIT) {
462 SET_RTG_PIXEL(&dptr[xs << format], fg_color[format], format);
465 SET_RTG_PIXEL_MASK(&dptr[xs], fg_color[format], format);
480 for (uint16_t ys = 0; ys < h; ys++) {
481 cur_byte = (invert) ? sptr[tmpl_x] ^ 0xFF : sptr[tmpl_x];
483 for (int xs = 0; xs < w; xs++) {
484 if (w >= 8 && cur_bit == 0x80 && xs < w - 8) {
485 if (mask == 0xFF || format != RTGFMT_8BIT) {
486 SET_RTG_PIXELS2_COND(&dptr[xs << format], fg_color[format], bg_color[format], format);
489 SET_RTG_PIXELS2_COND_MASK(&dptr[xs << format], fg_color[format], bg_color[format], format);
495 while (cur_bit > 0 && xs < w) {
496 if (mask == 0xFF || format != RTGFMT_8BIT) {
497 SET_RTG_PIXEL(&dptr[xs << format], (cur_byte & cur_bit) ? fg_color[format] : bg_color[format], format);
500 SET_RTG_PIXEL_MASK(&dptr[xs << format], (cur_byte & cur_bit) ? fg_color[format] : bg_color[format], format);
513 case DRAWMODE_COMPLEMENT:
514 for (uint16_t ys = 0; ys < h; ys++) {
515 cur_byte = (invert) ? sptr[tmpl_x] ^ 0xFF : sptr[tmpl_x];
517 for (int xs = 0; xs < w; xs++) {
518 if (w >= 8 && cur_bit == 0x80 && xs < w - 8) {
519 INVERT_RTG_PIXELS(&dptr[xs << format], format)
523 while (cur_bit > 0 && xs < w) {
524 if (cur_byte & cur_bit) {
525 INVERT_RTG_PIXEL(&dptr[xs << format], format)
541 void rtg_drawline_solid(int16_t x1_, int16_t y1_, int16_t x2_, int16_t y2_, uint16_t len, uint32_t fgcol, uint16_t pitch, uint16_t format) {
542 int16_t x1 = x1_, y1 = y1_;
543 int16_t x2 = x1_ + x2_, y2 = y1 + y2_;
545 uint32_t fg_color[3] = {
547 htobe16((fgcol & 0xFFFF)),
551 uint8_t *dptr = &rtg_mem[rtg_address_adj[0] + (y1 * pitch)];
553 int32_t line_step = pitch;
556 int16_t dx, dy, dx_abs, dy_abs, ix, iy, x = x1;
570 SET_RTG_PIXEL(&dptr[x << format], fg_color[format], format);
572 if (dx_abs >= dy_abs) {
573 if (!len) len = dx_abs;
574 for (uint16_t i = 0; i < len; i++) {
582 SET_RTG_PIXEL(&dptr[x << format], fg_color[format], format);
586 if (!len) len = dy_abs;
587 for (uint16_t i = 0; i < len; i++) {
595 SET_RTG_PIXEL(&dptr[x << format], fg_color[format], format);
600 #define DRAW_LINE_PIXEL \
601 if (pattern & cur_bit) { \
602 if (invert) { INVERT_RTG_PIXEL(&dptr[x << format], format) } \
604 if (mask == 0xFF || format != RTGFMT_8BIT) { SET_RTG_PIXEL(&dptr[x << format], fg_color[format], format); } \
605 else { SET_RTG_PIXEL_MASK(&dptr[x << format], fg_color[format], format); } \
608 else if (draw_mode == DRAWMODE_JAM2) { \
609 if (invert) { INVERT_RTG_PIXEL(&dptr[x << format], format) } \
611 if (mask == 0xFF || format != RTGFMT_8BIT) { SET_RTG_PIXEL(&dptr[x << format], bg_color[format], format); } \
612 else { SET_RTG_PIXEL_MASK(&dptr[x << format], bg_color[format], format); } \
615 if ((cur_bit >>= 1) == 0) \
618 void rtg_drawline (int16_t x1_, int16_t y1_, int16_t x2_, int16_t y2_, uint16_t len, uint16_t pattern, uint16_t pattern_offset, uint32_t fgcol, uint32_t bgcol, uint16_t pitch, uint16_t format, uint8_t mask, uint8_t draw_mode) {
619 if (pattern_offset) {}
621 int16_t x1 = x1_, y1 = y1_;
622 int16_t x2 = x1_ + x2_, y2 = y1 + y2_;
623 uint16_t cur_bit = 0x8000;
624 //uint32_t color_mask = 0xFFFF0000;
627 uint32_t fg_color[3] = {
629 htobe16((fgcol & 0xFFFF)),
632 uint32_t bg_color[3] = {
634 htobe16((bgcol & 0xFFFF)),
638 uint8_t *dptr = &rtg_mem[rtg_address_adj[0] + (y1 * pitch)];
640 int32_t line_step = pitch;
643 int16_t dx, dy, dx_abs, dy_abs, ix, iy, x = x1;
657 if (draw_mode & DRAWMODE_INVERSVID)
659 if (draw_mode & DRAWMODE_COMPLEMENT) {
666 if (dx_abs >= dy_abs) {
667 if (!len) len = dx_abs;
668 for (uint16_t i = 0; i < len; i++) {
680 if (!len) len = dy_abs;
681 for (uint16_t i = 0; i < len; i++) {
694 void rtg_p2c (int16_t sx, int16_t sy, int16_t dx, int16_t dy, int16_t w, int16_t h, uint8_t draw_mode, uint8_t planes, uint8_t mask, uint8_t layer_mask, uint16_t src_line_pitch, uint8_t *bmp_data_src) {
695 uint16_t pitch = rtg_x[3];
696 uint8_t *dptr = &rtg_mem[rtg_address_adj[0] + (dy * pitch)];
698 uint8_t cur_bit, base_bit, base_byte;
699 uint16_t cur_byte = 0, u8_fg = 0;
700 //uint32_t color_mask = 0xFFFFFFFF;
702 uint32_t plane_size = src_line_pitch * h;
703 uint8_t *bmp_data = bmp_data_src;
705 cur_bit = base_bit = (0x80 >> (sx % 8));
706 cur_byte = base_byte = ((sx / 8) % src_line_pitch);
708 if (realtime_graphics_debug) {
709 printf("P2C: %d,%d - %d,%d (%dx%d) %d, %.2X\n", sx, sy, dx, dy, w, h, planes, layer_mask);
710 printf("Mask: %.2X Minterm: %.2X\n", mask, draw_mode);
711 printf("Pitch: %d Src Pitch: %d (!!!: %.4X)\n", pitch, src_line_pitch, rtg_user[0]);
712 printf("Curbyte: %d Curbit: %d\n", cur_byte, cur_bit);
713 printf("Plane size: %d Total size: %d (%X)\n", plane_size, plane_size * planes, plane_size * planes);
714 printf("Source: %.8X - %.8X\n", rtg_address[1], rtg_address_adj[1]);
715 printf("Target: %.8X - %.8X\n", rtg_address[0], rtg_address_adj[0]);
718 printf("Grabbing data from RTG memory.\nData:\n");
719 for (int i = 0; i < h; i++) {
720 for (int k = 0; k < planes; k++) {
721 for (int j = 0; j < src_line_pitch; j++) {
722 printf("%.2X", bmp_data_src[j + (i * src_line_pitch) + (plane_size * k)]);
730 for (int16_t line_y = 0; line_y < h; line_y++) {
731 for (int16_t x = dx; x < dx + w; x++) {
733 if (draw_mode & 0x01) {
734 DECODE_INVERTED_PLANAR_PIXEL(u8_fg)
737 DECODE_PLANAR_PIXEL(u8_fg)
740 if (mask == 0xFF && (draw_mode == MINTERM_SRC || draw_mode == MINTERM_NOTSRC)) {
745 HANDLE_MINTERM_PIXEL(u8_fg, dptr[x], rtg_display_format);
748 if ((cur_bit >>= 1) == 0) {
751 cur_byte %= src_line_pitch;
755 if ((line_y + sy + 1) % h)
756 bmp_data += src_line_pitch;
758 bmp_data = bmp_data_src;
760 cur_byte = base_byte;
764 void rtg_p2d (int16_t sx, int16_t sy, int16_t dx, int16_t dy, int16_t w, int16_t h, uint8_t draw_mode, uint8_t planes, uint8_t mask, uint8_t layer_mask, uint16_t src_line_pitch, uint8_t *bmp_data_src) {
765 uint16_t pitch = rtg_x[3];
766 uint8_t *dptr = &rtg_mem[rtg_address_adj[0] + (dy * pitch)];
768 uint8_t cur_bit, base_bit, base_byte;
769 uint16_t cur_byte = 0, u8_fg = 0;
770 //uint32_t color_mask = 0xFFFFFFFF;
772 uint32_t plane_size = src_line_pitch * h;
773 uint8_t *bmp_data = bmp_data_src;
775 cur_bit = base_bit = (0x80 >> (sx % 8));
776 cur_byte = base_byte = ((sx / 8) % src_line_pitch);
778 if (realtime_graphics_debug) {
779 printf("P2D: %d,%d - %d,%d (%dx%d) %d, %.2X\n", sx, sy, dx, dy, w, h, planes, layer_mask);
780 printf("Mask: %.2X Minterm: %.2X\n", mask, draw_mode);
781 printf("Pitch: %d Src Pitch: %d (!!!: %.4X)\n", pitch, src_line_pitch, rtg_user[0]);
782 printf("Curbyte: %d Curbit: %d\n", cur_byte, cur_bit);
783 printf("Plane size: %d Total size: %d (%X)\n", plane_size, plane_size * planes, plane_size * planes);
784 printf("Source: %.8X - %.8X\n", rtg_address[1], rtg_address_adj[1]);
785 printf("Target: %.8X - %.8X\n", rtg_address[0], rtg_address_adj[0]);
788 printf("Grabbing data from RTG memory.\nData:\n");
789 for (int i = 0; i < h; i++) {
790 for (int k = 0; k < planes; k++) {
791 for (int j = 0; j < src_line_pitch; j++) {
792 printf("%.2X", bmp_data_src[j + (i * src_line_pitch) + (plane_size * k)]);
800 uint32_t *clut = (uint32_t *)bmp_data_src;
801 bmp_data += (256 * 4);
802 bmp_data_src += (256 * 4);
804 for (int16_t line_y = 0; line_y < h; line_y++) {
805 for (int16_t x = dx; x < dx + w; x++) {
807 if (draw_mode & 0x01) {
808 DECODE_INVERTED_PLANAR_PIXEL(u8_fg)
811 DECODE_PLANAR_PIXEL(u8_fg)
814 uint32_t fg_color = clut[u8_fg];
816 if (mask == 0xFF && (draw_mode == MINTERM_SRC || draw_mode == MINTERM_NOTSRC)) {
817 switch (rtg_display_format) {
819 ((uint16_t *)dptr)[x] = (fg_color >> 16);
822 ((uint32_t *)dptr)[x] = fg_color;
829 if ((cur_bit >>= 1) == 0) {
832 cur_byte %= src_line_pitch;
836 if ((line_y + sy + 1) % h)
837 bmp_data += src_line_pitch;
839 bmp_data = bmp_data_src;
841 cur_byte = base_byte;