Exemple #1
0
//! [5]
void SvgalibScreen::blit(const QImage &img, const QPoint &topLeft,
                         const QRegion &reg)
{
    if (depth() == 8) {
        switch (img.format()) {
        case QImage::Format_RGB16:
            blit16To8(img, topLeft, reg);
            return;
        case QImage::Format_RGB32:
        case QImage::Format_ARGB32:
        case QImage::Format_ARGB32_Premultiplied:
            blit32To8(img, topLeft, reg);
            return;
        default:
            break;
        }
    }

    if (img.format() != pixelFormat()) {
        if (base())
            QScreen::blit(img, topLeft, reg);
        return;
    }

    const QVector<QRect> rects = (reg & region()).rects();

    for (int i = 0; i < rects.size(); ++i) {
        const QRect r = rects.at(i);
        gl_putboxpart(r.x(), r.y(), r.width(), r.height(),
                      img.width(), img.height(),
                      static_cast<void*>(const_cast<uchar*>(img.bits())),
                      r.x() - topLeft.x(), r.y() - topLeft.y());
    }
}
/* Update the display. */
const char *sysdep_display_update(mame_bitmap *bitmap,
  rectangle *vis_in_dest_out, rectangle *dirty_area,
  struct sysdep_palette_struct *palette, int keyb_leds, int flags)
{
  svga_input_set_keybleds(keyb_leds);
  switch(video_update_type)
  {
    case 0: /* linear */
      blit_func(bitmap, vis_in_dest_out, dirty_area, palette, video_mem,
        video_modeinfo.linewidth/video_modeinfo.bytesperpixel);
      break;
    case 1: /* gl bitmap equals framebuffer */
      /* Note: we calculate the real bitmap->width, as used in
         osd_create_bitmap, this fixes the skewing bug in tempest
         & others */
      sysdep_display_check_bounds(bitmap, vis_in_dest_out, dirty_area, 3);
      gl_putboxpart(
        startx + vis_in_dest_out->min_x,
        starty + vis_in_dest_out->min_y,
        vis_in_dest_out->max_x - vis_in_dest_out->min_x,
        vis_in_dest_out->max_y - vis_in_dest_out->min_y,
        ((unsigned char *)bitmap->line[1] - (unsigned char *)bitmap->line[0]) / 
          video_modeinfo.bytesperpixel,
        bitmap->height, bitmap->line[0], dirty_area->min_x, dirty_area->min_y);
      break;
    case 2: /* gl bitmap needs conversion before it can be blitted */
      blit_func(bitmap, vis_in_dest_out, dirty_area, palette,
        doublebuffer_buffer, scaled_width);
      gl_putboxpart(
        startx + vis_in_dest_out->min_x,
        starty + vis_in_dest_out->min_y,
        vis_in_dest_out->max_x - vis_in_dest_out->min_x,
        vis_in_dest_out->max_y - vis_in_dest_out->min_y,
        scaled_width, scaled_height, doublebuffer_buffer,
        dirty_area->min_x, dirty_area->min_y);
      break;
  }
  return NULL;
}