Changeset 8871 for trunk/src


Ignore:
Timestamp:
Jul 15, 2002, 12:02:30 PM (23 years ago)
Author:
sandervl
Message:

Handle management updates

Location:
trunk/src/gdi32
Files:
9 edited

Legend:

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

    r7791 r8871  
    1 /* $Id: blit.cpp,v 1.38 2002-01-29 14:36:31 sandervl Exp $ */
     1/* $Id: blit.cpp,v 1.39 2002-07-15 10:02:28 sandervl Exp $ */
    22
    33/*
     
    3232                         int nWidthSrc, int nHeightSrc, DWORD dwRop)
    3333{
    34  BOOL rc;
    35 
    36   dprintf(("GDI32: StretchBlt Dest: %x (%d, %d) size (%d, %d) ROP %x",
    37            hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, dwRop));
    38   dprintf(("GDI32: StretchBlt Src : %x (%d, %d) size (%d, %d)\n",
    39            hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc));
    40 
    41   SetLastError(ERROR_SUCCESS);
    42   if(DIBSection::getSection() != NULL)
    43   {
    44     DIBSection *dsect = DIBSection::findHDC(hdcSrc);
    45     if(dsect)
    46     {
    47         rc  = dsect->BitBlt( hdcDest,
    48                              nXOriginDest, nYOriginDest, nWidthDest, nHeightDest,
    49                              nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc,
    50                              dwRop);
    51         dprintf(("GDI32: StretchBlt returned %d", rc));
    52         return rc;
    53     }
    54   }
    55   rc = O32_StretchBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, dwRop);
    56   if(DIBSection::getSection() != NULL) {
    57       DIBSection *destdib = DIBSection::findHDC(hdcDest);
    58       if(destdib) {
    59           destdib->sync(hdcDest, nYOriginDest, nHeightDest);
    60       }
    61   }
    62   if(rc == FALSE) {
    63       dprintf(("!WARNING!: GDI32: StretchBlt returned FALSE; last error %x", rc, GetLastError()));
    64   }
    65   return rc;
     34    BOOL rc;
     35
     36    dprintf(("GDI32: StretchBlt Dest: %x (%d, %d) size (%d, %d) ROP %x",
     37             hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, dwRop));
     38    dprintf(("GDI32: StretchBlt Src : %x (%d, %d) size (%d, %d)\n",
     39             hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc));
     40
     41    SetLastError(ERROR_SUCCESS);
     42    if(DIBSection::getSection() != NULL)
     43    {
     44        DIBSection *dsect = DIBSection::findHDC(hdcSrc);
     45        if(dsect)
     46        {
     47            rc  = dsect->BitBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest,
     48                                nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, dwRop);
     49            dprintf(("GDI32: StretchBlt returned %d", rc));
     50            return rc;
     51        }
     52    }
     53    rc = O32_StretchBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, dwRop);
     54    if(DIBSection::getSection() != NULL) {
     55        DIBSection *destdib = DIBSection::findHDC(hdcDest);
     56        if(destdib) {
     57            destdib->sync(hdcDest, nYOriginDest, nHeightDest);
     58        }
     59    }
     60    if(rc == FALSE) {
     61        dprintf(("!WARNING!: GDI32: StretchBlt returned FALSE; last error %x", rc, GetLastError()));
     62    }
     63    return rc;
    6664}
    6765//******************************************************************************
     
    7775                     DWORD  dwRop)
    7876{
    79   BOOL rc;
    80 
    81   POINT point1, point2;
    82   GetViewportOrgEx(hdcDest, &point1);
    83   GetViewportOrgEx(hdcSrc, &point2);
    84   dprintf(("BitBlt: Viewport origin dest (%d,%d) src (%d,%d)", point1.x, point1.y, point2.x, point2.y));
    85 
    86   SetLastError(ERROR_SUCCESS);
    87   if(DIBSection::getSection() != NULL)
    88   {
    89     DIBSection *dsect = DIBSection::findHDC(hdcSrc);
    90     if(dsect)
    91     {
    92       return dsect->BitBlt(hdcDest,
    93                            nXDest,
    94                            nYDest,
    95                            nWidth,
    96                            nHeight,
    97                            nXSrc,
    98                            nYSrc,
    99                            nWidth,
    100                            nHeight,
    101                            dwRop);
    102     }
    103   }
    104   dprintf(("GDI32: BitBlt to hdc %X from hdc %x (%d,%d) to (%d,%d), (%d,%d) rop %X\n",
    105            hdcDest, hdcSrc, nXSrc, nYSrc, nXDest, nYDest, nWidth, nHeight, dwRop));
    106 
    107   rc = O32_BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
    108 
    109   if(DIBSection::getSection() != NULL) {
    110       DIBSection *destdib = DIBSection::findHDC(hdcDest);
    111       if(destdib) {
    112           destdib->sync(hdcDest, nYDest, nHeight);
    113       }
    114   }
    115   return rc;
     77    BOOL rc;
     78
     79#ifdef DEBUG
     80      POINT point1, point2;
     81    GetViewportOrgEx(hdcDest, &point1);
     82    GetViewportOrgEx(hdcSrc, &point2);
     83    dprintf(("BitBlt: Viewport origin dest (%d,%d) src (%d,%d)", point1.x, point1.y, point2.x, point2.y));
     84#endif
     85
     86    SetLastError(ERROR_SUCCESS);
     87    if(DIBSection::getSection() != NULL)
     88    {
     89        DIBSection *dsect = DIBSection::findHDC(hdcSrc);
     90        if(dsect)
     91        {
     92            return dsect->BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc, nWidth, nHeight, dwRop);
     93        }
     94    }
     95    dprintf(("GDI32: BitBlt to hdc %X from hdc %x (%d,%d) to (%d,%d), (%d,%d) rop %X\n",
     96             hdcDest, hdcSrc, nXSrc, nYSrc, nXDest, nYDest, nWidth, nHeight, dwRop));
     97
     98    rc = O32_BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
     99
     100    if(DIBSection::getSection() != NULL) {
     101        DIBSection *destdib = DIBSection::findHDC(hdcDest);
     102        if(destdib) {
     103            destdib->sync(hdcDest, nYDest, nHeight);
     104        }
     105    }
     106    return rc;
    116107}
    117108//******************************************************************************
     
    169160    case 15:
    170161    case 16: //Default if BI_BITFIELDS not set is RGB 555
    171         bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors : 0x7c00;
    172         bitfields[1] = (info->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)info->bmiColors + 1) : 0x03e0;
    173         bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)info->bmiColors + 2) : 0x001f;
     162        bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors       : DEFAULT_16BPP_RED_MASK;
     163        bitfields[1] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 1) : DEFAULT_16BPP_GREEN_MASK;
     164        bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 2) : DEFAULT_16BPP_BLUE_MASK;
    174165        break;
    175166
    176167    case 24:
    177168    case 32:
    178         bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors : 0xff0000;
    179         bitfields[1] = (info->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)info->bmiColors + 1) : 0xff00;
    180         bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)info->bmiColors + 2) : 0xff;
     169        bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors       : DEFAULT_24BPP_RED_MASK;
     170        bitfields[1] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 1) : DEFAULT_24BPP_GREEN_MASK;
     171        bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 2) : DEFAULT_24BPP_BLUE_MASK;
    181172        break;
    182173    default:
     
    205196    }
    206197    if(startscan != 0 || lines != info->bmiHeader.biHeight) {
    207         dprintf(("WARNING: SetDIBitsToDevice startscan != 0 || lines != info->bmiHeader.biHeight"));
     198            dprintf(("WARNING: SetDIBitsToDevice startscan != 0 || lines != info->bmiHeader.biHeight"));
    208199        dprintf(("info bmp (%d,%d)", info->bmiHeader.biWidth, info->bmiHeader.biHeight));
    209200    }
     
    215206    //Open32 always returns height of bitmap (regardless of how many scanlines were copied)
    216207    if(result != info->bmiHeader.biHeight) {
    217         dprintf(("SetDIBitsToDevice failed with rc %x", result));
     208            dprintf(("SetDIBitsToDevice failed with rc %x", result));
    218209    }
    219210    else
     
    240231    }
    241232    if(newbits) free(newbits);
     233
    242234    ((BITMAPINFO *)info)->bmiHeader.biSizeImage = bmpsize;
    243235    return result;
     
    413405BOOL WIN32API PatBlt(HDC hdc,int nXLeft,int nYLeft,int nWidth,int nHeight,DWORD dwRop)
    414406{
    415   BOOL rc;
    416 
    417   dprintf(("PatBlt %x (%d,%d)(%d,%d) %x", hdc, nXLeft,nYLeft,nWidth,nHeight, dwRop));
    418   //CB: Open32 bug: negative width/height not supported!
    419   if (nWidth < 0)
    420   {
    421     nXLeft += nWidth+1;
    422     nWidth = -nWidth;
    423   }
    424   if (nHeight < 0)
    425   {
    426     nYLeft += nHeight+1;
    427     nHeight = -nHeight;
    428   }
    429   rc = O32_PatBlt(hdc,nXLeft,nYLeft,nWidth,nHeight,dwRop);
    430   if(rc) {
    431         DIBSection *destdib = DIBSection::findHDC(hdc);
    432         if(destdib) {
    433                 destdib->sync(hdc, nYLeft, nHeight);
    434         }
    435   }
    436 
    437   dprintf(("GDI32: PatBlt hdc %x (%d,%d) (%d,%d) returned %d\n",hdc, nXLeft,nYLeft,nWidth,nHeight,rc));
    438   return(rc);
     407    BOOL rc;
     408
     409    dprintf(("PatBlt %x (%d,%d)(%d,%d) %x", hdc, nXLeft,nYLeft,nWidth,nHeight, dwRop));
     410    //CB: Open32 bug: negative width/height not supported!
     411    if (nWidth < 0)
     412    {
     413        nXLeft += nWidth+1;
     414        nWidth = -nWidth;
     415    }
     416    if (nHeight < 0)
     417    {
     418        nYLeft += nHeight+1;
     419        nHeight = -nHeight;
     420    }
     421    rc = O32_PatBlt(hdc,nXLeft,nYLeft,nWidth,nHeight,dwRop);
     422    if(rc) {
     423        DIBSection *destdib = DIBSection::findHDC(hdc);
     424        if(destdib) {
     425                    destdib->sync(hdc, nYLeft, nHeight);
     426            }
     427    }
     428
     429    dprintf(("GDI32: PatBlt hdc %x (%d,%d) (%d,%d) returned %d\n",hdc, nXLeft,nYLeft,nWidth,nHeight,rc));
     430    return(rc);
    439431}
    440432//******************************************************************************
     
    451443                     int xMast, int yMask)
    452444{
    453   dprintf(("GDI32: PlgBlt, not implemented\n"));
    454   return(FALSE);
     445    dprintf(("GDI32: PlgBlt, not implemented\n"));
     446    return(FALSE);
    455447}
    456448//******************************************************************************
     
    461453                           const BITMAPINFO *info, UINT wUsage, DWORD dwRop )
    462454{
    463  INT rc;
    464  DWORD bitfields[3], compression = 0;
    465  WORD *newbits = NULL;
     455    INT rc;
     456    DWORD bitfields[3], compression = 0;
     457    WORD *newbits = NULL;
    466458
    467459    dprintf(("GDI32: StretchDIBits %x to (%d,%d) (%d,%d) from (%d,%d) (%d,%d), %x %x %x %x", hdc, xDst, yDst, widthDst, heightDst, xSrc, ySrc, widthSrc, heightSrc, bits, info, wUsage, dwRop));
     
    486478
    487479        if(GetDIBColorTable(hdc, 0, info->bmiHeader.biClrUsed, pColors) == 0) {
    488                 dprintf(("ERROR: StretchDIBits: GetDIBColorTable failed!!"));
     480                    dprintf(("ERROR: StretchDIBits: GetDIBColorTable failed!!"));
    489481                return FALSE;
    490482        }
     
    500492        //Open32 always returns height of bitmap (regardless of how many scanlines were copied)
    501493        if(rc != heightSrc && rc != infoLoc->bmiHeader.biHeight) {
    502                 dprintf(("StretchDIBits failed with rc %x", rc));
     494                    dprintf(("StretchDIBits failed with rc %x", rc));
    503495        }
    504         else {
    505                 rc = heightSrc;
    506 
    507                 DIBSection *destdib = DIBSection::findHDC(hdc);
    508                 if(destdib) {
    509                         if(widthDst == widthSrc && heightDst == heightSrc &&
    510                            destdib->GetBitCount() == infoLoc->bmiHeader.biBitCount &&
    511                            destdib->GetBitCount() == 8)
    512                         {
    513                                 destdib->sync(xDst, yDst, widthDst, heightDst, (PVOID)bits);
    514                         }
    515                         else    destdib->sync(hdc, yDst, heightDst);
    516                 }
    517         }
    518 
    519         return rc;
     496            else {
     497                    rc = heightSrc;
     498
     499                    DIBSection *destdib = DIBSection::findHDC(hdc);
     500                    if(destdib) {
     501                        if(widthDst == widthSrc && heightDst == heightSrc &&
     502                            destdib->GetBitCount() == infoLoc->bmiHeader.biBitCount &&
     503                            destdib->GetBitCount() == 8)
     504                {
     505                                    destdib->sync(xDst, yDst, widthDst, heightDst, (PVOID)bits);
     506                            }
     507                            else        destdib->sync(hdc, yDst, heightDst);
     508                    }
     509            }
     510   
     511        return rc;
    520512    }
    521513
     
    523515    case 15:
    524516    case 16: //Default if BI_BITFIELDS not set is RGB 555
    525         bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors : 0x7c00;
    526         bitfields[1] = (info->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)info->bmiColors + 1) : 0x03e0;
    527         bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)info->bmiColors + 2) : 0x001f;
     517        bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors       : DEFAULT_16BPP_RED_MASK;
     518        bitfields[1] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 1) : DEFAULT_16BPP_GREEN_MASK;
     519        bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 2) : DEFAULT_16BPP_BLUE_MASK;
    528520        break;
    529521    case 24:
    530522    case 32:
    531         bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors : 0xff0000;
    532         bitfields[1] = (info->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)info->bmiColors + 1) : 0xff00;
    533         bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)info->bmiColors + 2) : 0xff;
     523        bitfields[0] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)info->bmiColors       : DEFAULT_24BPP_RED_MASK;
     524        bitfields[1] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 1) : DEFAULT_24BPP_GREEN_MASK;
     525        bitfields[2] = (info->bmiHeader.biCompression == BI_BITFIELDS) ? *((DWORD *)info->bmiColors + 2) : DEFAULT_24BPP_BLUE_MASK;
    534526        break;
    535527    default:
     
    539531        break;
    540532    }
    541     if(bitfields[1] == 0x3E0)
     533    if(bitfields[1] == RGB555_GREEN_MASK)
    542534    {//RGB 555?
    543535        dprintf(("RGB 555->565 conversion required %x %x %x", bitfields[0], bitfields[1], bitfields[2]));
     
    570562    //Open32 always returns height of bitmap (regardless of how many scanlines were copied)
    571563    if(rc != heightSrc && rc != info->bmiHeader.biHeight) {
    572         dprintf(("StretchDIBits failed with rc %x", rc));
     564            dprintf(("StretchDIBits failed with rc %x", rc));
    573565    }
    574566    else
    575567    {
    576         rc = heightSrc;
    577 
    578         DIBSection *destdib = DIBSection::findHDC(hdc);
    579         if(destdib) {
    580                 if(widthDst == widthSrc && heightDst == heightSrc &&
    581                    destdib->GetBitCount() == info->bmiHeader.biBitCount &&
    582                    destdib->GetBitCount() == 8)
    583                 {
    584                         destdib->sync(xDst, yDst, widthDst, heightDst, (PVOID)bits);
    585                 }
    586                 else    destdib->sync(hdc, yDst, heightDst);
    587         }
     568            rc = heightSrc;
     569
     570            DIBSection *destdib = DIBSection::findHDC(hdc);
     571            if(destdib) {
     572                if(widthDst == widthSrc && heightDst == heightSrc &&
     573                    destdib->GetBitCount() == info->bmiHeader.biBitCount &&
     574                    destdib->GetBitCount() == 8)
     575            {
     576                             destdib->sync(xDst, yDst, widthDst, heightDst, (PVOID)bits);
     577                    }
     578                    else destdib->sync(hdc, yDst, heightDst);
     579            }
    588580    }
    589581
     
    636628  dprintf(("GDI32: SetStretchBltMode 0x%08X, 0x%08X\n",arg1, arg2));
    637629
    638   if(DIBSection::getSection() != NULL)
    639   {
    640     DIBSection *dsect = DIBSection::findHDC(arg1);
    641     if(dsect)
    642     {
    643       dprintf(("       - DC is DIBSection\n"));
    644     }
    645   }
    646   return O32_SetStretchBltMode(arg1, arg2);
     630    if(DIBSection::getSection() != NULL)
     631    {
     632        DIBSection *dsect = DIBSection::findHDC(arg1);
     633        if(dsect)
     634        {
     635            dprintf(("       - DC is DIBSection\n"));
     636        }
     637    }
     638    return O32_SetStretchBltMode(arg1, arg2);
    647639}
    648640//******************************************************************************
  • trunk/src/gdi32/dbglocal.cpp

    r6375 r8871  
    1 /* $Id: dbglocal.cpp,v 1.7 2001-07-20 15:35:57 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.8 2002-07-15 10:02:28 sandervl Exp $ */
    22
    33/*
     
    1212#include <stdio.h>
    1313#include <string.h>
     14#include <ctype.h>
    1415#include "dbglocal.h"
    1516
     
    6768    }
    6869    for(i=0;i<DBG_MAXFILES;i++) {
     70        int len = strlen(DbgFileNames[i]);
    6971        dbgvar = strstr(envvar, DbgFileNames[i]);
    70         if(dbgvar) {
     72        if(dbgvar && !islower(dbgvar[len])) {
    7173            if(*(dbgvar-1) == '-') {
    7274                    DbgEnabledGDI32[i] = 0;
     
    8890        }
    8991        for(i=0;i<DBG_MAXFILES;i++) {
     92                int len = strlen(DbgFileNames[i]);
    9093                dbgvar = strstr(envvar2, DbgFileNames[i]);
    91                 if(dbgvar) {
     94                if(dbgvar && !islower(dbgvar[len])) {
    9295                    if(*(dbgvar-1) == '-') {
    9396                            DbgEnabledLvl2GDI32[i] = 0;
  • trunk/src/gdi32/dibitmap.cpp

    r7713 r8871  
    1 /* $Id: dibitmap.cpp,v 1.30 2001-12-30 22:19:05 sandervl Exp $ */
     1/* $Id: dibitmap.cpp,v 1.31 2002-07-15 10:02:28 sandervl Exp $ */
    22
    33/*
     
    2020#include "rgbcvt.h"
    2121#include <stats.h>
     22#include "oslibgpi.h"
     23#include <objhandle.h>
    2224
    2325#define DBG_LOCALLOG    DBG_dibitmap
     
    6870                }
    6971                rc = CreateDIBitmap(hdc, lpbmih, fdwInit, newbits, lpbmi, fuUsage);
    70                 free( newbits );
     72                        free( newbits );
    7173            }
    7274
     
    9395    case 15:
    9496    case 16: //Default if BI_BITFIELDS not set is RGB 555
    95         bitfields[0] = (lpbmih->biCompression == BI_BITFIELDS) ? *(DWORD *)lpbmi->bmiColors : 0x7c00;
    96         bitfields[1] = (lpbmih->biCompression == BI_BITFIELDS) ?  *((DWORD *)lpbmi->bmiColors + 1) : 0x03e0;
    97         bitfields[2] = (lpbmih->biCompression == BI_BITFIELDS) ?  *((DWORD *)lpbmi->bmiColors + 2) : 0x001f;
     97        bitfields[0] = (lpbmih->biCompression == BI_BITFIELDS) ? *(DWORD *)lpbmi->bmiColors       : DEFAULT_16BPP_RED_MASK;
     98        bitfields[1] = (lpbmih->biCompression == BI_BITFIELDS) ? *((DWORD *)lpbmi->bmiColors + 1) : DEFAULT_16BPP_GREEN_MASK;
     99        bitfields[2] = (lpbmih->biCompression == BI_BITFIELDS) ? *((DWORD *)lpbmi->bmiColors + 2) : DEFAULT_16BPP_BLUE_MASK;
    98100        break;
    99101    case 24:
    100102    case 32:
    101         bitfields[0] = (lpbmih->biCompression == BI_BITFIELDS) ? *(DWORD *)lpbmi->bmiColors        : 0xff0000;
    102         bitfields[1] = (lpbmih->biCompression == BI_BITFIELDS) ?  *((DWORD *)lpbmi->bmiColors + 1) : 0xff00;
    103         bitfields[2] = (lpbmih->biCompression == BI_BITFIELDS) ?  *((DWORD *)lpbmi->bmiColors + 2) : 0xff;
     103        bitfields[0] = (lpbmih->biCompression == BI_BITFIELDS) ? *(DWORD *)lpbmi->bmiColors       : DEFAULT_24BPP_RED_MASK;
     104        bitfields[1] = (lpbmih->biCompression == BI_BITFIELDS) ? *((DWORD *)lpbmi->bmiColors + 1) : DEFAULT_24BPP_GREEN_MASK;
     105        bitfields[2] = (lpbmih->biCompression == BI_BITFIELDS) ? *((DWORD *)lpbmi->bmiColors + 2) : DEFAULT_24BPP_BLUE_MASK;
    104106        break;
    105107    default:
     
    109111        break;
    110112    }
    111     if(bitfields[1] == 0x3E0 && lpbInit && fdwInit == CBM_INIT)
     113    if(bitfields[1] == RGB555_GREEN_MASK && lpbInit && fdwInit == CBM_INIT)
    112114    {//RGB 555?
    113115        dprintf(("RGB 555->565 conversion required %x %x %x", bitfields[0], bitfields[1], bitfields[2]));
     
    132134    ((BITMAPINFOHEADER *)lpbmih)->biBitCount = biBitCount;
    133135
    134     if(rc) STATS_CreateDIBitmap(rc, hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage);
     136    if(rc) {
     137        STATS_CreateDIBitmap(rc, hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage);
     138#ifdef NEW_GDIHANDLES
     139        if(bitfields[1] == RGB565_GREEN_MASK) {
     140            //mark bitmap as RGB565
     141            dprintf(("RGB565 bitmap"));
     142            ObjSetHandleFlag(rc, OBJHANDLE_FLAG_BMP_RGB565, TRUE);
     143        }
     144#endif
     145    }
    135146
    136147    return rc;
     
    141152{
    142153    HBITMAP hBitmap;
     154#ifdef NEW_GDIHANDLES
     155    pDCData pHps; 
     156
     157    pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
     158    if(!pHps)
     159    {
     160        SetLastError(ERROR_INVALID_HANDLE);
     161        return 0;
     162    }
     163#endif
    143164
    144165    hBitmap = O32_CreateCompatibleBitmap(hdc, nWidth, nHeight);
    145166    dprintf(("GDI32: CreateCompatibleBitmap %x (%d,%d) returned %x", hdc, nWidth, nHeight, hBitmap));
    146     if(hBitmap) STATS_CreateCompatibleBitmap(hBitmap,hdc, nWidth, nHeight);
     167    if(hBitmap) {
     168        STATS_CreateCompatibleBitmap(hBitmap,hdc, nWidth, nHeight);
     169#ifdef NEW_GDIHANDLES
     170        if(pHps->hwnd == 1) { //1 == HWND_DESKTOP
     171            dprintf(("Screen compatible bitmap"));
     172            ObjSetHandleFlag(hBitmap, OBJHANDLE_FLAG_BMP_SCREEN_COMPATIBLE, 1);
     173        }
     174#endif
     175    }
    147176
    148177    return hBitmap;
     
    153182HBITMAP WIN32API CreateDiscardableBitmap(HDC hDC, int nWidth, int nHeight)
    154183{
    155     dprintf(("GDI32: CreateDisardableBitmap\n"));
     184    dprintf(("GDI32: CreateDisardableBitmap"));
    156185    return CreateCompatibleBitmap(hDC, nWidth, nHeight);
    157186}
     
    161190                              UINT cBitsPerPel, const void *lpvBits)
    162191{
    163  HBITMAP hBitmap;
     192    HBITMAP hBitmap;
    164193
    165194    hBitmap = O32_CreateBitmap(nWidth, nHeight, cPlanes, cBitsPerPel, lpvBits);
     
    187216                                   VOID **ppvBits, HANDLE hSection, DWORD dwOffset)
    188217{
    189  HBITMAP res = 0;
    190  BOOL    fFlip = 0;
    191  int     iHeight, iWidth;
    192  BOOL    fCreateDC = FALSE;
    193 
    194   dprintf(("GDI32: CreateDIBSection %x %x %x %x %x %d", hdc, pbmi, iUsage, ppvBits, hSection, dwOffset));
     218    HBITMAP res = 0;
     219    BOOL    fFlip = 0;
     220    int     iHeight, iWidth;
     221    BOOL    fCreateDC = FALSE;
     222   
     223    dprintf(("GDI32: CreateDIBSection %x %x %x %x %x %d", hdc, pbmi, iUsage, ppvBits, hSection, dwOffset));
    195224
    196225    //SvL: 13-9-98: StarCraft uses bitmap with negative height
     
    368397        case 15:
    369398        case 16: //RGB 565
    370            ((DWORD*)(lpbi->bmiColors))[0] = 0x7c00;
    371            ((DWORD*)(lpbi->bmiColors))[1] = 0x03E0;
    372            ((DWORD*)(lpbi->bmiColors))[2] = 0x001F;
    373            break;
     399        {
     400#ifdef NEW_GDIHANDLES
     401            DWORD dwFlags;
     402
     403            dwFlags = ObjQueryHandleFlags(hBitmap);
     404            if(dwFlags & (OBJHANDLE_FLAG_BMP_SCREEN_COMPATIBLE|OBJHANDLE_FLAG_BMP_RGB565)) {
     405                ((DWORD*)(lpbi->bmiColors))[0] = RGB565_RED_MASK;
     406                ((DWORD*)(lpbi->bmiColors))[1] = RGB565_GREEN_MASK;
     407                ((DWORD*)(lpbi->bmiColors))[2] = RGB565_BLUE_MASK;
     408            }
     409            else {
     410                ((DWORD*)(lpbi->bmiColors))[0] = RGB555_RED_MASK;
     411                ((DWORD*)(lpbi->bmiColors))[1] = RGB555_GREEN_MASK;
     412                ((DWORD*)(lpbi->bmiColors))[2] = RGB555_BLUE_MASK;
     413            }
     414            break;
     415#else
     416            ((DWORD*)(lpbi->bmiColors))[0] = RGB555_RED_MASK;
     417            ((DWORD*)(lpbi->bmiColors))[1] = RGB555_GREEN_MASK;
     418            ((DWORD*)(lpbi->bmiColors))[2] = RGB555_BLUE_MASK;
     419#endif
     420        }
    374421        case 24:
    375422        case 32:
    376            ((DWORD*)(lpbi->bmiColors))[0] = 0xFF0000;
    377            ((DWORD*)(lpbi->bmiColors))[1] = 0x00FF00;
    378            ((DWORD*)(lpbi->bmiColors))[2] = 0x0000FF;
    379            break;
    380         }
    381     }
    382     if(nrlines && lpvBits && lpbi->bmiHeader.biBitCount == 16 && ((DWORD*)(lpbi->bmiColors))[1] == 0x3E0)
     423            ((DWORD*)(lpbi->bmiColors))[0] = DEFAULT_24BPP_RED_MASK;
     424            ((DWORD*)(lpbi->bmiColors))[1] = DEFAULT_24BPP_GREEN_MASK;
     425            ((DWORD*)(lpbi->bmiColors))[2] = DEFAULT_24BPP_BLUE_MASK;
     426            break;
     427        }
     428        if(lpbi->bmiHeader.biCompression == BI_RGB && lpbi->bmiHeader.biBitCount > 8) {
     429            lpbi->bmiHeader.biCompression = BI_BITFIELDS;
     430            dprintf(("BI_BITFIELDS: %x %x %x", ((DWORD*)(lpbi->bmiColors))[0], ((DWORD*)(lpbi->bmiColors))[1], ((DWORD*)(lpbi->bmiColors))[2]));
     431        }
     432    }
     433    if(nrlines && lpvBits && lpbi->bmiHeader.biBitCount == 16 && ((DWORD*)(lpbi->bmiColors))[1] == RGB555_GREEN_MASK)
    383434    {//RGB 555?
    384435        dprintf(("RGB 565->555 conversion required"));
     
    457508    case 15:
    458509    case 16: //Default if BI_BITFIELDS not set is RGB 555
    459         bitfields[0] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)pBitmapInfo->bmiColors : 0x7c00;
    460         bitfields[1] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)pBitmapInfo->bmiColors + 1) : 0x03e0;
    461         bitfields[2] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)pBitmapInfo->bmiColors + 2) : 0x001f;
     510        bitfields[0] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ?  *(DWORD *)pBitmapInfo->bmiColors       : DEFAULT_16BPP_RED_MASK;
     511        bitfields[1] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)pBitmapInfo->bmiColors + 1) : DEFAULT_16BPP_GREEN_MASK;
     512        bitfields[2] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)pBitmapInfo->bmiColors + 2) : DEFAULT_16BPP_BLUE_MASK;
    462513        break;
    463514
    464515    case 24:
    465516    case 32:
    466         bitfields[0] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ? *(DWORD *)pBitmapInfo->bmiColors : 0xff0000;
    467         bitfields[1] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)pBitmapInfo->bmiColors + 1) : 0xff00;
    468         bitfields[2] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)pBitmapInfo->bmiColors + 2) : 0xff;
     517        bitfields[0] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ?  *(DWORD *)pBitmapInfo->bmiColors       : DEFAULT_24BPP_RED_MASK;
     518        bitfields[1] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)pBitmapInfo->bmiColors + 1) : DEFAULT_24BPP_GREEN_MASK;
     519        bitfields[2] = (pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS) ?  *((DWORD *)pBitmapInfo->bmiColors + 2) : DEFAULT_24BPP_BLUE_MASK;
    469520        break;
    470521    default:
     
    474525        break;
    475526    }
    476     if(pBits && bitfields[1] == 0x3E0)
     527    if(pBits && bitfields[1] == RGB555_GREEN_MASK)
    477528    {//RGB 555?
    478529        dprintf(("RGB 555->565 conversion required %x %x %x", bitfields[0], bitfields[1], bitfields[2]));
  • trunk/src/gdi32/font.cpp

    r8418 r8871  
    1 /* $Id: font.cpp,v 1.25 2002-05-15 11:43:18 sandervl Exp $ */
     1/* $Id: font.cpp,v 1.26 2002-07-15 10:02:28 sandervl Exp $ */
    22
    33/*
     
    9797};
    9898
     99HFONT hFntDefaultGui = NULL;
     100
    99101/*****************************************************************************
    100102 * Name      : static void iFontRename
     
    142144                                  lpstrFaceTemp,
    143145                                  LF_FACESIZE);
    144 }
    145 
    146 //******************************************************************************
    147 HFONT hFntDefaultGui = NULL;
    148 //TODO: more??
    149 //******************************************************************************
    150 BOOL WIN32API IsSystemFont(HFONT hFont)
    151 {
    152     if(hFont == hFntDefaultGui) {
    153         return TRUE;
    154     }
    155     return FALSE;
    156146}
    157147//******************************************************************************
  • trunk/src/gdi32/gdi32.DEF

    r7682 r8871  
    1 ; $Id: gdi32.DEF,v 1.21 2001-12-26 11:33:10 sandervl Exp $
     1; $Id: gdi32.DEF,v 1.22 2002-07-15 10:02:28 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    358358;
    359359    _ObjAllocateHandle@12                                       @1201 NONAME
    360     _ObjFreeHandle@4                                            @1202 NONAME
    361     _ObjGetHandleData@8                                         @1203 NONAME
    362     _ObjGetHandleType@4                                         @1204 NONAME
     360    _ObjDeleteHandle@8                                          @1202 NONAME
     361    _ObjQueryHandleData@8                                       @1203 NONAME
     362    _ObjQueryHandleType@4                                       @1204 NONAME
     363    _ObjSetHandleFlag@12                                        @1205 NONAME
     364    _ObjSetHandleData@12                                        @1206 NONAME
     365    _ObjQueryHandleFlags@4                                      @1207 NONAME
    363366
    364367;
  • trunk/src/gdi32/gdi32.cpp

    r8343 r8871  
    1 /* $Id: gdi32.cpp,v 1.81 2002-04-30 13:09:55 sandervl Exp $ */
     1/* $Id: gdi32.cpp,v 1.82 2002-07-15 10:02:29 sandervl Exp $ */
    22
    33/*
     
    2626#include "font.h"
    2727#include <stats.h>
     28#include <objhandle.h>
    2829
    2930#define DBG_LOCALLOG    DBG_gdi32
     
    6061    {
    6162        case DEFAULT_GUI_FONT:
    62                 if(NULL==hFntDefaultGui)
    63                   hFntDefaultGui = CreateFontA( -9, 0, 0, 0, FW_MEDIUM, FALSE,
    64                                                 FALSE, FALSE, ANSI_CHARSET,
    65                                                 OUT_DEFAULT_PRECIS,
    66                                                 CLIP_DEFAULT_PRECIS,
    67                                                 DEFAULT_QUALITY,
    68                                                 FIXED_PITCH|FF_MODERN, "WarpSans");
     63                if(NULL==hFntDefaultGui) {
     64                    hFntDefaultGui = CreateFontA( -9, 0, 0, 0, FW_MEDIUM, FALSE,
     65                                                 FALSE, FALSE, ANSI_CHARSET,
     66                                                 OUT_DEFAULT_PRECIS,
     67                                                 CLIP_DEFAULT_PRECIS,
     68                                                 DEFAULT_QUALITY,
     69                                                 FIXED_PITCH|FF_MODERN, "WarpSans");
     70                    //This object can't be deleted by applications
     71                    ObjSetHandleFlag(hFntDefaultGui, OBJHANDLE_FLAG_NODELETE, TRUE);
     72                }
    6973                obj = hFntDefaultGui;
    7074                break;
  • trunk/src/gdi32/objhandle.cpp

    r8202 r8871  
    1 /* $Id: objhandle.cpp,v 1.21 2002-04-07 14:38:08 sandervl Exp $ */
     1/* $Id: objhandle.cpp,v 1.22 2002-07-15 10:02:29 sandervl Exp $ */
    22/*
    33 * Win32 Handle Management Code for OS/2
    44 *
    55 *
    6  * Copyright 2000 Sander van Leeuwen (sandervl@xs4all.nl)
    7  *
     6 * Copyright 2000-2002 Sander van Leeuwen (sandervl@xs4all.nl)
    87 *
    98 * TODO: The table should be dynamically increased when necessary
    109 *       This is just a quick and dirty implementation
     10 *
     11 *       System objects can't be deleted (TODO: any others?? (fonts?))!!!!)
    1112 *
    1213 * Project Odin Software License can be found in LICENSE.TXT
     
    3738
    3839typedef struct {
    39   ULONG      dwUserData;
    40   ObjectType type;
     40  DWORD      dwUserData;
     41  DWORD      dwGDI32Data;
     42  DWORD      dwFlags;
     43  DWORD      dwType;
    4144} GdiObject;
    4245
     
    4548static VMutex    objTableMutex;
    4649
    47 #ifdef DEBUG
    48 static DWORD GetObjectTypeNoDbg( HGDIOBJ hObj);
    49 #else
    50 #define GetObjectTypeNoDbg GetObjectType
    51 #endif
    52 
    53 //******************************************************************************
    54 //******************************************************************************
    55 BOOL WIN32API ObjAllocateHandle(HANDLE *hObject, DWORD dwUserData, ObjectType type)
     50//******************************************************************************
     51//******************************************************************************
     52BOOL WIN32API ObjAllocateHandle(HANDLE *hObject, DWORD dwUserData, DWORD dwType)
    5653{
    5754    objTableMutex.enter();
     
    6360        return FALSE;
    6461    }
    65     if(objHandleTable[0].type == 0) {
     62    if(objHandleTable[0].dwType == HNDL_NONE) {
    6663        //first handle can never be used
    67         objHandleTable[0].type       = GDIOBJ_INVALID;
     64        objHandleTable[0].dwType     = HNDL_INVALID;
    6865        objHandleTable[0].dwUserData = -1;
    6966    }
    70     *hObject  = lowestFreeIndex;
    71     *hObject |= MAKE_HANDLE(type);
    72     objHandleTable[lowestFreeIndex].dwUserData = dwUserData;
    73     objHandleTable[lowestFreeIndex].type       = type;
    74 
     67    *hObject = lowestFreeIndex;
     68    *hObject = MAKE_HANDLE(*hObject);
     69    objHandleTable[lowestFreeIndex].dwUserData  = dwUserData;
     70    objHandleTable[lowestFreeIndex].dwType      = dwType;
     71    objHandleTable[lowestFreeIndex].dwGDI32Data = 0;
     72    objHandleTable[lowestFreeIndex].dwFlags     = 0;
    7573    lowestFreeIndex = -1;
    7674
     
    8785//******************************************************************************
    8886//******************************************************************************
    89 void WIN32API ObjFreeHandle(HANDLE hObject)
     87BOOL WIN32API ObjDeleteHandle(HANDLE hObject, DWORD dwType)
    9088{
    9189    hObject &= OBJHANDLE_MAGIC_MASK;
    9290    if(hObject < MAX_OBJECT_HANDLES) {
    9391        objTableMutex.enter();
    94         objHandleTable[hObject].dwUserData = 0;
    95         objHandleTable[hObject].type = GDIOBJ_NONE;
    96         if(lowestFreeIndex == -1 || hObject < lowestFreeIndex)
    97             lowestFreeIndex = hObject;
    98 
     92        if(!(objHandleTable[hObject].dwFlags & OBJHANDLE_FLAG_NODELETE))
     93        {
     94            objHandleTable[hObject].dwUserData = 0;
     95            objHandleTable[hObject].dwType     = HNDL_NONE;
     96            if(lowestFreeIndex == -1 || hObject < lowestFreeIndex)
     97                lowestFreeIndex = hObject;
     98        }
     99        else {
     100            dprintf(("ObjDeleteHandle: unable to delete system object %x", MAKE_HANDLE(hObject)));
     101        }
    99102        objTableMutex.leave();
    100     }
    101 }
    102 //******************************************************************************
    103 //******************************************************************************
    104 DWORD WIN32API ObjGetHandleData(HANDLE hObject, ObjectType type)
    105 {
    106     hObject &= OBJHANDLE_MAGIC_MASK;
    107     if(hObject < MAX_OBJECT_HANDLES && type == objHandleTable[hObject].type) {
    108         return objHandleTable[hObject].dwUserData;
    109     }
    110     return HANDLE_OBJ_ERROR;
    111 }
    112 //******************************************************************************
    113 //******************************************************************************
    114 ObjectType WIN32API ObjGetHandleType(HANDLE hObject)
    115 {
    116  DWORD objtype;
    117 
    118     switch(OBJHANDLE_MAGIC(hObject))
    119     {
    120     case GDIOBJ_REGION:
    121         hObject &= OBJHANDLE_MAGIC_MASK;
    122         if(hObject < MAX_OBJECT_HANDLES && objHandleTable[hObject].type == GDIOBJ_REGION) {
    123             return GDIOBJ_REGION;
    124         }
    125         break;
    126 
    127     case USEROBJ_MENU:
    128         hObject &= OBJHANDLE_MAGIC_MASK;
    129         if(hObject < MAX_OBJECT_HANDLES && objHandleTable[hObject].type == USEROBJ_MENU) {
    130             return USEROBJ_MENU;
    131         }
    132         break;
    133 
    134     case GDIOBJ_NONE:
    135         //could be a cutoff menu handle, check this
    136         //TODO: dangerous assumption! (need to rewrite object handle management)
    137         hObject &= OBJHANDLE_MAGIC_MASK;
    138         if(hObject < MAX_OBJECT_HANDLES && objHandleTable[hObject].dwUserData != 0 && objHandleTable[hObject].type == USEROBJ_MENU) {
    139             return USEROBJ_MENU;
    140         }
    141         break;
    142 
    143     case GDIOBJ_BITMAP:
    144     case GDIOBJ_BRUSH:
    145     case GDIOBJ_PALETTE:
    146     case GDIOBJ_FONT:
    147     case USEROBJ_ACCEL:
    148     default:
    149         break;
    150     }
    151     return GDIOBJ_NONE;
     103        return TRUE;
     104    }
     105    return FALSE;
     106}
     107//******************************************************************************
     108//******************************************************************************
     109DWORD WIN32API ObjQueryHandleData(HANDLE hObject, DWORD dwType)
     110{
     111    DWORD dwUserData = HANDLE_INVALID_DATA;
     112
     113    objTableMutex.enter();
     114    hObject &= OBJHANDLE_MAGIC_MASK;
     115    if(hObject < MAX_OBJECT_HANDLES &&
     116       ((dwType == HNDL_ANY && objHandleTable[hObject].dwType != HNDL_NONE) ||
     117       dwType == objHandleTable[hObject].dwType))
     118    {
     119        dwUserData = objHandleTable[hObject].dwUserData;
     120    }
     121    objTableMutex.leave();
     122    return dwUserData;
     123}
     124//******************************************************************************
     125//******************************************************************************
     126BOOL WIN32API ObjSetHandleData(HANDLE hObject, DWORD dwType, DWORD dwUserData)
     127{
     128    BOOL fSuccess = FALSE;
     129
     130    objTableMutex.enter();
     131    hObject &= OBJHANDLE_MAGIC_MASK;
     132    if(hObject < MAX_OBJECT_HANDLES &&
     133       ((dwType == HNDL_ANY && objHandleTable[hObject].dwType != HNDL_NONE) ||
     134       dwType == objHandleTable[hObject].dwType))
     135    {
     136        objHandleTable[hObject].dwUserData = dwUserData;
     137        fSuccess = TRUE;
     138    }
     139    objTableMutex.leave();
     140    return fSuccess;
     141}
     142//******************************************************************************
     143//******************************************************************************
     144DWORD WIN32API ObjQueryHandleGDI32Data(HANDLE hObject, DWORD dwType)
     145{
     146    DWORD dwGDI32Data = HANDLE_INVALID_DATA;
     147
     148    objTableMutex.enter();
     149    hObject &= OBJHANDLE_MAGIC_MASK;
     150    if(hObject < MAX_OBJECT_HANDLES &&
     151       ((dwType == HNDL_ANY && objHandleTable[hObject].dwType != HNDL_NONE) ||
     152       dwType == objHandleTable[hObject].dwType))
     153    {
     154        dwGDI32Data = objHandleTable[hObject].dwGDI32Data;
     155    }
     156    objTableMutex.leave();
     157    return dwGDI32Data;
     158}
     159//******************************************************************************
     160//******************************************************************************
     161BOOL WIN32API ObjSetHandleGDI32Data(HANDLE hObject, DWORD dwType, DWORD dwGDI32Data)
     162{
     163    BOOL fSuccess = FALSE;
     164
     165    objTableMutex.enter();
     166    hObject &= OBJHANDLE_MAGIC_MASK;
     167    if(hObject < MAX_OBJECT_HANDLES &&
     168       ((dwType == HNDL_ANY && objHandleTable[hObject].dwType != HNDL_NONE) ||
     169       dwType == objHandleTable[hObject].dwType))
     170    {
     171        objHandleTable[hObject].dwGDI32Data = dwGDI32Data;
     172        fSuccess = TRUE;
     173    }
     174    objTableMutex.leave();
     175    return fSuccess;
     176}
     177//******************************************************************************
     178//******************************************************************************
     179DWORD WIN32API ObjQueryHandleFlags(OBJHANDLE hObject)
     180{
     181    DWORD dwFlags = HANDLE_INVALID_DATA;
     182
     183    objTableMutex.enter();
     184    hObject &= OBJHANDLE_MAGIC_MASK;
     185    if(hObject < MAX_OBJECT_HANDLES && objHandleTable[hObject].dwType != HNDL_NONE)
     186    {
     187        dwFlags = objHandleTable[hObject].dwFlags;
     188    }
     189    objTableMutex.leave();
     190    return dwFlags;
     191}
     192//******************************************************************************
     193//******************************************************************************
     194BOOL WIN32API ObjSetHandleFlag(HANDLE hObject, DWORD dwFlag, BOOL fSet)
     195{
     196    BOOL fSuccess = FALSE;
     197
     198    objTableMutex.enter();
     199    hObject &= OBJHANDLE_MAGIC_MASK;
     200    if(hObject < MAX_OBJECT_HANDLES && objHandleTable[hObject].dwType != HNDL_NONE) {
     201        if(fSet) {
     202             objHandleTable[hObject].dwFlags |= dwFlag;
     203        }
     204        else objHandleTable[hObject].dwFlags &= ~dwFlag;
     205
     206        dprintf(("ObjSetHandleFlag %x -> %x", MAKE_HANDLE(hObject), dwFlag));
     207
     208        fSuccess = TRUE;
     209    }
     210    objTableMutex.leave();
     211    return fSuccess;
     212}
     213//******************************************************************************
     214//******************************************************************************
     215DWORD WIN32API ObjQueryHandleType(HANDLE hObject)
     216{
     217    DWORD objtype = 0;
     218
     219    objTableMutex.enter();
     220    hObject &= OBJHANDLE_MAGIC_MASK;
     221    if(hObject < MAX_OBJECT_HANDLES && objHandleTable[hObject].dwType != HNDL_NONE) {
     222        objtype = objHandleTable[hObject].dwType;
     223    }
     224    objTableMutex.leave();
     225    return objtype;
    152226}
    153227//******************************************************************************
     
    155229int WIN32API GetObjectA( HGDIOBJ hObject, int size, void *lpBuffer)
    156230{
    157  int rc;
    158 
    159   dprintf(("GDI32: GetObject %X %X %X\n", hObject, size, lpBuffer));
    160   //TODO: must use 16 bits gdi object handles
    161   if(HIWORD(hObject) == 0) {
    162         hObject |= GDIOBJ_PREFIX;
    163   }
    164   if(lpBuffer == NULL)
    165   { //return required size if buffer pointer == NULL
    166     int objtype = GetObjectTypeNoDbg(hObject);
    167     switch(objtype)
    168     {
    169     case OBJ_PEN:
    170         return sizeof(LOGPEN);
    171 
    172     case OBJ_EXTPEN:
    173         return sizeof(EXTLOGPEN);
    174 
    175     case OBJ_BRUSH:
    176         return sizeof(LOGBRUSH);
    177 
    178     case OBJ_PAL:
    179         return sizeof(USHORT);
    180 
    181     case OBJ_FONT:
    182         return sizeof(LOGFONTA);
    183 
    184     case OBJ_BITMAP:
    185         return sizeof(BITMAP); //also default for dib sections??? (TODO: NEED TO CHECK THIS)
    186 
    187     case OBJ_DC:
    188     case OBJ_METADC:
    189     case OBJ_REGION:
    190     case OBJ_METAFILE:
    191     case OBJ_MEMDC:
    192     case OBJ_ENHMETADC:
    193     case OBJ_ENHMETAFILE:
    194         dprintf(("warning: GetObjectA not defined for object type %d", objtype));
    195         return 0;
    196     }
    197   }
    198   if(DIBSection::getSection() != NULL)
    199   {
     231    int rc;
     232
     233    dprintf(("GDI32: GetObject %X %X %X\n", hObject, size, lpBuffer));
     234   
     235    if(lpBuffer == NULL)
     236    { //return required size if buffer pointer == NULL
     237        int objtype = GetObjectType(hObject);
     238        switch(objtype)
     239        {
     240        case OBJ_PEN:
     241            return sizeof(LOGPEN);
     242   
     243        case OBJ_EXTPEN:
     244            return sizeof(EXTLOGPEN);
     245   
     246        case OBJ_BRUSH:
     247            return sizeof(LOGBRUSH);
     248   
     249        case OBJ_PAL:
     250            return sizeof(USHORT);
     251   
     252        case OBJ_FONT:
     253            return sizeof(LOGFONTA);
     254   
     255        case OBJ_BITMAP:
     256            return sizeof(BITMAP); //also default for dib sections??? (TODO: NEED TO CHECK THIS)
     257   
     258        case OBJ_DC:
     259        case OBJ_METADC:
     260        case OBJ_REGION:
     261        case OBJ_METAFILE:
     262        case OBJ_MEMDC:
     263        case OBJ_ENHMETADC:
     264        case OBJ_ENHMETAFILE:
     265            dprintf(("warning: GetObjectA not defined for object type %d", objtype));
     266            return 0;
     267        }
     268    }
     269    if(DIBSection::getSection() != NULL)
     270    {
    200271        DIBSection *dsect = DIBSection::findObj(hObject);
    201272        if(dsect)
    202273        {
    203                 rc = dsect->GetDIBSection(size, lpBuffer);
    204                 if(rc == 0) {
    205                         SetLastError(ERROR_INVALID_PARAMETER);
    206                         return 0;
    207                 }
    208                 SetLastError(ERROR_SUCCESS);
    209                 return rc;
    210         }
    211   }
    212 
    213   return O32_GetObject(hObject, size, lpBuffer);
     274            rc = dsect->GetDIBSection(size, lpBuffer);
     275            if(rc == 0) {
     276                SetLastError(ERROR_INVALID_PARAMETER);
     277                return 0;
     278            }
     279            SetLastError(ERROR_SUCCESS);
     280            return rc;
     281        }
     282    }
     283
     284    return O32_GetObject(hObject, size, lpBuffer);
    214285}
    215286//******************************************************************************
     
    217288int WIN32API GetObjectW( HGDIOBJ hObject, int size, void *lpBuffer)
    218289{
    219  int ret, objtype;
    220 
    221   dprintf(("GDI32: GetObjectW %X, %d %X", hObject, size, lpBuffer));
    222 
    223   //TODO: must use 16 bits gdi object handles
    224   if(HIWORD(hObject) == 0) {
    225         hObject |= GDIOBJ_PREFIX;
    226   }
    227   objtype = GetObjectTypeNoDbg(hObject);
    228 
    229   switch(objtype)
    230   {
    231   case OBJ_FONT:
    232   {
    233     LOGFONTA logfonta;
     290    int ret, objtype;
     291
     292    dprintf(("GDI32: GetObjectW %X, %d %X", hObject, size, lpBuffer));
     293
     294    objtype = GetObjectType(hObject);
     295
     296    switch(objtype)
     297    {
     298    case OBJ_FONT:
     299    {
     300        LOGFONTA logfonta;
    234301
    235302        if(lpBuffer == NULL) {
     
    252319        }
    253320        return 0;
    254   }
    255   default:
    256       return GetObjectA(hObject, size, lpBuffer);
    257   }
     321    }
     322    default:
     323        return GetObjectA(hObject, size, lpBuffer);
     324    }
    258325}
    259326//******************************************************************************
     
    289356HGDIOBJ WIN32API SelectObject(HDC hdc, HGDIOBJ hObj)
    290357{
    291  HGDIOBJ rc;
    292  DWORD   handleType;
     358    HGDIOBJ rc;
     359    DWORD   handleType;
    293360
    294361    //TODO: must use 16 bits gdi object handles
     
    297364    }
    298365
    299     handleType = GetObjectTypeNoDbg(hObj);
     366    handleType = GetObjectType(hObj);
    300367    dprintf2(("GDI32: SelectObject %x %x type %s", hdc, hObj, DbgGetGDITypeName(handleType)));
    301     if(handleType == GDIOBJ_REGION) {
     368    if(handleType == HNDL_REGION) {
    302369        //Return complexity here; not previously selected clip region
    303370        return (HGDIOBJ)SelectClipRgn(hdc, hObj);
     
    321388    }
    322389    rc = O32_SelectObject(hdc, hObj);
    323     if(rc != 0 && GetObjectTypeNoDbg(rc) == OBJ_BITMAP && DIBSection::getSection != NULL)
     390    if(rc != 0 && GetObjectType(rc) == OBJ_BITMAP && DIBSection::getSection != NULL)
    324391    {
    325392        DIBSection *dsect = DIBSection::findObj(rc);
     
    329396        }
    330397    }
    331 #ifdef USING_OPEN32
    332     if(handleType == OBJ_BITMAP)
    333     {
    334         //SvL: Open32 messes up the height of the hdc (for windows)
    335         pDCData  pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
    336         if(pHps && pHps->hwnd) {
    337               dprintf2(("change back origin"));
    338               selectClientArea(pHps);
    339               setPageXForm(pHps);
    340         }
    341     }
    342 #endif
    343398    dprintf2(("GDI32: SelectObject %x %x returned %x", hdc, hObj, rc));
    344399
     
    361416//******************************************************************************
    362417//******************************************************************************
    363 #ifdef DEBUG
    364 static DWORD GetObjectTypeNoDbg( HGDIOBJ hObj)
     418DWORD WIN32API GetObjectType( HGDIOBJ hObj)
     419{
     420    DWORD objtype = ObjQueryHandleType(hObj);
     421
     422    switch(objtype) {
     423    case HNDL_PEN:
     424        objtype = OBJ_PEN;
     425        break;
     426    case HNDL_BRUSH:
     427        objtype = OBJ_BRUSH;
     428        break;
     429    case HNDL_DC:
     430        objtype = OBJ_DC;
     431        break;
     432    case HNDL_METADC:
     433        objtype = OBJ_METADC;
     434        break;
     435    case HNDL_PALETTE:
     436        objtype = OBJ_PAL;
     437        break;
     438    case HNDL_FONT:
     439        objtype = OBJ_FONT;
     440        break;
     441    case HNDL_BITMAP:
     442    case HNDL_DIBSECTION:
     443        objtype = OBJ_BITMAP;
     444        break;
     445    case HNDL_REGION:
     446        objtype = OBJ_REGION;
     447        break;
     448    case HNDL_METAFILE:
     449        objtype = OBJ_METAFILE;
     450        break;
     451    case HNDL_ENHMETAFILE:
     452        objtype = OBJ_ENHMETAFILE;
     453        break;
     454    case HNDL_MEMDC:
     455        objtype = OBJ_MEMDC;
     456        break;
     457    case HNDL_EXTPEN:
     458        objtype = OBJ_EXTPEN;
     459        break;
     460    case HNDL_ENHMETADC:
     461        objtype = OBJ_ENHMETADC;
     462        break;
     463    default:
     464        objtype = 0;
     465        break;
     466    }
     467    dprintf2(("GDI32: GetObjectType %x objtype %d (%s)", hObj, objtype, DbgGetGDITypeName(objtype)));
     468    return objtype;
     469}
     470//******************************************************************************
     471//TODO: System objects can't be deleted (TODO: any others?? (fonts?))!!!!)
     472//******************************************************************************
     473BOOL WIN32API DeleteObject(HANDLE hObj)
    365474{
    366475    DWORD objtype;
    367476
    368     //TODO: must use 16 bits gdi object handles
    369     if(HIWORD(hObj) == 0) {
    370         hObj |= GDIOBJ_PREFIX;
    371     }
    372     if(ObjGetHandleType(hObj) == GDIOBJ_REGION) {
    373         dprintf2(("GDI32: GetObjectType %x REGION", hObj));
    374         SetLastError(ERROR_SUCCESS);
    375         return OBJ_REGION;
    376     }
    377     return O32_GetObjectType(hObj);
    378 }
    379 #endif
    380 //******************************************************************************
    381 //******************************************************************************
    382 DWORD WIN32API GetObjectType( HGDIOBJ hObj)
    383 {
    384     DWORD objtype;
    385 
    386     //TODO: must use 16 bits gdi object handles
    387     if(HIWORD(hObj) == 0) {
    388         hObj |= GDIOBJ_PREFIX;
    389     }
    390     if(ObjGetHandleType(hObj) == GDIOBJ_REGION) {
    391         dprintf2(("GDI32: GetObjectType %x REGION", hObj));
    392         SetLastError(ERROR_SUCCESS);
    393         return OBJ_REGION;
    394     }
    395     objtype = O32_GetObjectType(hObj);
    396     dprintf2(("GDI32: GetObjectType %x objtype %d", hObj, objtype));
    397     return objtype;
    398 }
    399 //******************************************************************************
    400 //TODO: System objects can't be deleted (TODO: any others?? (fonts?))!!!!)
    401 //******************************************************************************
    402 BOOL WIN32API DeleteObject(HANDLE hObj)
    403 {
    404     DWORD objtype;
    405 
    406477    dprintf(("GDI32: DeleteObject %x", hObj));
    407478
    408     //TODO: must use 16 bits gdi object handles
    409     if(HIWORD(hObj) == 0)
    410     {
    411         hObj |= GDIOBJ_PREFIX;
    412     }
    413 
    414     //System objects can't be deleted (TODO: any others?? (fonts?))!!!!)
    415     objtype = GetObjectTypeNoDbg(hObj);
    416     switch (objtype)
    417     {
    418         case OBJ_PEN:
    419             if(IsSystemPen(hObj))
    420             {
    421                 SetLastError(ERROR_SUCCESS);
    422                 return TRUE;
    423             }
    424             else
    425                 break;
    426 
    427         case OBJ_BRUSH:
    428             if(IsSystemBrush(hObj))
    429             {
    430                 SetLastError(ERROR_SUCCESS);
    431                 return TRUE;
    432             }
    433             else
    434                 break;
    435 
    436         case OBJ_FONT:
    437             if(IsSystemFont(hObj))
    438             {
    439                 SetLastError(ERROR_SUCCESS);
    440                 return TRUE;
    441             }
    442             else
    443                 break;
    444            
    445         // add more system-type objects as required ...
    446     }
    447 
    448479    STATS_DeleteObject(hObj, objtype);
    449480
    450     if(ObjGetHandleType(hObj) == GDIOBJ_REGION)
    451     {
    452         OSLibDeleteRegion(ObjGetHandleData(hObj, GDIOBJ_REGION));
    453         ObjFreeHandle(hObj);
     481    if(ObjQueryHandleType(hObj) == HNDL_REGION)
     482    {
     483        OSLibDeleteRegion(ObjQueryHandleData(hObj, HNDL_REGION));
     484        ObjDeleteHandle(hObj, HNDL_REGION);
    454485        SetLastError(ERROR_SUCCESS);
    455486        return TRUE;
  • trunk/src/gdi32/region.cpp

    r7800 r8871  
    1 /* $Id: region.cpp,v 1.27 2002-02-05 11:45:46 sandervl Exp $ */
     1/* $Id: region.cpp,v 1.28 2002-07-15 10:02:29 sandervl Exp $ */
    22
    33/*
     
    396396    if(hrgn)
    397397    {
    398         hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     398        hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    399399        if(hrgn == HANDLE_OBJ_ERROR) {
    400400            dprintf(("WARNING: SelectClipRgn: invalid region!", hdc, hrgn1));
     
    488488   if(hrgn)
    489489   {
    490         hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     490        hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    491491        if(hrgn == HANDLE_OBJ_ERROR) {
    492492            dprintf(("WARNING: ExtSelectRgn %x %x %d invalid region handle", hdc, hrgn1, mode));
     
    637637#endif
    638638
    639     hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     639    hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    640640    if(hrgn == HANDLE_OBJ_ERROR || !pHps) {
    641641        dprintf(("WARNING: GetClipRgn %x %x invalid handle", hdc, hrgn1));
     
    832832   }
    833833
    834    if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
     834   if(ObjAllocateHandle(&hrgn, hrgn, HNDL_REGION) == FALSE) {
    835835        GpiDestroyRegion(hpsRegion, hrgn);
    836836        SetLastError(ERROR_OUTOFMEMORY_W);
     
    856856   }
    857857
    858    if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
     858   if(ObjAllocateHandle(&hrgn, hrgn, HNDL_REGION) == FALSE) {
    859859        GpiDestroyRegion(hpsRegion, hrgn);
    860860        SetLastError(ERROR_OUTOFMEMORY_W);
     
    891891   }
    892892
    893    if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
     893   if(ObjAllocateHandle(&hrgn, hrgn, HNDL_REGION) == FALSE) {
    894894        GpiDestroyRegion(hpsRegion, hrgn);
    895895        SetLastError(ERROR_OUTOFMEMORY_W);
     
    10041004    }
    10051005
    1006     if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
     1006    if(ObjAllocateHandle(&hrgn, hrgn, HNDL_REGION) == FALSE) {
    10071007        GpiDestroyRegion(hpsRegion, hrgn);
    10081008        SetLastError(ERROR_OUTOFMEMORY_W);
     
    10271027    hrgn = GpiCreateEllipticRegion(hpsRegion, &rectl);
    10281028
    1029     if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
     1029    if(ObjAllocateHandle(&hrgn, hrgn, HNDL_REGION) == FALSE) {
    10301030        GpiDestroyRegion(hpsRegion, hrgn);
    10311031        SetLastError(ERROR_OUTOFMEMORY_W);
     
    10771077    hrgn = GpiCreatePolygonRegion(hpsRegion, 1, &polygon, POLYGON_BOUNDARY | flMode);
    10781078
    1079     if(ObjAllocateHandle(&hrgn, hrgn, GDIOBJ_REGION) == FALSE) {
     1079    if(ObjAllocateHandle(&hrgn, hrgn, HNDL_REGION) == FALSE) {
    10801080        GpiDestroyRegion(hpsRegion, hrgn);
    10811081        SetLastError(ERROR_OUTOFMEMORY_W);
     
    11201120    }
    11211121
    1122     hrgnDest = ObjGetHandleData(hrgnDest, GDIOBJ_REGION);
    1123     hrgnSrc1 = ObjGetHandleData(hrgnSrc1, GDIOBJ_REGION);
    1124     hrgnSrc2 = ObjGetHandleData(hrgnSrc2, GDIOBJ_REGION);
     1122    hrgnDest = ObjQueryHandleData(hrgnDest, HNDL_REGION);
     1123    hrgnSrc1 = ObjQueryHandleData(hrgnSrc1, HNDL_REGION);
     1124    hrgnSrc2 = ObjQueryHandleData(hrgnSrc2, HNDL_REGION);
    11251125    if(hrgnDest == HANDLE_OBJ_ERROR || hrgnSrc1 == HANDLE_OBJ_ERROR  || (hrgnSrc2 == HANDLE_OBJ_ERROR && combineMode != RGN_COPY_W)) {
    11261126        dprintf(("WARNING: CombineRgn %x %x %x %d invalid region", hrgn1, hrgn2, hrgn3, combineMode));
     
    11491149#endif
    11501150
    1151    hrgn1 = ObjGetHandleData(hrgn1, GDIOBJ_REGION);
    1152    hrgn2 = ObjGetHandleData(hrgn2, GDIOBJ_REGION);
     1151   hrgn1 = ObjQueryHandleData(hrgn1, HNDL_REGION);
     1152   hrgn2 = ObjQueryHandleData(hrgn2, HNDL_REGION);
    11531153   if(hrgn1 == HANDLE_OBJ_ERROR || hrgn2 == HANDLE_OBJ_ERROR) {
    11541154        dprintf(("WARNING: EqualRgn %x %x invalid region", hrgnt1, hrgnt2));
     
    11791179#endif
    11801180
    1181     hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     1181    hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    11821182    if(hrgn == HANDLE_OBJ_ERROR) {
    11831183        dprintf(("WARNING: SetRectRgn %x (%d,%d)(%d,%d) invalid region handle", hrgn1, left, top, right, bottom));
     
    12081208        return 0;
    12091209    }
    1210     hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     1210    hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    12111211    if(hrgn == HANDLE_OBJ_ERROR) {
    12121212        dprintf(("WARNING: GetRegionData %x %d %x; invalid region handle", hrgn1, count, pData));
     
    12691269#endif
    12701270
    1271     hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     1271    hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    12721272    if(hrgn == HANDLE_OBJ_ERROR) {
    12731273        dprintf(("WARNING: GetRgnBox %x %x invalid region!", hrgn1, pRect));
     
    13051305    pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
    13061306
    1307     hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     1307    hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    13081308    if(!pHps || hrgn == HANDLE_OBJ_ERROR) {
    13091309        dprintf(("WARNING: InvertRgn %x %x invalid handle!", hdc, hrgn));
     
    13561356#endif
    13571357
    1358     hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     1358    hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    13591359    if(hrgn == HANDLE_OBJ_ERROR) {
    13601360        dprintf(("WARNING: OffsetRgn %x %d %d invalid handle!", hrgn, xOffset, yOffset));
     
    14051405    pDCData  pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
    14061406
    1407     hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     1407    hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    14081408    if(!pHps || hrgn == HANDLE_OBJ_ERROR) {
    14091409        dprintf(("WARNING: FrameRgn %x %x %x (%d,%d) invalid handle!", hdc, hrgn, hBrush, width, height));
     
    14521452    pDCData  pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
    14531453
    1454     hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     1454    hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    14551455    if(!pHps || hrgn == HANDLE_OBJ_ERROR) {
    14561456        dprintf(("WARNING: FillRgn %x %x %x invalid handle!", hdc, hrgn1, hBrush));
     
    15061506#endif
    15071507
    1508     hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     1508    hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    15091509    if(hrgn == HANDLE_OBJ_ERROR) {
    15101510        dprintf(("WARNING: PtInRgn %x (%d,%d) invalid region!", hrgn1, x, y));
     
    15441544        return FALSE;
    15451545    }
    1546     hrgn = ObjGetHandleData(hrgn, GDIOBJ_REGION);
     1546    hrgn = ObjQueryHandleData(hrgn, HNDL_REGION);
    15471547    if(hrgn == HANDLE_OBJ_ERROR) {
    15481548        dprintf(("WARNING: RectInRgn %x %x invalid region", hrgn1, pRect));
     
    15951595
    15961596    hrgnwin = CreateRectRgn(1, 1, 2, 2);
    1597     hrgn = ObjGetHandleData(hrgnwin, GDIOBJ_REGION);
     1597    hrgn = ObjQueryHandleData(hrgnwin, HNDL_REGION);
    15981598    if(hrgn == HANDLE_OBJ_ERROR) {
    15991599        dprintf(("WARNING: PathToRegion invalid region", hrgnwin));
  • trunk/src/gdi32/rgbcvt.h

    r4034 r8871  
    1 //$Id: rgbcvt.h,v 1.2 2000-08-18 18:14:58 sandervl Exp $
     1//$Id: rgbcvt.h,v 1.3 2002-07-15 10:02:30 sandervl Exp $
    22#ifndef __RGBCVT_H__
    33#define __RGBCVT_H__
     4
     5#define RGB555_RED_MASK           0x7c00
     6#define RGB555_GREEN_MASK         0x03e0
     7#define RGB555_BLUE_MASK          0x001f
     8
     9#define RGB565_RED_MASK           0xF800
     10#define RGB565_GREEN_MASK         0x07e0
     11#define RGB565_BLUE_MASK          0x001f
     12
     13//Default 16 bpp = RGB555
     14#define DEFAULT_16BPP_RED_MASK    RGB555_RED_MASK
     15#define DEFAULT_16BPP_GREEN_MASK  RGB555_GREEN_MASK
     16#define DEFAULT_16BPP_BLUE_MASK   RGB555_BLUE_MASK
     17
     18//Default 24/32 bpp = RGB888
     19#define DEFAULT_24BPP_RED_MASK    0xff0000
     20#define DEFAULT_24BPP_GREEN_MASK  0x00ff00
     21#define DEFAULT_24BPP_BLUE_MASK   0x0000ff
     22
     23#define DEFAULT_32BPP_RED_MASK    DEFAULT_24BPP_RED_MASK
     24#define DEFAULT_32BPP_GREEN_MASK  DEFAULT_24BPP_GREEN_MASK
     25#define DEFAULT_32BPP_BLUE_MASK   DEFAULT_24BPP_BLUE_MASK
     26
    427
    528void _Optlink RGB555to565(WORD *dest, WORD *src, ULONG num);
Note: See TracChangeset for help on using the changeset viewer.