/* this is called from dpy_update() each time a hardware framebuffer * rectangular update was detected. Send this to the QFrameBuffer. */ static void android_display_update(DisplayChangeListener* dcl, int x, int y, int w, int h) { if (QFrameBuffer* qfbuff = asDcl(dcl)->fb) { qframebuffer_update(qfbuff, x, y, w, h); } }
/* * Updates a display rectangle. * Param * fb - Framebuffer where to update the rectangle. * x, y, w, and h define rectangle to update. * bits_per_pixel define number of bits used to encode a single pixel. * pixels contains pixels for the rectangle. Buffer addressed by this parameter * must be eventually freed with free() */ static void update_rect(QFrameBuffer* fb, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t bits_per_pixel, uint8_t* pixels) { if (fb != NULL) { uint16_t n; const uint8_t* src = pixels; const uint16_t src_line_size = w * ((bits_per_pixel + 7) / 8); uint8_t* dst = (uint8_t*)fb->pixels + y * fb->pitch + x * fb->bytes_per_pixel; for (n = 0; n < h; n++) { memcpy(dst, src, src_line_size); src += src_line_size; dst += fb->pitch; } qframebuffer_update(fb, x, y, w, h); } free(pixels); }