Commit 4cce69c6 authored by abmyii's avatar abmyii
Browse files

Get full rotation (mostly - except for memcpy Bus Error) working

parent 2c87578e
......@@ -20,3 +20,6 @@ Much of the input code was copied from https://github.com/hanzelpeter/dispmanx_v
To run on a 1920x1080 screen in *portrait*:
./mirvncserver -m /run/mir_socket --cap-interval 2 -s 432 768
Rotation code from:
https://github.com/LibVNC/libvncserver/blob/master/examples/rotate.c
......@@ -110,11 +110,10 @@ void read_pixels(int bpp, GLenum format, mir::geometry::Size const& size, void*
matrix.rotate(90);
image = image.transformed(matrix);
std::cout << "Size: " << image.width() << "x" << image.height() << "\n";
}
// Copy image data to FB (https://forum.qt.io/topic/92641/converting-a-qimage-to-a-qbytearray-and-convert-it-back-into-an-image/8)
memcpy(fb, image.bits(), image.byteCount());
memcpy(fb, reinterpret_cast<unsigned char *>(image.bits()), image.byteCount());
#ifdef DEBUG
unsigned int sum = 0;
unsigned int *pui = (unsigned int *) buffer;
......@@ -518,9 +517,9 @@ static void dokey(rfbBool down,rfbKeySym key,rfbClientPtr cl)
// printf("keysym: %04X\n", key);
if (down && key == 0xFF52) // Ctrl+Super+Up
rotate(1, cl);
else if (down && key == 0xFF54) // Ctrl+Super+Down
rotate(-1, cl);
else if (down && key == 0xFF54) // Ctrl+Super+Down
rotate(1, cl);
else
libevdev_uinput_write_event(uidev, EV_KEY, keysym2scancode(key), down);
libevdev_uinput_write_event(uidev, EV_SYN, SYN_REPORT, 0);
......@@ -627,6 +626,7 @@ void do_screencast(EGLSetup const& egl_setup,
printf("RFB: %dx%d\n", rfbScreen->width, rfbScreen->height);
printf("Screen: %dx%d\n", size.width, size.height);
std::swap(rfbScreen->width, rfbScreen->height);
rfbScreen->paddedWidthInBytes = rfbScreen->width * bpp;
printf("RFB: %dx%d\n\n", rfbScreen->width, rfbScreen->height);
{
rfbClientIteratorPtr iterator;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment