static void video_render_crt_main(video_render_config_t *config,
                                  BYTE *src, BYTE *trg,
                                  int width, int height, int xs, int ys, int xt,
                                  int yt, int pitchs, int pitcht, int depth,
                                  viewport_t *viewport)
{
#ifdef DINGOO_NATIVE
    render_16_1x1_04_dingoo(&config->color_tables, src, trg, width, height, xs, ys, xt, yt, pitchs, pitcht);
#else
    video_render_color_tables_t *colortab;
    int doublescan, delayloop, rendermode, scale2x;

    rendermode = config->rendermode;
    doublescan = config->doublescan;
    colortab = &config->color_tables;
    scale2x = config->scale2x;

    delayloop = (config->filter == VIDEO_FILTER_CRT);

    if ((rendermode == VIDEO_RENDER_CRT_1X1
         || rendermode == VIDEO_RENDER_CRT_1X2
         || rendermode == VIDEO_RENDER_CRT_2X2
         || rendermode == VIDEO_RENDER_CRT_2X4)
        && config->video_resources.pal_scanlineshade <= 0) {
        doublescan = 0;
    }

    switch (rendermode) {
        case VIDEO_RENDER_NULL:
            return;
            break;

        case VIDEO_RENDER_CRT_1X1:
            if (delayloop && depth != 8) {
                switch (depth) {
                    case 16:
                        render_16_1x1_crt(colortab, src, trg, width, height,
                                           xs, ys, xt, yt, pitchs, pitcht);
                        return;
                    case 24:
                        render_24_1x1_crt(colortab, src, trg, width, height,
                                           xs, ys, xt, yt, pitchs, pitcht);
                        return;
                    case 32:
                        render_32_1x1_crt(colortab, src, trg, width, height,
                                           xs, ys, xt, yt, pitchs, pitcht);
                        return;
                }
            } else {
                switch (depth) {
                    case 8:
                        render_08_1x1_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht);
                        return;
                    case 16:
                        render_16_1x1_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht);
                        return;
                    case 24:
                        render_24_1x1_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht);
                        return;
                    case 32:
                        render_32_1x1_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht);
                        return;
                }
            }
            break;
        case VIDEO_RENDER_CRT_1X2:
            if (delayloop && depth != 8) {
                switch (depth) {
                    case 16:
                        render_16_1x2_crt(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht,
                                          viewport, config);
                        return;
                    case 24:
                        render_24_1x2_crt(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht,
                                          viewport, config);
                        return;
                    case 32:
                        render_32_1x2_crt(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht,
                                          viewport, config);
                        return;
                }
            } else {
                switch (depth) {
                    case 8:
                        render_08_1x2_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                    case 16:
                        render_16_1x2_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                    case 24:
                        render_24_1x2_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                    case 32:
                        render_32_1x2_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                }
            }
            break;
        case VIDEO_RENDER_CRT_2X2:
            if (scale2x) {
                switch (depth) {
                    case 8:
                        render_08_scale2x(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht);
                        return;
                    case 16:
                        render_16_scale2x(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht);
                        return;
                    case 24:
                        render_24_scale2x(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht);
                        return;
                    case 32:
                        render_32_scale2x(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht);
                        return;
                }
            } else if (delayloop && depth != 8) {
                switch (depth) {
                    case 16:
                        render_16_2x2_crt(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht, viewport, config);
                        return;
                    case 24:
                        render_24_2x2_crt(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht, viewport, config);
                        return;
                    case 32:
                        render_32_2x2_crt(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht, viewport, config);
                        return;
                }
            } else {
                switch (depth) {
                    case 8:
                        render_08_2x2_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                    case 16:
                        render_16_2x2_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                    case 24:
                        render_24_2x2_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                    case 32:
                        render_32_2x2_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                }
            }
            break;
        case VIDEO_RENDER_CRT_2X4:
            if (delayloop && depth != 8) {
                switch (depth) {
                    case 16:
                        render_16_2x4_crt(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht, viewport, config);
                        return;
                    case 24:
                        render_24_2x4_crt(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht, viewport, config);
                        return;
                    case 32:
                        render_32_2x4_crt(colortab, src, trg, width, height,
                                          xs, ys, xt, yt, pitchs, pitcht, viewport, config);
                        return;
                }
            } else {
                switch (depth) {
                    case 8:
                        render_08_2x4_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                    case 16:
                        render_16_2x4_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                    case 24:
                        render_24_2x4_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                    case 32:
                        render_32_2x4_04(colortab, src, trg, width, height,
                                         xs, ys, xt, yt, pitchs, pitcht, doublescan, config);
                        return;
                }
            }
            break;
    }
    if (rendermode_error != rendermode) {
        log_error(LOG_DEFAULT, "video_render_crt_main: unsupported rendermode (%d)", rendermode);
    }
    rendermode_error = rendermode;
