void DisplayLinkAdapter::displayImage(const QImage &image) { const dlo_view_t *view = &(mode_info->view); dlo_dot_t dot; dlo_fbuf_t fbuf; OO_NERR(uid); fbuf.width = image.width(); fbuf.height = image.height(); fbuf.stride = fbuf.width; fbuf.fmt = dlo_pixfmt_argb8888; dot.x = 0; if (view->height > fbuf.height) { dlo_rect_t rec; rec.origin.x = 0; rec.origin.y = 0; rec.width = view->width; dot.y = (view->height - fbuf.height) / 2; rec.height = dot.y; OO_ERR(dlo_fill_rect(uid, view, &rec, DLO_RGB(0, 0, 0))); rec.origin.y = fbuf.height + dot.y; rec.height = view->height - rec.origin.y; OO_ERR(dlo_fill_rect(uid, view, &rec, DLO_RGB(0, 0, 0))); } else { dot.y = 0; } fbuf.base = malloc(image.byteCount()); OO_NERR(fbuf.base); memcpy(fbuf.base, image.bits(), image.byteCount()); OO_ERR(dlo_copy_host_bmp(uid, flags, &fbuf, NULL, &dot)); free(fbuf.base); }
goto end; } dlo_mode_t* displayMode = dlo_get_mode(dev); if( 0 ) { //activate to set display to 640x480 dlo_mode_t mode = { .view = {.width = 640, .height = 480, .bpp = displayMode->view.bpp, .base = displayMode->view.base}, .refresh = 0 }; err = dlo_set_mode(dev, &mode); if( err != dlo_ok ) { printf("Failed to set mode: %s\n", dlo_strerror(err)); goto end; } } //fill the screen using native libdlo methods printf("filling full screen red (without view/rect)\n"); err = dlo_fill_rect(dev, 0, 0, DLO_RGB(0xff, 0, 0)); if( err != dlo_ok ) { printf("Failed to fill rect: %s\n", dlo_strerror(err)); goto end; } usleep(500000); printf("filling screen green (native view width %d height %d bpp %d base 0x%08x, no rect)\n", displayMode->view.width, displayMode->view.height, displayMode->view.bpp, displayMode->view.base); err = dlo_fill_rect(dev, &displayMode->view, 0 , DLO_RGB(0, 0xff, 0)); if( err != dlo_ok ) { printf("Failed to fill rect: %s\n", dlo_strerror(err)); goto end; } usleep(500000); dlo_rect_t rect = { .origin = { .x = 0, .y = 0 }, .width = 640, .height = 480 };