Changeset 4533 for trunk/src


Ignore:
Timestamp:
Oct 26, 2000, 7:20:29 PM (25 years ago)
Author:
sandervl
Message:

GetObjectA/W fixes

Location:
trunk/src/gdi32
Files:
3 edited

Legend:

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

    r4356 r4533  
    1 /* $Id: blit.cpp,v 1.19 2000-10-01 21:21:15 phaller Exp $ */
     1/* $Id: blit.cpp,v 1.20 2000-10-26 17:20:28 sandervl Exp $ */
    22
    33/*
     
    8585    }
    8686  }
    87   dprintf(("GDI32: BitBlt to hdc %X from (%d,%d) to (%d,%d), (%d,%d) rop %X\n",
    88            hdcDest, nXSrc, nYSrc, nXDest, nYDest, nWidth, nHeight, dwRop));
     87  dprintf(("GDI32: BitBlt to hdc %X from hdc %x (%d,%d) to (%d,%d), (%d,%d) rop %X\n",
     88           hdcDest, hdcSrc, nXSrc, nYSrc, nXDest, nYDest, nWidth, nHeight, dwRop));
    8989  return O32_BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
    9090}
     
    100100    ULONG compression = 0, iHeight, bmpsize;
    101101    WORD *newbits = 0;
     102
     103    dprintf(("GDI32: SetDIBitsToDevice hdc:%X xDest:%d yDest:%d, cx:%d, cy:%d, xSrc:%d, ySrc:%d, startscan:%d, lines:%d \nGDI32: bits 0x%X, info 0x%X, coloruse %d",
     104              hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (LPVOID) bits, (PBITMAPINFO)info, coloruse));
    102105
    103106    SetLastError(ERROR_SUCCESS);
  • trunk/src/gdi32/gdi32.cpp

    r4492 r4533  
    1 /* $Id: gdi32.cpp,v 1.56 2000-10-16 22:26:53 sandervl Exp $ */
     1/* $Id: gdi32.cpp,v 1.57 2000-10-26 17:20:29 sandervl Exp $ */
    22
    33/*
     
    882882//******************************************************************************
    883883//******************************************************************************
    884 int WIN32API GetTextFaceA( HDC arg1, int arg2, LPSTR  arg3)
    885 {
    886     dprintf(("GDI32: GetTextFaceA"));
    887     return O32_GetTextFace(arg1, arg2, arg3);
     884int WIN32API GetTextFaceA( HDC hdc, int arg2, LPSTR  arg3)
     885{
     886    dprintf(("GDI32: GetTextFaceA %x %d %x", hdc, arg2, arg3));
     887    return O32_GetTextFace(hdc, arg2, arg3);
    888888}
    889889//******************************************************************************
     
    895895
    896896    dprintf(("GDI32: GetTextFaceW"));
    897     rc = O32_GetTextFace(arg1, arg2, astring);
     897    rc = GetTextFaceA(arg1, arg2, astring);
    898898    AsciiToUnicode(astring, arg3);
    899899    free(astring);
     
    902902//******************************************************************************
    903903//******************************************************************************
    904 BOOL WIN32API GetTextMetricsA( HDC arg1, LPTEXTMETRICA  arg2)
     904BOOL WIN32API GetTextMetricsA( HDC hdc, LPTEXTMETRICA  arg2)
    905905{
    906906 BOOL rc;
    907907
    908     rc = O32_GetTextMetrics(arg1, arg2);
    909     dprintf(("GDI32: GetTextMetricsA returned %d\n", rc));
     908    rc = O32_GetTextMetrics(hdc, arg2);
     909    dprintf(("GDI32: GetTextMetricsA %x %x returned %d", hdc, arg2, rc));
    910910    return(rc);
    911911}
  • trunk/src/gdi32/objhandle.cpp

    r4223 r4533  
    1 /* $Id: objhandle.cpp,v 1.4 2000-09-08 18:06:32 sandervl Exp $ */
     1/* $Id: objhandle.cpp,v 1.5 2000-10-26 17:20:29 sandervl Exp $ */
    22/*
    33 * Win32 Handle Management Code for OS/2
     
    88 *
    99 * TODO: The table should be dynamically increased when necessary
    10  *       This is just a quick and dirty implementation 
    11  * 
     10 *       This is just a quick and dirty implementation
     11 *
    1212 * Project Odin Software License can be found in LICENSE.TXT
    1313 *
     
    1515
    1616#include <os2win.h>
     17#include <stdlib.h>
     18#include <string.h>
    1719#include <vmutex.h>
    1820#include <objhandle.h>
     
    2022#include "region.h"
    2123
    22 #define DBG_LOCALLOG    DBG_objhandle
     24#define DBG_LOCALLOG    DBG_objhandle
    2325#include "dbglocal.h"
    2426
     
    3537  objTableMutex.enter(VMUTEX_WAIT_FOREVER);
    3638  if(lowestFreeIndex == -1) {
    37         //oops, out of handles
    38         dprintf(("ERROR: GDI: HwAllocateWindowHandle OUT OF GDI OBJECT HANDLES!!"));
    39         objTableMutex.leave();
    40         DebugInt3();
    41         return FALSE;
     39    //oops, out of handles
     40    dprintf(("ERROR: GDI: HwAllocateWindowHandle OUT OF GDI OBJECT HANDLES!!"));
     41    objTableMutex.leave();
     42    DebugInt3();
     43    return FALSE;
    4244  }
    4345  *hObject  = lowestFreeIndex;
     
    4951  //find next free handle
    5052  for(int i=0;i<MAX_OBJECT_HANDLES;i++) {
    51         if(objHandleTable[i] == 0) {
    52                 lowestFreeIndex = i;
    53                 break;
    54         }
     53    if(objHandleTable[i] == 0) {
     54        lowestFreeIndex = i;
     55        break;
     56    }
    5557  }
    5658  objTableMutex.leave();
     
    6365  hObject &= OBJHANDLE_MAGIC_MASK;
    6466  if(hObject < MAX_OBJECT_HANDLES) {
    65         objTableMutex.enter(VMUTEX_WAIT_FOREVER);
    66         objHandleTable[hObject] = 0;
    67         if(lowestFreeIndex == -1 || hObject < lowestFreeIndex)
    68                 lowestFreeIndex = hObject;
    69 
    70         objTableMutex.leave();
     67    objTableMutex.enter(VMUTEX_WAIT_FOREVER);
     68    objHandleTable[hObject] = 0;
     69    if(lowestFreeIndex == -1 || hObject < lowestFreeIndex)
     70        lowestFreeIndex = hObject;
     71
     72    objTableMutex.leave();
    7173  }
    7274}
     
    7880  {
    7981  case GDIOBJ_REGION:
    80         break;
     82    break;
    8183  //case GDIOBJ_BITMAP
    8284  //case GDIOBJ_BRUSH
     
    8486  //case GDIOBJ_FONT
    8587  default:
    86         return HANDLE_OBJ_ERROR;
     88    return HANDLE_OBJ_ERROR;
    8789  }
    8890
    8991  hObject &= OBJHANDLE_MAGIC_MASK;
    9092  if(hObject < MAX_OBJECT_HANDLES) {
    91         return objHandleTable[hObject];
     93    return objHandleTable[hObject];
    9294  }
    9395  return HANDLE_OBJ_ERROR;
     
    100102  {
    101103  case GDIOBJ_REGION:
    102         return GDIOBJ_REGION;
     104    return GDIOBJ_REGION;
    103105  //case GDIOBJ_BITMAP
    104106  //case GDIOBJ_BRUSH
     
    106108  //case GDIOBJ_FONT
    107109  default:
    108         return GDIOBJ_ERROR;
     110    return GDIOBJ_ERROR;
    109111  }
    110112}
     
    115117 int rc;
    116118
    117   if(size == 0 || lpBuffer == NULL) {
    118         SetLastError(ERROR_INVALID_PARAMETER);
     119  dprintf(("GDI32: GetObject %X %X %X\n", hObject, size, lpBuffer));
     120  if(lpBuffer == NULL)
     121  { //return required size if buffer pointer == NULL
     122    int objtype = GetObjectType(hObject);
     123    switch(objtype)
     124    {
     125    case OBJ_PEN:
     126        return sizeof(LOGPEN);
     127
     128    case OBJ_EXTPEN:
     129        return sizeof(EXTLOGPEN);
     130
     131    case OBJ_BRUSH:
     132        return sizeof(LOGBRUSH);
     133
     134    case OBJ_PAL:
     135        return sizeof(USHORT);
     136
     137    case OBJ_FONT:
     138        return sizeof(LOGFONTA);
     139
     140    case OBJ_BITMAP:
     141        return sizeof(BITMAP); //also default for dib sections??? (TODO: NEED TO CHECK THIS)
     142
     143    case OBJ_DC:
     144    case OBJ_METADC:
     145    case OBJ_REGION:
     146    case OBJ_METAFILE:
     147    case OBJ_MEMDC:
     148    case OBJ_ENHMETADC:
     149    case OBJ_ENHMETAFILE:
     150        dprintf(("warning: GetObjectA not defined for object type %d", objtype));
    119151        return 0;
    120   }
    121 
    122   if(ObjGetHandleType(hObject) == GDIOBJ_REGION) {
    123         SetLastError(ERROR_SUCCESS);
    124         return 0;
    125   }
    126   dprintf(("GDI32: GetObject %X %X %X\n", hObject, size, lpBuffer));
     152    }
     153  }
    127154  if(DIBSection::getSection() != NULL)
    128155  {
     
    144171//******************************************************************************
    145172//******************************************************************************
    146 int WIN32API GetObjectW( HGDIOBJ arg1, int arg2, void *  arg3)
    147 {
    148   dprintf(("GDI32: GetObjectW %X, %d %X not complete!", arg1, arg2, arg3));
    149   return GetObjectA(arg1, arg2, arg3);
     173int WIN32API GetObjectW( HGDIOBJ hObject, int size, void *lpBuffer)
     174{
     175 int ret, objtype;
     176
     177  dprintf(("GDI32: GetObjectW %X, %d %X", hObject, size, lpBuffer));
     178  objtype = GetObjectType(hObject);
     179
     180  switch(objtype)
     181  {
     182  case OBJ_FONT:
     183  {
     184    LOGFONTA logfonta;
     185
     186        if(lpBuffer == NULL) {
     187            return sizeof(LOGFONTW); //return required size if buffer pointer == NULL
     188        }
     189        ret = GetObjectA(hObject, sizeof(logfonta), (void *)&logfonta);
     190        if(ret == sizeof(logfonta))
     191        {
     192            LOGFONTW *logfontw = (LOGFONTW *)lpBuffer;
     193
     194            if(size < sizeof(LOGFONTW)) {
     195                dprintf(("GDI32: GetObjectW : buffer not big enough for LOGFONTW struct!!")); //is the correct? or copy only part?
     196                return 0;
     197            }
     198            memcpy(logfontw, &logfonta, sizeof(LOGFONTA));
     199            memset(logfontw->lfFaceName, 0, LF_FACESIZE);
     200            AsciiToUnicodeN(logfonta.lfFaceName, logfontw->lfFaceName, LF_FACESIZE-1);
     201
     202            return sizeof(LOGFONTW);
     203        }
     204        return 0;
     205  }
     206  default:
     207      return GetObjectA(hObject, size, lpBuffer);
     208  }
    150209}
    151210//******************************************************************************
     
    158217
    159218    if(ObjGetHandleType(hObj) == GDIOBJ_REGION) {
    160         //Return complexity here; not previously selected clip region
    161         return (HGDIOBJ)SelectClipRgn(hdc, hObj);
     219    //Return complexity here; not previously selected clip region
     220        return (HGDIOBJ)SelectClipRgn(hdc, hObj);
    162221    }
    163222
     
    196255  if(ObjGetHandleType(hObj) == GDIOBJ_REGION) {
    197256        SetLastError(ERROR_SUCCESS);
    198         return OBJ_REGION;
     257    return OBJ_REGION;
    199258  }
    200259  return O32_GetObjectType(hObj);
     
    206265  dprintf(("GDI32: DeleteObject %x", hObj));
    207266  if(ObjGetHandleType(hObj) == GDIOBJ_REGION) {
    208         OSLibDeleteRegion(ObjGetHandleData(hObj));
    209         ObjFreeHandle(hObj);
     267    OSLibDeleteRegion(ObjGetHandleData(hObj));
     268    ObjFreeHandle(hObj);
    210269        SetLastError(ERROR_SUCCESS);
    211         return OBJ_REGION;
     270    return OBJ_REGION;
    212271  }
    213272  DIBSection::deleteSection((DWORD)hObj);
Note: See TracChangeset for help on using the changeset viewer.