Changeset 1078 for trunk/src


Ignore:
Timestamp:
Sep 28, 1999, 2:44:33 PM (26 years ago)
Author:
dengert
Message:

ScrollDC implemented

Location:
trunk/src/user32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/dc.cpp

    r1077 r1078  
    1 /* $Id: dc.cpp,v 1.9 1999-09-28 08:00:56 dengert Exp $ */
     1/* $Id: dc.cpp,v 1.10 1999-09-28 12:44:32 dengert Exp $ */
    22
    33/*
     
    153153#define MM_ANISOTROPIC_W      8
    154154
     155#define RGN_OR_W              2
     156
    155157/*********************/
    156158
     
    167169int     OPEN32API _O32_ReleaseDC (HWND hwnd, HDC hdc);
    168170VOID    OPEN32API _O32_SetLastError( DWORD );
     171BOOL    OPEN32API _O32_SetRectRgn (HRGN dest, int left, int top, int right, int bottom);
     172int     OPEN32API _O32_CombineRgn (HRGN dest, HRGN src1, HRGN src2, int mode);
     173HRGN    OPEN32API _O32_CreateRectRgn (int left, int top, int right, int bottom);
    169174
    170175#ifndef DEVESC_SETPS
     
    472477}
    473478
     479INT revertDy (Win32BaseWindow *wnd, INT dy)
     480{
     481   if (wnd->isOwnDC())
     482   {
     483      pDCData pHps = (pDCData)GpiQueryDCData (wnd->getOwnDC());
     484
     485      if (pHps != NULLHANDLE)
     486         if (!isYup (pHps))
     487            dy = -dy;
     488   }
     489   else
     490   {
     491      dy = -dy;
     492   }
     493   return (dy);
     494}
     495
    474496VOID removeClientArea(pDCData pHps)
    475497{
     
    11911213   return (result);
    11921214}
     1215
     1216BOOL WIN32API ScrollDC (HDC hDC, int dx, int dy, const RECT *pScroll,
     1217                        const RECT *pClip, HRGN hrgnUpdate, LPRECT pRectUpdate)
     1218{
     1219   USHORT sel = RestoreOS2FS();
     1220   BOOL rc = TRUE;
     1221
     1222   dprintf (("USER32:  ScrollDC"));
     1223
     1224   if (!hDC)
     1225   {
     1226      SetFS(sel);
     1227      return (FALSE);
     1228   }
     1229
     1230   pDCData pHps         = (pDCData)GpiQueryDCData ((HPS)hDC);
     1231   HWND    hwnd         = pHps->hwnd;
     1232   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
     1233
     1234   if ((hwnd == NULLHANDLE) || !wnd)
     1235   {
     1236      SetFS(sel);
     1237      return (FALSE);
     1238   }
     1239
     1240   POINTL ptl[2] = { 0, 0, dx, dy };
     1241
     1242   GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, ptl);
     1243   dx = (int)(ptl[1].x - ptl[0].x);
     1244   dy = (int)(ptl[1].y - ptl[0].y);
     1245
     1246   RECTL scrollRect;
     1247   RECTL clipRect;
     1248
     1249   if (pClip)
     1250   {
     1251      clipRect.xLeft   = min (pClip->left, pClip->right);
     1252      clipRect.xRight  = max (pClip->left, pClip->right);
     1253      clipRect.yTop    = max (pClip->top,  pClip->bottom);
     1254      clipRect.yBottom = min (pClip->top,  pClip->bottom);
     1255
     1256      if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
     1257          (clipRect.xLeft   != clipRect.xRight)   &&
     1258          (clipRect.yBottom != clipRect.yTop))
     1259      {
     1260          if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
     1261              clipRect.xRight -= abs(pHps->worldXDeltaFor1Pixel);
     1262          else
     1263              clipRect.xLeft  += abs(pHps->worldXDeltaFor1Pixel);
     1264
     1265          if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
     1266              clipRect.yTop    -= abs(pHps->worldYDeltaFor1Pixel);
     1267          else
     1268              clipRect.yBottom += abs(pHps->worldYDeltaFor1Pixel);
     1269      }
     1270      GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&clipRect);
     1271      if (clipRect.xRight < clipRect.xLeft) {
     1272         ULONG temp      = clipRect.xLeft;
     1273         clipRect.xLeft  = clipRect.xRight;
     1274         clipRect.xRight = temp;
     1275      }
     1276      if (clipRect.yTop < clipRect.yBottom) {
     1277         ULONG temp       = clipRect.yBottom;
     1278         clipRect.yBottom = clipRect.yTop;
     1279         clipRect.yTop    = temp;
     1280      }
     1281   }
     1282
     1283   if (pScroll)
     1284   {
     1285      scrollRect.xLeft   = min (pScroll->left, pScroll->right);
     1286      scrollRect.xRight  = max (pScroll->left, pScroll->right);
     1287      scrollRect.yTop    = max (pScroll->top,  pScroll->bottom);
     1288      scrollRect.yBottom = min (pScroll->top,  pScroll->bottom);
     1289
     1290      if ((pHps->graphicsMode == GM_COMPATIBLE_W) &&
     1291          (scrollRect.xLeft   != scrollRect.xRight)   &&
     1292          (scrollRect.yBottom != scrollRect.yTop))
     1293      {
     1294          if (abs((int)pHps->viewportXExt) <= abs((int)pHps->windowExt.cx))
     1295              scrollRect.xRight -= abs(pHps->worldXDeltaFor1Pixel);
     1296          else
     1297              scrollRect.xLeft  += abs(pHps->worldXDeltaFor1Pixel);
     1298
     1299          if (abs((int)pHps->viewportYExt) <= abs((int)pHps->windowExt.cy))
     1300              scrollRect.yTop    -= abs(pHps->worldYDeltaFor1Pixel);
     1301          else
     1302              scrollRect.yBottom += abs(pHps->worldYDeltaFor1Pixel);
     1303      }
     1304      GpiConvert (pHps->hps, CVTC_WORLD, CVTC_DEVICE, 2, (PPOINTL)&scrollRect);
     1305      if (scrollRect.xRight < scrollRect.xLeft) {
     1306         ULONG temp        = scrollRect.xLeft;
     1307         scrollRect.xLeft  = scrollRect.xRight;
     1308         scrollRect.xRight = temp;
     1309      }
     1310      if (scrollRect.yTop < scrollRect.yBottom) {
     1311         ULONG temp         = scrollRect.yBottom;
     1312         scrollRect.yBottom = scrollRect.yTop;
     1313         scrollRect.yTop    = temp;
     1314      }
     1315   }
     1316   RECTL rectlUpdate;
     1317   HRGN  hrgn;
     1318
     1319   LONG lComplexity = WinScrollWindow (hwnd, dx, dy, (pScroll) ? &scrollRect : NULL, (pClip) ? &clipRect : NULL, hrgn, &rectlUpdate, 0);
     1320   if (lComplexity == RGN_ERROR)
     1321   {
     1322      SetFS(sel);
     1323      return (FALSE);
     1324   }
     1325
     1326   RECT winRectUpdate;
     1327   LONG height = wnd->getWindowHeight();
     1328
     1329   winRectUpdate.left   = rectlUpdate.xLeft;
     1330   winRectUpdate.right  = rectlUpdate.xRight;
     1331   winRectUpdate.top    = height - rectlUpdate.yTop;
     1332   winRectUpdate.bottom = height - rectlUpdate.yBottom;
     1333
     1334   if (pRectUpdate)
     1335      *pRectUpdate = winRectUpdate;
     1336
     1337   if (hrgnUpdate)
     1338   {
     1339      RGNRECT  rgnRect;
     1340      rgnRect.ircStart    = 1;
     1341      rgnRect.crc         = 0;
     1342      rgnRect.ulDirection = RECTDIR_LFRT_TOPBOT;     // doesn't make a difference because we're getting them all
     1343      rc = GpiQueryRegionRects (pHps->hps, hrgn, NULL, &rgnRect, NULL);
     1344
     1345      if (rc && (rgnRect.crcReturned > 0))
     1346      {
     1347         PRECTL pRectl = new RECTL[rgnRect.crcReturned];
     1348         if (pRectl != NULL)
     1349         {
     1350            rgnRect.crc = rgnRect.crcReturned;
     1351            rc = GpiQueryRegionRects (pHps->hps, hrgn, NULL, &rgnRect, pRectl);
     1352
     1353            rc = _O32_SetRectRgn (hrgnUpdate, pRectl[0].xLeft,
     1354                                              pRectl[0].xRight,
     1355                                              height - pRectl[0].yTop,
     1356                                              height - pRectl[0].yBottom);
     1357
     1358            if (rgnRect.crcReturned > 1)
     1359            {
     1360               HRGN temp;
     1361               temp = _O32_CreateRectRgn (0, 0, 1, 1);
     1362
     1363               for (int x = 1; rc && (x < rgnRect.crcReturned); x++)
     1364               {
     1365                 rc = _O32_SetRectRgn (temp, pRectl[x].xLeft,
     1366                                             pRectl[x].xRight,
     1367                                             height - pRectl[x].yTop,
     1368                                             height - pRectl[x].yBottom);
     1369                 rc = _O32_CombineRgn (hrgnUpdate, hrgnUpdate, temp, RGN_OR_W);
     1370               }
     1371               _O32_DeleteObject (temp);
     1372            }
     1373            delete[] pRectl;
     1374         }
     1375         else
     1376         {
     1377            rc = FALSE;
     1378         }
     1379      }
     1380      else
     1381      {
     1382         rc = _O32_SetRectRgn (hrgnUpdate, 0, 0, 0, 0);
     1383      }
     1384   }
     1385
     1386   SetFS(sel);
     1387   return (rc);
     1388}
     1389
    11931390//******************************************************************************
    11941391//******************************************************************************
     
    12451442    }
    12461443
    1247     dy = -dy; //always correct?
     1444    dy = revertDy (window, dy);
    12481445
    12491446    rc = WinScrollWindow(window->getOS2WindowHandle(), dx, dy,
  • trunk/src/user32/user32.cpp

    r1077 r1078  
    1 /* $Id: user32.cpp,v 1.34 1999-09-28 08:00:56 dengert Exp $ */
     1/* $Id: user32.cpp,v 1.35 1999-09-28 12:44:33 dengert Exp $ */
    22
    33/*
     
    12691269//******************************************************************************
    12701270//******************************************************************************
     1271#if 0
    12711272BOOL WIN32API ScrollDC( HDC arg1, int arg2, int arg3, const RECT * arg4, const RECT * arg5, HRGN arg6, PRECT  arg7)
    12721273{
     
    12761277    return O32_ScrollDC(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
    12771278}
     1279#endif
    12781280//******************************************************************************
    12791281//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.