Changeset 2049 for trunk/src


Ignore:
Timestamp:
Dec 9, 1999, 5:49:45 PM (26 years ago)
Author:
cbratschi
Message:

fixed TextOut, ExtTextOut bugs

Location:
trunk/src/gdi32
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/gdi32.DEF

    r1710 r2049  
    1 ; $Id: gdi32.DEF,v 1.3 1999-11-12 11:38:38 sandervl Exp $
     1; $Id: gdi32.DEF,v 1.4 1999-12-09 16:49:44 cbratschi Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    66
    77IMPORTS
     8    __GpiQueryDCData@4         = PMGPI.665
    89    _GpiEnableYInversion       = PMGPI.723
    910
     
    340341;    pfnSelectPalette           = _pfnSelectPalette@??        @434
    341342
     343;USER32 functions
     344    InternalDrawTextExA          = _InternalDrawTextExA@24          @1000
     345    InternalDrawTextExW          = _InternalDrawTextExW@24          @1001
     346    InternalTabbedTextOutA       = _InternalTabbedTextOutA@32       @1002
     347    InternalTabbedTextOutW       = _InternalTabbedTextOutW@32       @1003
     348    InternalGetTabbedTextExtentA = _InternalGetTabbedTextExtentA@20 @1004
     349    InternalGetTabbedTextExtentW = _InternalGetTabbedTextExtentW@20 @1005
  • trunk/src/gdi32/gdi32exp.def

    r1533 r2049  
    319319    _UpdateICMRegKeyW@16                      @430
    320320    _WidenPath@4                              @431
     321    _InternalDrawTextExA@24                   @1000
     322    _InternalDrawTextExW@24                   @1001
     323    _InternalTabbedTextOutA@32                @1002
     324    _InternalTabbedTextOutW@32                @1003
     325    _InternalGetTabbedTextExtentA@20          @1004
     326    _InternalGetTabbedTextExtentW@20          @1005
  • trunk/src/gdi32/makefile

    r1961 r2049  
    1 # $Id: makefile,v 1.13 1999-12-03 17:31:51 cbratschi Exp $
     1# $Id: makefile,v 1.14 1999-12-09 16:49:45 cbratschi Exp $
    22
    33#
     
    2222TARGET = gdi32
    2323
    24 OBJS =  gdi32.obj opengl.obj callback.obj dibsect.obj initterm.obj oslibgdi.obj font.obj text.obj palette.obj line.obj
     24OBJS =  gdi32.obj opengl.obj callback.obj dibsect.obj initterm.obj \
     25        oslibgdi.obj font.obj text.obj palette.obj line.obj oslibgpi.obj
    2526
    2627
     
    7475    $(PDWIN32_INCLUDE)\misc.h \
    7576
     77oslibgpi.obj: oslibgpi.cpp oslibgpi.h
     78
    7679initterm.obj: initterm.cpp
    7780
  • trunk/src/gdi32/oslibgdi.cpp

    r1095 r2049  
    1 /* $Id: oslibgdi.cpp,v 1.1 1999-10-01 10:14:59 sandervl Exp $ */
     1/* $Id: oslibgdi.cpp,v 1.2 1999-12-09 16:49:45 cbratschi Exp $ */
    22
    33/*
     
    1111#define  INCL_GPI
    1212#define  INCL_WIN
    13 #include <os2wrap.h>    //Odin32 OS/2 api wrappers
     13#include <os2wrap.h>    //Odin32 OS/2 api wrappers
    1414#include <stdlib.h>
    1515#include <string.h>
     
    2222//******************************************************************************
    2323//******************************************************************************
    24 INT OSLibSetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, DWORD cy, 
    25                            INT xSrc, INT ySrc, UINT startscan, UINT lines, 
    26                            LPCVOID bits, WINBITMAPINFOHEADER *info, 
     24INT OSLibSetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, DWORD cy,
     25                           INT xSrc, INT ySrc, UINT startscan, UINT lines,
     26                           LPCVOID bits, WINBITMAPINFOHEADER *info,
    2727                           UINT coloruse)
    2828{
     
    5656    descr.gc        = physDev->gc;
    5757    descr.xSrc      = xSrc;
    58     descr.ySrc      = tmpheight >= 0 ? lines-(ySrc-startscan)-cy+(oldcy-cy) 
     58    descr.ySrc      = tmpheight >= 0 ? lines-(ySrc-startscan)-cy+(oldcy-cy)
    5959                                     : ySrc - startscan;
    6060    descr.xDest     = dc->w.DCOrgX + XLPTODP( dc, xDest );
     
    7777  GpiDrawBits((HPS)hdc, (VOID *)bits, (BITMAPINFO2 *)info, 4,
    7878              points, ROP_SRCCOPY, BBO_IGNORE);
    79  
     79
    8080  return lines;
    8181}
    8282//******************************************************************************
    8383//******************************************************************************
     84
  • trunk/src/gdi32/oslibgdi.h

    r1095 r2049  
    1 /* $Id: oslibgdi.h,v 1.1 1999-10-01 10:14:59 sandervl Exp $ */
     1/* $Id: oslibgdi.h,v 1.2 1999-12-09 16:49:45 cbratschi Exp $ */
    22
    33/*
     
    1212#define __OSLIBGDI_H__
    1313
    14 INT OSLibSetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, DWORD cy, 
    15                            INT xSrc, INT ySrc, UINT startscan, UINT lines, 
    16                            LPCVOID bits, WINBITMAPINFOHEADER *info, 
     14INT OSLibSetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, DWORD cy,
     15                           INT xSrc, INT ySrc, UINT startscan, UINT lines,
     16                           LPCVOID bits, WINBITMAPINFOHEADER *info,
    1717                           UINT coloruse);
    1818
  • trunk/src/gdi32/text.cpp

    r1961 r2049  
    1 /* $Id: text.cpp,v 1.2 1999-12-03 17:31:51 cbratschi Exp $ */
     1/* $Id: text.cpp,v 1.3 1999-12-09 16:49:45 cbratschi Exp $ */
    22
    33/*
     
    1616#include <misc.h>
    1717#include <string.h>
     18#include "oslibgpi.h"
    1819
    1920//******************************************************************************
     
    6162}
    6263//******************************************************************************
    63 //******************************************************************************
    64 static  BOOL InternalTextOutA(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCSTR lpszString,INT cbCount,CONST INT *lpDx,BOOL IsExtTextOut)
    65 {
    66   if (cbCount < 0 || (lpszString == NULL && cbCount != 0))
     64// CB: USER32 function, but here is the better place
     65//******************************************************************************
     66INT WIN32API InternalDrawTextExA(HDC hdc,LPCSTR lpchText,INT cchText,LPRECT lprc,UINT dwDTFormat,LPDRAWTEXTPARAMS lpDTParams)
     67{
     68  //CB: todo
     69
     70  return 0;
     71}
     72//******************************************************************************
     73//******************************************************************************
     74INT WIN32API InternalDrawTextExW(HDC hdc,LPWSTR lpchText,INT cchText,LPRECT lprc,UINT dwDTFormat,LPDRAWTEXTPARAMS lpDTParams)
     75{
     76  char *astring = UnicodeToAsciiStringN((LPWSTR)lpchText,cchText);
     77  INT  rc;
     78
     79  rc = InternalDrawTextExA(hdc,astring,cchText,lprc,dwDTFormat,lpDTParams);
     80  FreeAsciiString(astring);
     81
     82  return(rc);
     83}
     84//******************************************************************************
     85// CB: USER32 function, but here is the better place
     86//******************************************************************************
     87LONG WIN32API InternalTabbedTextOutA( HDC hdc, int x, int y, LPCSTR lpString, int nCount, int nTabPositions, LPINT lpnTabStopPositions, int  nTabOrigin)
     88{
     89  //CB: todo
     90
     91  return 0;
     92}
     93//******************************************************************************
     94//******************************************************************************
     95LONG WIN32API InternalTabbedTextOutW( HDC hdc, int x, int y, LPCWSTR lpString, int nCount, int nTabPositions, LPINT lpnTabStopPositions, int  nTabOrigin)
     96{
     97  char *astring = UnicodeToAsciiStringN((LPWSTR)lpString,nCount);
     98  LONG rc;
     99
     100  rc = InternalTabbedTextOutA(hdc,x,y,astring,nCount,nTabPositions,lpnTabStopPositions,nTabOrigin);
     101  FreeAsciiString(astring);
     102
     103  return(rc);
     104}
     105//******************************************************************************
     106// CB: USER32 function, but here is the better place
     107//******************************************************************************
     108DWORD WIN32API InternalGetTabbedTextExtentA( HDC hDC, LPCSTR lpString, int nCount, int nTabPositions, LPINT lpnTabStopPositions)
     109{
     110  //CB: todo
     111
     112  return 0;
     113}
     114//******************************************************************************
     115//******************************************************************************
     116DWORD WIN32API InternalGetTabbedTextExtentW( HDC hDC, LPCWSTR lpString, int nCount, int nTabPositions, LPINT lpnTabStopPositions)
     117{
     118  char *astring = UnicodeToAsciiStringN((LPWSTR)lpString,nCount);
     119  DWORD rc;
     120
     121  rc = InternalGetTabbedTextExtentA(hDC,astring,nCount,nTabPositions,lpnTabStopPositions);
     122  FreeAsciiString(astring);
     123
     124  return(rc);
     125}
     126//******************************************************************************
     127// todo: metafile support
     128//******************************************************************************
     129BOOL InternalTextOutA(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCSTR lpszString,INT cbCount,CONST INT *lpDx,BOOL IsExtTextOut)
     130{
     131  PVOID pHps = OSLibGpiQueryDCData(hdc);
     132  ULONG flOptions = 0;
     133  RECTLOS2 pmRect;
     134  POINTLOS2 ptl;
     135  LONG hits;
     136
     137  if (!pHps || cbCount < 0 || (lpszString == NULL && cbCount != 0))
    67138  {
    68139    SetLastError(ERROR_INVALID_HANDLE);
     
    70141  }
    71142
    72   //CB: todo
    73 
    74   if (IsExtTextOut)
    75     return O32_ExtTextOut(hdc,X,Y,fuOptions,lprc,lpszString,cbCount,lpDx);
    76   else
    77     return O32_TextOut(hdc,X,Y,lpszString,cbCount);
    78 }
    79 //******************************************************************************
    80 //******************************************************************************
    81 static  BOOL InternalTextOutW(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCWSTR lpszString,INT cbCount,CONST INT *lpDx,BOOL IsExtTextOut)
    82 {
    83   char *astring = UnicodeToAsciiString((LPWSTR)lpszString);
     143  if (cbCount > 512)
     144  {
     145    SetLastError(ERROR_INVALID_PARAMETER);
     146    return FALSE;
     147  }
     148  if (fuOptions & ~((UINT)(ETO_CLIPPED | ETO_OPAQUE)))
     149  {
     150    //ETO_GLYPH_INDEX, ETO_RTLLEADING, ETO_NUMERICSLOCAL, ETO_NUMERICSLATIN, ETO_IGNORELANGUAGE, ETO_PDY  are ignored
     151    return TRUE;
     152  }
     153
     154  //CB: add metafile info
     155
     156  if (lprc)
     157  {
     158    if (fuOptions)
     159    {
     160      MapWin32ToOS2Rect(*lprc,pmRect);
     161      if (excludeBottomRightPoint(pHps,(PPOINTLOS2)&pmRect) == 0)
     162      {
     163        return TRUE;
     164      }
     165
     166      if (fuOptions & ETO_CLIPPED) flOptions |= CHSOS_CLIP;
     167      if (fuOptions & ETO_OPAQUE)  flOptions |= CHSOS_OPAQUE;
     168    }
     169  } else
     170  {
     171    if (fuOptions)
     172    {
     173      SetLastError(ERROR_INVALID_HANDLE);
     174      return FALSE;
     175    }
     176  }
     177
     178  if (cbCount == 0)
     179  {
     180    if (fuOptions & ETO_OPAQUE)
     181    {
     182      lpszString = " ";
     183      cbCount = 1;
     184      flOptions |= CHSOS_CLIP;
     185    } else return TRUE;
     186  }
     187  if (lpDx)
     188    flOptions |= CHSOS_VECTOR;
     189
     190  if (getAlignUpdateCP(pHps) == FALSE)
     191  {
     192    ptl.x = X;
     193    ptl.y = Y;
     194
     195    flOptions |= CHSOS_LEAVEPOS;
     196  } else OSLibGpiQueryCurrentPosition(pHps,&ptl);
     197
     198  UINT align = GetTextAlign(hdc);
     199  LONG pmHAlign,pmVAlign;
     200
     201  //CB: TA_RIGHT not supported, only TA_CENTER and TA_LEFT
     202  if ((align & 0x6) == TA_RIGHT)
     203  {
     204    PPOINTLOS2 pts = (PPOINTLOS2)malloc((cbCount+1)*sizeof(POINTLOS2));
     205
     206    OSLibGpiQueryCharStringPosAt(pHps,&ptl,flOptions,cbCount,lpszString,lpDx,pts);
     207    ptl.x -= pts[cbCount].x-pts[0].x;
     208    free(pts);
     209  }
     210
     211  if (lprc && (align & 0x18) == TA_BASELINE)
     212  {
     213    //CB: if TA_BASELINE is set, GPI doesn't fill rect
     214    //    TA_BOTTOM fills rect
     215    OSLibGpiQueryTextAlignment(pHps,&pmHAlign,&pmVAlign);
     216    OSLibGpiSetTextAlignment(pHps,pmHAlign,(pmVAlign & ~TAOS_BASE) | TAOS_BOTTOM);
     217  }
     218
     219  ptl.y += getWorldYDeltaFor1Pixel(pHps);
     220
     221  hits = OSLibGpiCharStringPosAt(pHps,&ptl,&pmRect,flOptions,cbCount,lpszString,lpDx);
     222
     223  if (lprc && (align & 0x18) == TA_BASELINE)
     224    OSLibGpiSetTextAlignment(pHps,pmHAlign,pmVAlign);
     225
     226  if (hits == GPIOS_ERROR)
     227  {
     228    return FALSE;
     229  }
     230  if (getAlignUpdateCP(pHps))
     231  {
     232    OSLibGpiQueryCurrentPosition(pHps,&ptl);
     233    ptl.y -= getWorldYDeltaFor1Pixel(pHps);
     234    OSLibGpiSetCurrentPosition(pHps,&ptl);
     235  }
     236
     237  return TRUE;
     238}
     239//******************************************************************************
     240//******************************************************************************
     241BOOL InternalTextOutW(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc,LPCWSTR lpszString,INT cbCount,CONST INT *lpDx,BOOL IsExtTextOut)
     242{
     243  char *astring = UnicodeToAsciiStringN((LPWSTR)lpszString,cbCount);
    84244  BOOL  rc;
    85245
Note: See TracChangeset for help on using the changeset viewer.