VirtualBox

Ignore:
Timestamp:
Jul 14, 2017 1:44:02 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116974
Message:

bugref:8863: several DevVGA-SVGA fixes

File:
1 edited

Legend:

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

    r65381 r67972  
    10521052#endif /* LOG_ENABLED */
    10531053
     1054/** Unsigned coordinates in pBox. Clip to [0; pSizeSrc), [0;pSizeDest).
     1055 *
     1056 * @param pSizeSrc  Source surface dimensions.
     1057 * @param pSizeDest Destination surface dimensions.
     1058 * @param pBox      Coordinates to be clipped.
     1059 */
     1060void vmsvgaClipCopyBox(const SVGA3dSize *pSizeSrc,
     1061                       const SVGA3dSize *pSizeDest,
     1062                       SVGA3dCopyBox *pBox)
     1063{
     1064    /* Src x, w */
     1065    if (pBox->srcx > pSizeSrc->width)
     1066        pBox->srcx = pSizeSrc->width;
     1067    if (pBox->w > pSizeSrc->width - pBox->srcx)
     1068        pBox->w = pSizeSrc->width - pBox->srcx;
     1069
     1070    /* Src y, h */
     1071    if (pBox->srcy > pSizeSrc->height)
     1072        pBox->srcy = pSizeSrc->height;
     1073    if (pBox->h > pSizeSrc->height - pBox->srcy)
     1074        pBox->h = pSizeSrc->height - pBox->srcy;
     1075
     1076    /* Src z, d */
     1077    if (pBox->srcz > pSizeSrc->depth)
     1078        pBox->srcz = pSizeSrc->depth;
     1079    if (pBox->d > pSizeSrc->depth - pBox->srcz)
     1080        pBox->d = pSizeSrc->depth - pBox->srcz;
     1081
     1082    /* Dest x, w */
     1083    if (pBox->x > pSizeDest->width)
     1084        pBox->x = pSizeDest->width;
     1085    if (pBox->w > pSizeDest->width - pBox->x)
     1086        pBox->w = pSizeDest->width - pBox->x;
     1087
     1088    /* Dest y, h */
     1089    if (pBox->y > pSizeDest->height)
     1090        pBox->y = pSizeDest->height;
     1091    if (pBox->h > pSizeDest->height - pBox->y)
     1092        pBox->h = pSizeDest->height - pBox->y;
     1093
     1094    /* Dest z, d */
     1095    if (pBox->z > pSizeDest->depth)
     1096        pBox->z = pSizeDest->depth;
     1097    if (pBox->d > pSizeDest->depth - pBox->z)
     1098        pBox->d = pSizeDest->depth - pBox->z;
     1099}
     1100
     1101/** Unsigned coordinates in pBox. Clip to [0; pSize).
     1102 *
     1103 * @param pSize     Source surface dimensions.
     1104 * @param pBox      Coordinates to be clipped.
     1105 */
     1106void vmsvgaClipBox(const SVGA3dSize *pSize,
     1107                   SVGA3dBox *pBox)
     1108{
     1109    /* x, w */
     1110    if (pBox->x > pSize->width)
     1111        pBox->x = pSize->width;
     1112    if (pBox->w > pSize->width - pBox->x)
     1113        pBox->w = pSize->width - pBox->x;
     1114
     1115    /* y, h */
     1116    if (pBox->y > pSize->height)
     1117        pBox->y = pSize->height;
     1118    if (pBox->h > pSize->height - pBox->y)
     1119        pBox->h = pSize->height - pBox->y;
     1120
     1121    /* z, d */
     1122    if (pBox->z > pSize->depth)
     1123        pBox->z = pSize->depth;
     1124    if (pBox->d > pSize->depth - pBox->z)
     1125        pBox->d = pSize->depth - pBox->z;
     1126}
Note: See TracChangeset for help on using the changeset viewer.

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