VirtualBox

Changeset 98693 in vbox


Ignore:
Timestamp:
Feb 22, 2023 5:33:07 PM (22 months ago)
Author:
vboxsync
Message:

Devices/Graphics: Copying with correct offset for destination rectangle, bugref:10341

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp

    r98103 r98693  
    11471147
    11481148        uint32_t const cbDst = pScreen->cHeight * pScreen->cbPitch;
     1149        uint32_t cbScreenPixel = RT_ALIGN(pScreen->cBpp, 8) / 8;
    11491150        uint8_t *pu8Dst;
    11501151        if (pScreen->pvScreenBitmap)
     
    11861187                + ((box.y + pSurface->cyBlock - 1) / pSurface->cyBlock) * pSurface->cyBlock * srcMap.cbRowPitch;
    11871188
    1188             /* The 'box' is actually in the destination coordinates relative to the top-left corner of destRect.
    1189              * Therefore it is relative to the top-left corner of srcRect as well.
     1189            /* The 'box' is in coordinates relative to the top-left dstRect or srcRect corner.
     1190             * The 'dstBoxAbs' and 'srcBoxAbs' are absolute coordinates of 'box' within screen object or texture face (respectively).
    11901191             */
    1191             box.x += srcBox.x;
    1192             box.y += srcBox.y;
     1192            SVGA3dBox srcBoxAbs = box, dstBoxAbs = box;
     1193
     1194            srcBoxAbs.x += srcBox.x;
     1195            srcBoxAbs.y += srcBox.y;
     1196
     1197            dstBoxAbs.x += dstBox.x;
     1198            dstBoxAbs.y += dstBox.y;
     1199
     1200            uint32_t offDst = pScreen->cbPitch * dstBoxAbs.y + cbScreenPixel * dstBoxAbs.x;
    11931201
    11941202            VMSGA3D_BOX_DIMENSIONS srcDims;
    1195             rc = vmsvga3dGetBoxDimensions(pThisCC, &srcImage, &box, &srcDims);
     1203            rc = vmsvga3dGetBoxDimensions(pThisCC, &srcImage, &srcBoxAbs, &srcDims);
    11961204            if (RT_SUCCESS(rc))
    11971205            {
    11981206                AssertContinue(srcDims.cyBlocks > 0);
    11991207
    1200                 ASSERT_GUEST_BREAK(   srcDims.offBox <= cbDst
    1201                                    && pScreen->cbPitch * (srcDims.cyBlocks - 1) + srcDims.cbRow <= cbDst - srcDims.offBox);
     1208                ASSERT_GUEST_BREAK(   offDst <= cbDst
     1209                                   && pScreen->cbPitch * (srcDims.cyBlocks - 1) + srcDims.cbRow <= cbDst - offDst);
    12021210                RT_UNTRUSTED_VALIDATED_FENCE();
    12031211
    1204                 uint8_t *pu8DstBox = pu8Dst + srcDims.offBox;
     1212                uint8_t *pu8DstBox = pu8Dst + offDst;
    12051213
    12061214                if (   pSurface->format == SVGA3D_R8G8B8A8_UNORM
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette