Changeset 82021 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 20, 2019 11:38:54 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134824
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r81964 r82021 1656 1656 void UISession::updateMousePointerShape() 1657 1657 { 1658 /* Fetch incoming shape data: */ 1658 1659 const bool fHasAlpha = m_shapeData.hasAlpha(); 1659 1660 uint uXHot = m_shapeData.hotPoint().x(); 1660 1661 uint uYHot = m_shapeData.hotPoint().y(); 1661 uint uWidth = m_shapeData.shapeSize().width();1662 uint uHeight = m_shapeData.shapeSize().height();1662 const uint uWidth = m_shapeData.shapeSize().width(); 1663 const uint uHeight = m_shapeData.shapeSize().height(); 1663 1664 const uchar *pShapeData = m_shapeData.shape().constData(); 1664 AssertMsg(pShapeData, ("Shape data must not be NULL!\n")); 1665 1665 AssertMsgReturnVoid(pShapeData, ("Shape data must not be NULL!\n")); 1666 1667 /* Invalidate mouse pointer shape initially: */ 1666 1668 m_fIsValidPointerShapePresent = false; 1667 const uchar *srcAndMaskPtr = pShapeData; 1668 uint andMaskSize = (uWidth + 7) / 8 * uHeight; 1669 const uchar *srcShapePtr = pShapeData + ((andMaskSize + 3) & ~3); 1670 uint srcShapePtrScan = uWidth * 4; 1669 1670 /* Parse incoming shape data: */ 1671 const uchar *pSrcAndMaskPtr = pShapeData; 1672 const uint uAndMaskSize = (uWidth + 7) / 8 * uHeight; 1673 const uchar *pSrcShapePtr = pShapeData + ((uAndMaskSize + 3) & ~3); 1671 1674 1672 1675 /* Remember initial cursor hotspot: */ … … 1675 1678 #if defined (VBOX_WS_WIN) 1676 1679 1677 /* Create a ARGB image out of the shape data: */ 1678 1679 /* 1680 * Qt5 QCursor recommends 32 x 32 cursor, therefore the original data is copied to 1681 * a larger QImage if necessary. Cursors like 10x16 did not work correctly (Solaris 10 guest). 1682 */ 1683 uint uCursorWidth = uWidth >= 32? uWidth: 32; 1684 uint uCursorHeight = uHeight >= 32? uHeight: 32; 1685 uint x, y; 1680 /* Create an ARGB image out of the shape data: */ 1681 1682 // WORKAROUND: 1683 // Qt5 QCursor recommends 32 x 32 cursor, therefore the original data is copied to 1684 // a larger QImage if necessary. Cursors like 10x16 did not work correctly (Solaris 10 guest). 1685 const uint uCursorWidth = uWidth >= 32 ? uWidth : 32; 1686 const uint uCursorHeight = uHeight >= 32 ? uHeight : 32; 1686 1687 1687 1688 if (fHasAlpha) … … 1690 1691 memset(image.bits(), 0, image.byteCount()); 1691 1692 1692 const uint32_t *pu32SrcShapeScanline = (uint32_t *) srcShapePtr;1693 for ( y = 0; y < uHeight; ++y, pu32SrcShapeScanline += uWidth)1693 const uint32_t *pu32SrcShapeScanline = (uint32_t *)pSrcShapePtr; 1694 for (uint y = 0; y < uHeight; ++y, pu32SrcShapeScanline += uWidth) 1694 1695 memcpy(image.scanLine(y), pu32SrcShapeScanline, uWidth * sizeof(uint32_t)); 1695 1696 … … 1700 1701 else 1701 1702 { 1702 if (isPointer1bpp( srcShapePtr, uWidth, uHeight))1703 if (isPointer1bpp(pSrcShapePtr, uWidth, uHeight)) 1703 1704 { 1704 1705 /* Incoming data consist of 32 bit BGR XOR mask and 1 bit AND mask. … … 1734 1735 memset(mask.bits(), 0xFF, mask.byteCount()); 1735 1736 1736 const uint8_t *pu8SrcAndScanline = srcAndMaskPtr;1737 const uint32_t *pu32SrcShapeScanline = (uint32_t *) srcShapePtr;1738 for ( y = 0; y < uHeight; ++y)1737 const uint8_t *pu8SrcAndScanline = pSrcAndMaskPtr; 1738 const uint32_t *pu32SrcShapeScanline = (uint32_t *)pSrcShapePtr; 1739 for (uint y = 0; y < uHeight; ++y) 1739 1740 { 1740 for ( x = 0; x < uWidth; ++x)1741 for (uint x = 0; x < uWidth; ++x) 1741 1742 { 1742 1743 const uint8_t u8Bit = (uint8_t)(1 << (7 - x % 8)); … … 1795 1796 memset(image.bits(), 0, image.byteCount()); 1796 1797 1797 const uint8_t *pu8SrcAndScanline = srcAndMaskPtr;1798 const uint32_t *pu32SrcShapeScanline = (uint32_t *) srcShapePtr;1799 1800 for ( y = 0; y < uHeight; ++y)1798 const uint8_t *pu8SrcAndScanline = pSrcAndMaskPtr; 1799 const uint32_t *pu32SrcShapeScanline = (uint32_t *)pSrcShapePtr; 1800 1801 for (uint y = 0; y < uHeight; ++y) 1801 1802 { 1802 1803 uint32_t *pu32DstPixel = (uint32_t *)image.scanLine(y); 1803 1804 1804 for ( x = 0; x < uWidth; ++x)1805 for (uint x = 0; x < uWidth; ++x) 1805 1806 { 1806 1807 const uint8_t u8Bit = (uint8_t)(1 << (7 - x % 8)); … … 1824 1825 1825 1826 m_fIsValidPointerShapePresent = true; 1826 NOREF(srcShapePtrScan);1827 1827 1828 1828 #elif defined(VBOX_WS_X11) || defined(VBOX_WS_MAC) 1829 1829 1830 /* Create a ARGB image out of the shape data: */1830 /* Create an ARGB image out of the shape data: */ 1831 1831 QImage image(uWidth, uHeight, QImage::Format_ARGB32); 1832 1832 1833 1833 if (fHasAlpha) 1834 1834 { 1835 memcpy(image.bits(), srcShapePtr, uHeight * uWidth * 4);1835 memcpy(image.bits(), pSrcShapePtr, uHeight * uWidth * 4); 1836 1836 } 1837 1837 else 1838 1838 { 1839 renderCursorPixels((uint32_t *) srcShapePtr, srcAndMaskPtr,1839 renderCursorPixels((uint32_t *)pSrcShapePtr, pSrcAndMaskPtr, 1840 1840 uWidth, uHeight, 1841 1841 (uint32_t *)image.bits(), uHeight * uWidth * 4); … … 1847 1847 m_cursor = QCursor(m_cursorPixmap, uXHot, uYHot); 1848 1848 m_fIsValidPointerShapePresent = true; 1849 NOREF(srcShapePtrScan);1850 1849 1851 1850 #else
Note:
See TracChangeset
for help on using the changeset viewer.