Changeset 59914 in vbox for trunk/src/VBox/Additions/linux/drm
- Timestamp:
- Mar 3, 2016 8:22:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_mode.c
r59697 r59914 617 617 * if the corresponding alpha value in the ARGB image is greater than 0xF0. */ 618 618 static void copy_cursor_image(u8 *src, u8 *dst, int width, int height, 619 size_t cbMask)619 size_t mask_size) 620 620 { 621 621 unsigned i, j; 622 size_t cbLine = (width + 7) / 8;623 624 memcpy(dst + cbMask, src, width * height * 4);622 size_t line_size = (width + 7) / 8; 623 624 memcpy(dst + mask_size, src, width * height * 4); 625 625 for (i = 0; i < height; ++i) 626 626 for (j = 0; j < width; ++j) 627 627 if (((uint32_t *)src)[i * width + j] > 0xf0000000) 628 dst[i * cbLine + j / 8] |= (0x80 >> (j % 8));628 dst[i * line_size + j / 8] |= (0x80 >> (j % 8)); 629 629 } 630 630 … … 641 641 u8 *src; 642 642 u8 *dst = NULL; 643 size_t cbData, cbMask; 643 u32 caps = 0; 644 size_t data_size, mask_size; 644 645 bool src_isiomem; 645 646 … … 651 652 if ( width > VBOX_MAX_CURSOR_WIDTH || height > VBOX_MAX_CURSOR_HEIGHT 652 653 || width == 0 || hot_x > width || height == 0 || hot_y > height) 654 return -EINVAL; 655 rc = VBoxQueryConfHGSMI(&vbox->submit_info, 656 VBOX_VBVA_CONF32_CURSOR_CAPABILITIES, &caps); 657 ret = -RTErrConvertToErrno(rc); 658 if (ret) 659 return ret; 660 if ( caps & VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER 661 || !(caps & VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE)) 653 662 return -EINVAL; 654 663 … … 662 671 /* The mask must be calculated based on the alpha channel, one bit 663 672 * per ARGB word, and must be 32-bit padded. */ 664 cbMask= ((width + 7) / 8 * height + 3) & ~3;665 cbData = width * height * 4 + cbMask;666 dst = kmalloc( cbData, GFP_KERNEL);673 mask_size = ((width + 7) / 8 * height + 3) & ~3; 674 data_size = width * height * 4 + mask_size; 675 dst = kmalloc(data_size, GFP_KERNEL); 667 676 if (dst) 668 677 { … … 676 685 | VBOX_MOUSE_POINTER_SHAPE 677 686 | VBOX_MOUSE_POINTER_ALPHA; 678 copy_cursor_image(src, dst, width, height, cbMask);687 copy_cursor_image(src, dst, width, height, mask_size); 679 688 rc = VBoxHGSMIUpdatePointerShape(&vbox->submit_info, flags, 680 689 hot_x, hot_y, width, 681 height, dst, cbData);682 ret = RTErrConvertToErrno(rc);690 height, dst, data_size); 691 ret = -RTErrConvertToErrno(rc); 683 692 } 684 693 else
Note:
See TracChangeset
for help on using the changeset viewer.