Ejemplo n.º 1
0
/*
 * Function : Save display canvas into framebuffer
 *
 */
byte QNXGF_post(
  LIBAROMA_FBP me, wordp __restrict src,
  int dx, int dy, int dw, int dh,
  int sx, int sy, int sw, int sh) {
  if (me == NULL) {
    return 0;
  }
  
  libaroma_mutex_lock(___qnxfbmutex);
  QNXGF_INTERNALP mi = (QNXGF_INTERNALP) me->internal;
  wordp copy_src = (wordp) (src + ((sw * sy) + sx));
  
  gf_draw_begin(mi->context);
  gf_draw_image(
    mi->context,
    (const uint8_t *) copy_src,
    GF_FORMAT_PKLE_RGB565,
    sw * 2,
    dx, dy,
    dw, dh,
    0
  );
  
  gf_draw_flush(mi->context);
  gf_draw_end(mi->context);
  libaroma_mutex_unlock(___qnxfbmutex);
  return 1;
}
Ejemplo n.º 2
0
/*!
    \reimp
*/
void QQnxScreen::exposeRegion(QRegion r, int changing)
{
    // here is where the actual magic happens. QWS will call exposeRegion whenever
    // a region on the screen is dirty and needs to be updated on the actual screen.

    // first, call the parent implementation. The parent implementation will update
    // the region on our in-memory surface
    QScreen::exposeRegion(r, changing);

    // now our in-memory surface should be up to date with the latest changes.

    if (!d->hwSurface)
        return;

    // the code below copies the region from the in-memory surface to the hardware.

    // just get the bounding rectangle of the region. Most screen updates are rectangular
    // anyways. Code could be optimized to blit each and every member of the region
    // individually, but in real life, the speed-up is neglectable
    const QRect br = r.boundingRect();
    if (br.isEmpty())
        return; // ignore empty regions because gf_draw_blit2 doesn't like 0x0 dimensions

    // start drawing.
    int ret = gf_draw_begin(d->context);
    if (ret != GF_ERR_OK) {
        qWarning("QQnxScreen: gf_draw_begin() failed with error code %d", ret);
        return;
    }

    // blit the changed region from the memory surface to the hardware surface
    ret = gf_draw_blit2(d->context, d->memSurface, d->hwSurface,
                        br.x(), br.y(), br.right(), br.bottom(), br.x(), br.y());
    if (ret != GF_ERR_OK)
        qWarning("QQnxScreen: gf_draw_blit2() failed with error code %d", ret);

    // flush all drawing commands (in our case, a single blit)
    ret = gf_draw_flush(d->context);
    if (ret != GF_ERR_OK)
        qWarning("QQnxScreen: gf_draw_flush() failed with error code %d", ret);

    // tell QNX that we're done drawing.
    gf_draw_end(d->context);
}