Changeset 10561 for trunk/src


Ignore:
Timestamp:
Mar 25, 2004, 3:52:32 PM (21 years ago)
Author:
sandervl
Message:

LineTo: special case in toWin32LineEnd when inside a path definition

Location:
trunk/src/gdi32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/line.cpp

    r10374 r10561  
    1 /* $Id: line.cpp,v 1.14 2004-01-11 11:42:18 sandervl Exp $ */
     1/* $Id: line.cpp,v 1.15 2004-03-25 14:52:32 sandervl Exp $ */
    22/*
    33 * Line API's
     
    1515#include "oslibgpi.h"
    1616#include <dcdata.h>
     17#include "region.h"
    1718
    1819#define DBG_LOCALLOG    DBG_line
     
    2324//******************************************************************************
    2425//******************************************************************************
    25 VOID toWin32LineEnd(PPOINTLOS2 startPt,INT nXEnd,INT nYEnd,PPOINTLOS2 pt)
    26 {
     26VOID toWin32LineEnd(pDCData pHps, PPOINTLOS2 startPt,INT nXEnd,INT nYEnd,PPOINTLOS2 pt)
     27{
     28// SvL: This breaks path creation when used as a clip region in a printer DC
     29//      (offset by one for x coordinates make the rectangle not so rectangular anymore)
     30//      Removing it alltogether causes nice drawing errors on the screen, so
     31//      we'll simply ignore it when we're inside a path definition.
     32  if(pHps->inPath)
     33  {
     34      LONG vertRes = hdcHeight(pHps->hwnd, pHps);
     35      LONG horzRes = hdcWidth(pHps->hwnd, pHps);
     36
     37      // LineTo will return an error if the coordinates are outside the DC
     38      pt->x = (nXEnd >= vertRes) ? vertRes-1 : nXEnd;
     39      pt->y = (nYEnd >= horzRes) ? horzRes-1 : nYEnd;
     40  }
     41  else
    2742  if ((startPt->x != nXEnd) || (startPt->y != nYEnd))
    2843  {
     
    113128#endif
    114129
    115     if (OSLibGpiMove(pHps,&newPoint))
     130    if(OSLibGpiMove(pHps,&newPoint))
    116131    {
    117132      //CB: add metafile info
     
    148163
    149164    OSLibGpiQueryCurrentPosition(pHps,&oldPoint);
    150     toWin32LineEnd(&oldPoint,nXEnd,nYEnd,&newPoint);
     165    toWin32LineEnd(pHps, &oldPoint,nXEnd,nYEnd,&newPoint);
    151166
    152167    if ((oldPoint.x == newPoint.x) && (oldPoint.y == newPoint.y))
     
    167182    newPoint.x = nXEnd;
    168183    newPoint.y = nYEnd;
    169     OSLibGpiMove(pHps,&newPoint);
    170   } else
     184    // Do not change the current position when we're defining a path.
     185    // toWin32LineEnd can change the coordinates which would break up the path.
     186    if (!pHps->inPath)
     187        OSLibGpiMove(pHps,&newPoint);
     188  }
     189  else
    171190  {
    172191    SetLastError(ERROR_INVALID_HANDLE);
     
    226245  BOOL rc;
    227246
    228   toWin32LineEnd((PPOINTLOS2)&lppt[cPoints-2],lastPt.x,lastPt.y,(PPOINTLOS2)&points[cPoints-1]);
     247  toWin32LineEnd(pHps, (PPOINTLOS2)&lppt[cPoints-2],lastPt.x,lastPt.y,(PPOINTLOS2)&points[cPoints-1]);
    229248  rc = O32_Polyline(hdc,lppt,cPoints);
    230249  points[cPoints-1] = lastPt;
     
    258277  BOOL rc;
    259278
    260   toWin32LineEnd((PPOINTLOS2)&lppt[cCount-2],lastPt.x,lastPt.y,(PPOINTLOS2)&points[cCount-1]);
     279  toWin32LineEnd(pHps, (PPOINTLOS2)&lppt[cCount-2],lastPt.x,lastPt.y,(PPOINTLOS2)&points[cCount-1]);
    261280  rc = O32_PolylineTo(hdc,lppt,cCount);
    262281  points[cCount-1] = lastPt;
  • trunk/src/gdi32/region.h

    r10374 r10561  
    1 //$Id: region.h,v 1.4 2004-01-11 11:42:22 sandervl Exp $
     1//$Id: region.h,v 1.5 2004-03-25 14:52:32 sandervl Exp $
    22#ifndef __REGION_H__
    33#define __REGION_H__
     
    1313BOOL GdiDestroyRgn(pDCData pHps, HRGN hrgnClip);
    1414
     15
     16LONG hdcHeight(HWND hwnd, pDCData pHps);
     17LONG hdcWidth(HWND hwnd, pDCData pHps);
     18
    1519#endif //__REGION_H__
Note: See TracChangeset for help on using the changeset viewer.