Commit debc7e7d authored by Sebastian Bauer's avatar Sebastian Bauer Committed by David Gibson
Browse files

sm501: Implement negated destination raster operation mode



Add support for the negated destination operation mode. This is used e.g.
by AmigaOS for the INVERSEVID drawing mode. With this change, the cursor
in the shell and non-immediate window adjustment are working now.

Signed-off-by: default avatarBALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent 54b2a433
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -705,6 +705,8 @@ static void sm501_2d_operation(SM501State *s)
    uint32_t color = s->twoD_foreground;
    int format_flags = (s->twoD_stretch >> 20) & 0x3;
    int addressing = (s->twoD_stretch >> 16) & 0xF;
    int rop_mode = (s->twoD_control >> 15) & 0x1; /* 1 for rop2, else rop3 */
    int rop = s->twoD_control & 0xFF;

    /* get frame buffer info */
    uint8_t *src = s->local_mem + (s->twoD_source_base & 0x03FFFFFF);
@@ -729,6 +731,8 @@ static void sm501_2d_operation(SM501State *s)
        int y, x, index_d, index_s;                                           \
        for (y = 0; y < operation_height; y++) {                              \
            for (x = 0; x < operation_width; x++) {                           \
                _pixel_type val;                                              \
                                                                              \
                if (rtl) {                                                    \
                    index_s = ((src_y - y) * src_width + src_x - x) * _bpp;   \
                    index_d = ((dst_y - y) * dst_width + dst_x - x) * _bpp;   \
@@ -736,7 +740,13 @@ static void sm501_2d_operation(SM501State *s)
                    index_s = ((src_y + y) * src_width + src_x + x) * _bpp;   \
                    index_d = ((dst_y + y) * dst_width + dst_x + x) * _bpp;   \
                }                                                             \
                *(_pixel_type *)&dst[index_d] = *(_pixel_type *)&src[index_s];\
                if (rop_mode == 1 && rop == 5) {                              \
                    /* Invert dest */                                         \
                    val = ~*(_pixel_type *)&dst[index_d];                     \
                } else {                                                      \
                    val = *(_pixel_type *)&src[index_s];                      \
                }                                                             \
                *(_pixel_type *)&dst[index_d] = val;                          \
            }                                                                 \
        }                                                                     \
    }