#endif
}
Пример #2
0
static void video_render_pal_main(video_render_config_t *config,
                                  BYTE *src, BYTE *trg,
                                  int width, int height, int xs, int ys, int xt,
                                  int yt, int pitchs, int pitcht, int depth,
                                  viewport_t *viewport)
{
#ifdef DINGOO_NATIVE
    render_16_1x1_04_dingoo(&config->color_tables, src, trg, width, height, xs, ys, xt, yt, pitchs, pitcht);
#else
    video_render_color_tables_t *colortab;
    int doublescan, delayloop, rendermode, scale2x, video;

    video = viewport->crt_type;

    rendermode = config->rendermode;
    doublescan = config->doublescan;
    colortab = &config->color_tables;
    scale2x = config->scale2x;

    delayloop = (config->filter == VIDEO_FILTER_CRT);

    /*
    if (config->external_palette)
        delayloop = 0;
    */

    if ((rendermode == VIDEO_RENDER_PAL_1X1
        || rendermode == VIDEO_RENDER_PAL_2X2)
        && config->video_resources.pal_scanlineshade <= 0)
        doublescan = 0;

    switch (rendermode) {
      case VIDEO_RENDER_NULL:
        break;

      case VIDEO_RENDER_PAL_1X1:
        if (delayloop && depth != 8) {
            if (video) {
                switch (depth) {
                case 16:
                    render_16_1x1_pal(colortab, src, trg, width, height,
                                        xs, ys, xt, yt, pitchs, pitcht, config);
                    return;
                case 24:
                    render_24_1x1_pal(colortab, src, trg, width, height,
                                    xs, ys, xt, yt, pitchs, pitcht, config);
                    return;
                case 32:
                    render_32_1x1_pal(colortab, src, trg, width, height,
                                    xs, ys, xt, yt, pitchs, pitcht, config);
                    return;
                }
            } else {
                switch (depth) {
                case 16:
                    render_16_1x1_ntsc(colortab, src, trg, width, height,
                                        xs, ys, xt, yt, pitchs, pitcht);
                    return;
                case 24:
                    render_24_1x1_ntsc(colortab, src, trg, width, height,
                                    xs, ys, xt, yt, pitchs, pitcht);
                    return;
                case 32:
                    render_32_1x1_ntsc(colortab, src, trg, width, height,
                                    xs, ys, xt, yt, pitchs, pitcht);
                    return;
                }
            }
        } else {
            switch (depth) {
              case 8:
                render_08_1x1_04(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht);
                return;
              case 16:
                render_16_1x1_04(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht);
                return;
              case 24:
                render_24_1x1_04(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht);
                return;
              case 32:
                render_32_1x1_04(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht);
                return;
            }
        }
        return;
      case VIDEO_RENDER_PAL_2X2:
        if (delayloop && depth != 8) {
            switch (video) {
                case 0: /* NTSC */
                    switch (depth) {
                    case 16:
                        render_16_2x2_ntsc(colortab, src, trg, width, height,
                                        xs, ys, xt, yt, pitchs, pitcht,
                                        viewport, config);
                        return;
                    case 24:
                        render_24_2x2_ntsc(colortab, src, trg, width, height,
                                        xs, ys, xt, yt, pitchs, pitcht,
                                        viewport, config);
                        return;
                    case 32:
                        render_32_2x2_ntsc(colortab, src, trg, width, height,
                                        xs, ys, xt, yt, pitchs, pitcht,
                                        viewport, config);
                        return;
                    }
                    break;
                case 1: /* PAL */
                    switch (depth) {
                    case 16:
                        render_16_2x2_pal(colortab, src, trg, width, height,
                                        xs, ys, xt, yt, pitchs, pitcht,
                                        viewport, config);
                        return;
                    case 24:
                        render_24_2x2_pal(colortab, src, trg, width, height,
                                        xs, ys, xt, yt, pitchs, pitcht,
                                        viewport, config);
                        return;
                    case 32:
                        render_32_2x2_pal(colortab, src, trg, width, height,
                                        xs, ys, xt, yt, pitchs, pitcht,
                                        viewport, config);
                        return;
                    }
                    break;
            }
        } else if (scale2x) {
            switch (depth) {
              case 8:
                render_08_scale2x(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht);
                return;
              case 16:
                render_16_scale2x(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht);
                return;
              case 24:
                render_24_scale2x(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht);
                return;
              case 32:
                render_32_scale2x(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht);
                return;
            }
        } else {
            switch (depth) {
              case 8:
                render_08_2x2_04(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht, doublescan);
                return;
              case 16:
                render_16_2x2_04(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht, doublescan);
                return;
              case 24:
                render_24_2x2_04(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht, doublescan);
                return;
              case 32:
                render_32_2x2_04(colortab, src, trg, width, height,
                                 xs, ys, xt, yt, pitchs, pitcht, doublescan);
                return;
            }
        }
    }
    log_debug("video_render_pal_main unsupported rendermode (%d)\n", rendermode);
#endif
}