Changeset 4574 for trunk/src


Ignore:
Timestamp:
Nov 9, 2000, 7:16:57 PM (25 years ago)
Author:
sandervl
Message:

DeleteDC + CreateDIBSection fixes

Location:
trunk/src/gdi32
Files:
4 edited

Legend:

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

    r4484 r4574  
    1 /* $Id: dibitmap.cpp,v 1.10 2000-10-16 11:01:47 sandervl Exp $ */
     1/* $Id: dibitmap.cpp,v 1.11 2000-11-09 18:16:56 sandervl Exp $ */
    22
    33/*
     
    2929  HBITMAP rc;
    3030
     31  //SvL: Completely wrong result when creating a 1bpp bitmap here (converted
     32  //     to 8bpp by Open32)
     33  if(lpbmih->biBitCount == 1) {
     34        dprintf(("WARNING: CreateDIBitmap doesn't handle 1bpp bitmaps very well!!!!!"));
     35  }
     36 
    3137  //TEMPORARY HACK TO PREVENT CRASH IN OPEN32 (WSeB GA)
    3238
     
    7884{
    7985    dprintf(("GDI32: CreateDisardableBitmap\n"));
    80     return O32_CreateCompatibleBitmap(hDC, nWidth, nHeight);
     86    return CreateCompatibleBitmap(hDC, nWidth, nHeight);
    8187}
    8288//******************************************************************************
     
    154160        // and use it to set the DIBColorTable
    155161        nrcolors = GetPaletteEntries( hpalCur, 0, 1<<PalSize, (LPPALETTEENTRY)&Pal);
    156         dsect->SetDIBColorTable(0, nrcolors, (RGBQUAD*)&Pal);
     162        dsect->SetDIBColorTable(0, nrcolors, (LPPALETTEENTRY)&Pal);
    157163
    158164        // Restore the DC Palette
  • trunk/src/gdi32/dibsect.cpp

    r4450 r4574  
    1 /* $Id: dibsect.cpp,v 1.41 2000-10-07 11:39:16 sandervl Exp $ */
     1/* $Id: dibsect.cpp,v 1.42 2000-11-09 18:16:56 sandervl Exp $ */
    22
    33/*
     
    395395//******************************************************************************
    396396//******************************************************************************
     397int DIBSection::SetDIBColorTable(int startIdx, int cEntries, PALETTEENTRY *palentry)
     398{
     399 int i;
     400
     401  if(startIdx + cEntries > (1 << pOS2bmp->cBitCount))
     402  {
     403    dprintf(("DIBSection::SetDIBColorTable, invalid nr of entries %d %d\n", startIdx, cEntries));
     404    return(0);
     405  }
     406
     407  for(i=startIdx;i<cEntries;i++)
     408  {
     409    pOS2bmp->argbColor[i].fcOptions = 0;
     410    pOS2bmp->argbColor[i].bBlue  = palentry[i].peBlue;
     411    pOS2bmp->argbColor[i].bGreen = palentry[i].peGreen;
     412    pOS2bmp->argbColor[i].bRed   = palentry[i].peRed;
     413  }
     414
     415  return(cEntries);
     416}
     417//******************************************************************************
     418//******************************************************************************
    397419BOOL DIBSection::BitBlt(HDC hdcDest, int nXdest, int nYdest, int nDestWidth,
    398420                        int nDestHeight, int nXsrc, int nYsrc,
     
    428450
    429451        if(fFrameWindowDC) {
    430             GetWindowRect(hwndDest, &rect);
     452              GetWindowRect(hwndDest, &rect);
    431453        }
    432454        else  GetClientRect(hwndDest, &rect);
     
    488510  }
    489511*/
     512#ifdef INVERT
    490513  oldyinversion = GpiQueryYInversion(hps);
    491514  if(oldyinversion != 0) {
     
    493516        fRestoryYInversion = TRUE;
    494517  }
     518#endif
     519
     520#ifdef DEBUG
     521  RECTL rcltemp;
     522  GreGetDCOrigin(hps, (PPOINTL)&rcltemp);
     523  dprintf(("origin (%d,%d) yinv %d", rcltemp.xLeft, rcltemp.yBottom, oldyinversion));
     524#endif
    495525
    496526  if(fFlip & FLIP_HOR)
     
    572602            destdib->sync(hps, nYdest, nDestHeight);
    573603        }
     604#ifdef INVERT
    574605        //restore old y inversion height
    575606        if(fRestoryYInversion) GpiEnableYInversion(hps, oldyinversion);
     607#endif
    576608            SetLastError(ERROR_SUCCESS_W);
    577609
    578610        return(TRUE);
    579611  }
     612#ifdef INVERT
    580613  if(fRestoryYInversion) GpiEnableYInversion(hps, oldyinversion);
     614#endif
    581615
    582616  dprintf(("DIBSection::BitBlt %X (%d,%d) (%d,%d) to (%d,%d) (%d,%d) returned %d\n", hps, point[0].x, point[0].y, point[1].x, point[1].y, point[2].x, point[2].y, point[3].x, point[3].y, rc));
  • trunk/src/gdi32/dibsect.h

    r4447 r4574  
    1 /* $Id: dibsect.h,v 1.21 2000-10-07 09:03:50 hugh Exp $ */
     1/* $Id: dibsect.h,v 1.22 2000-11-09 18:16:56 sandervl Exp $ */
    22
    33/*
     
    1717  BYTE rgbReserved;
    1818} RGBQUAD, *LPRGBQUAD;
     19
     20typedef struct tagPALETTEENTRY
     21{
     22        BYTE peRed, peGreen, peBlue, peFlags;
     23} PALETTEENTRY, *PPALETTEENTRY, *LPPALETTEENTRY;
     24
    1925#else
    2026#define BITMAPINFO2     DWORD
     
    94100              void  sync(DWORD xDst, DWORD yDst, DWORD widthDst, DWORD heightDst, PVOID bits);
    95101               int  SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb);
     102               int  SetDIBColorTable(int startIdx, int cEntries, PALETTEENTRY *rgb);
    96103
    97104               int  SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT
  • trunk/src/gdi32/gdi32.cpp

    r4557 r4574  
    1 /* $Id: gdi32.cpp,v 1.59 2000-11-05 18:48:21 sandervl Exp $ */
     1/* $Id: gdi32.cpp,v 1.60 2000-11-09 18:16:57 sandervl Exp $ */
    22
    33/*
     
    2222#include "oslibgpi.h"
    2323#include "oslibgdi.h"
     24#include <dcdata.h>
     25#include <win32wnd.h>
    2426
    2527#define DBG_LOCALLOG    DBG_gdi32
     
    8587//******************************************************************************
    8688//******************************************************************************
    87 ODINFUNCTION1(BOOL, DeleteDC, HDC, hdc)
    88 {
    89   return O32_DeleteDC(hdc);
    90 }
    91 //******************************************************************************
    92 //******************************************************************************
    9389HBRUSH WIN32API CreatePatternBrush(HBITMAP arg1)
    9490{
     
    137133    dprintf(("CreateCompatibleDC %X returned %x", hdc, newHdc));
    138134    return newHdc;
     135}
     136//******************************************************************************
     137//******************************************************************************
     138ODINFUNCTION1(BOOL, DeleteDC, HDC, hdc)
     139{
     140  pDCData  pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
     141  if(!pHps)
     142  {
     143      dprintf(("WARNING: DeleteDC %x; invalid hdc!", hdc));
     144      SetLastError(ERROR_INVALID_HANDLE);
     145      return 0;
     146  }
     147  SetLastError(ERROR_SUCCESS);
     148  //Must call ReleaseDC for window dcs
     149  if(pHps->hdcType == TYPE_1) {
     150      return ReleaseDC(OS2ToWin32Handle(pHps->hwnd), hdc);
     151  }
     152
     153  return O32_DeleteDC(hdc);
    139154}
    140155//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.