Ignore:
Timestamp:
Aug 27, 2002, 10:31:48 AM (23 years ago)
Author:
sandervl
Message:

wine resync; fixed 16 bits handle bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/msvfw32/drawdib.c

    r7511 r9140  
    1 /* 
     1/*
    22 * Copyright 2000 Bradley Baetz
    33 *
    4  * Fixme: Some flags are ignored
     4 * This library is free software; you can redistribute it and/or
     5 * modify it under the terms of the GNU Lesser General Public
     6 * License as published by the Free Software Foundation; either
     7 * version 2.1 of the License, or (at your option) any later version.
     8 *
     9 * This library is distributed in the hope that it will be useful,
     10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12 * Lesser General Public License for more details.
     13 *
     14 * You should have received a copy of the GNU Lesser General Public
     15 * License along with this library; if not, write to the Free Software
     16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     17 *
     18 * FIXME: Some flags are ignored
    519 *
    620 * Handle palettes
     
    1327#include "winuser.h"
    1428#include "wine/winbase16.h"
    15 #include "debugtools.h"
     29#include "wine/debug.h"
    1630#include "vfw.h"
    1731#include "vfw16.h"
    1832#include "windef.h"
    1933
    20 DEFAULT_DEBUG_CHANNEL(msvideo);
     34WINE_DEFAULT_DEBUG_CHANNEL(msvideo);
    2135
    2236typedef struct {
     
    3751} WINE_HDD;
    3852
    39 #ifdef __WIN32OS2__
    40 #include <heapstring.h>
    41 
    42 #define GlobalAlloc16 GlobalAlloc
    43 #define GlobalLock16 GlobalLock
    44 #define GlobalUnlock16 GlobalUnlock
    45 #define GlobalFree16 GlobalFree
    46 
    47 #endif
     53int num_colours(LPBITMAPINFOHEADER lpbi)
     54{
     55        if(lpbi->biClrUsed)
     56                return lpbi->biClrUsed;
     57        if(lpbi->biBitCount<=8)
     58                return 1<<lpbi->biBitCount;
     59        return 0;
     60}
    4861
    4962/***********************************************************************
     
    6073
    6174/***********************************************************************
    62  *              DrawDibOpen             [MSVIDEO.102]
    63  */
    64 HDRAWDIB16 VFWAPI DrawDibOpen16(void) {
    65         return (HDRAWDIB16)DrawDibOpen();
    66 }
    67 
    68 /***********************************************************************
    6975 *              DrawDibClose            [MSVFW32.@]
    7076 */
     
    8389        GlobalFree16(hdd);
    8490        return TRUE;
    85 }
    86 
    87 /***********************************************************************
    88  *              DrawDibClose            [MSVIDEO.103]
    89  */
    90 BOOL16 VFWAPI DrawDibClose16(HDRAWDIB16 hdd) {
    91         return DrawDibClose(hdd);
    9291}
    9392
     
    9897        BOOL ret = TRUE;
    9998        WINE_HDD *whdd = GlobalLock16(hdd);
    100        
     99
    101100        TRACE("(0x%08lx)\n",(DWORD)hdd);
    102101
     
    124123        if (whdd->hDib)
    125124                DeleteObject(whdd->hDib);
    126        
     125
    127126        if (whdd->hic) {
    128127                ICDecompressEnd(whdd->hic);
     
    134133        GlobalUnlock16(hdd);
    135134        return ret;
    136 }
    137 
    138 /***********************************************************************
    139  *              DrawDibEnd              [MSVIDEO.105]
    140  */
    141 BOOL16 VFWAPI DrawDibEnd16(HDRAWDIB16 hdd) {
    142         return DrawDibEnd(hdd);
    143135}
    144136
     
    161153        );
    162154        TRACE("lpbi: %ld,%ld/%ld,%d,%d,%ld,%ld,%ld,%ld,%ld,%ld\n",
    163                   lpbi->biSize, lpbi->biWidth, lpbi->biHeight, lpbi->biPlanes, 
    164                   lpbi->biBitCount, lpbi->biCompression, lpbi->biSizeImage, 
    165                   lpbi->biXPelsPerMeter, lpbi->biYPelsPerMeter, lpbi->biClrUsed, 
     155                  lpbi->biSize, lpbi->biWidth, lpbi->biHeight, lpbi->biPlanes,
     156                  lpbi->biBitCount, lpbi->biCompression, lpbi->biSizeImage,
     157                  lpbi->biXPelsPerMeter, lpbi->biYPelsPerMeter, lpbi->biClrUsed,
    166158                  lpbi->biClrImportant);
    167159
     
    212204                /* No compression */
    213205                TRACE("Not compressed!\n");
    214                 dwSize = lpbi->biSize + lpbi->biClrUsed*sizeof(RGBQUAD);
     206                dwSize = lpbi->biSize + num_colours(lpbi)*sizeof(RGBQUAD);
    215207                whdd->lpbiOut = HeapAlloc(GetProcessHeap(),0,dwSize);
    216208                memcpy(whdd->lpbiOut,lpbi,dwSize);
     
    219211        if (ret) {
    220212                /*whdd->lpvbuf = HeapAlloc(GetProcessHeap(),0,whdd->lpbiOut->biSizeImage);*/
    221                
     213
    222214                whdd->hMemDC = CreateCompatibleDC(hdc);
    223215                TRACE("Creating: %ld,%p\n",whdd->lpbiOut->biSize,whdd->lpvbits);
     
    254246}
    255247
    256 /************************************************************************
    257  *              DrawDibBegin            [MSVIDEO.104]
    258  */
    259 BOOL16 VFWAPI DrawDibBegin16(HDRAWDIB16 hdd,
    260                                                    HDC16      hdc,
    261                                                    INT16      dxDst,
    262                                                    INT16      dyDst,
    263                                                    LPBITMAPINFOHEADER lpbi,
    264                                                    INT16      dxSrc,
    265                                                    INT16      dySrc,
    266                                                    UINT16     wFlags) {
    267         return DrawDibBegin(hdd,hdc,dxDst,dyDst,lpbi,dxSrc,dySrc,wFlags);
    268 }
    269 
    270248/**********************************************************************
    271249 *              DrawDibDraw             [MSVFW32.@]
     
    285263        );
    286264
    287         if (wFlags & ~(DDF_SAME_HDC | DDF_SAME_DRAW | DDF_NOTKEYFRAME | 
     265        if (wFlags & ~(DDF_SAME_HDC | DDF_SAME_DRAW | DDF_NOTKEYFRAME |
    288266                                   DDF_UPDATE | DDF_DONTDRAW))
    289267                FIXME("wFlags == 0x%08lx not handled\n",(DWORD)wFlags);
     
    291269        if (!lpBits) {
    292270                /* Undocumented? */
    293                 lpBits = (LPSTR)lpbi + (WORD)(lpbi->biSize) + (WORD)(lpbi->biClrUsed*sizeof(RGBQUAD));
     271                lpBits = (LPSTR)lpbi + (WORD)(lpbi->biSize) + (WORD)(num_colours(lpbi)*sizeof(RGBQUAD));
    294272        }
    295273
     
    318296                if (lpbi->biCompression) {
    319297                    DWORD flags = 0;
    320                
     298
    321299                        TRACE("Compression == 0x%08lx\n",lpbi->biCompression);
    322                
     300
    323301                        if (wFlags & DDF_NOTKEYFRAME)
    324302                            flags |= ICDECOMPRESS_NOTKEYFRAME;
    325                
     303
    326304                        ICDecompress(whdd->hic,flags,lpbi,lpBits,whdd->lpbiOut,whdd->lpvbits);
    327305                } else {
    328306                    memcpy(whdd->lpvbits,lpBits,lpbi->biSizeImage);
    329                 }       
     307                }
    330308        }
    331309        if (!(wFlags & DDF_DONTDRAW) && whdd->hpal)
     
    337315        GlobalUnlock16(hdd);
    338316        return ret;
    339 }
    340 
    341 /**********************************************************************
    342  *              DrawDibDraw             [MSVIDEO.106]
    343  */
    344 BOOL16 VFWAPI DrawDibDraw16(HDRAWDIB16 hdd,             
    345                                                   HDC16 hdc,
    346                                                   INT16 xDst,
    347                                                   INT16 yDst,
    348                                                   INT16 dxDst,
    349                                                   INT16 dyDst,
    350                                                   LPBITMAPINFOHEADER lpbi,
    351                                                   LPVOID lpBits,
    352                                                   INT16 xSrc,
    353                                                   INT16 ySrc,
    354                                                   INT16 dxSrc,
    355                                                   INT16 dySrc,
    356                                                   UINT16 wFlags) {
    357         return DrawDibDraw(hdd,hdc,xDst,yDst,dxDst,dyDst,lpbi,lpBits,xSrc,ySrc,dxSrc,dySrc,wFlags);
    358317}
    359318
     
    367326
    368327/*************************************************************************
    369  *              DrawDibStart            [MSVIDEO.118]
    370  */
    371 BOOL16 VFWAPI DrawDibStart16(HDRAWDIB16 hdd, DWORD rate) {
    372         return DrawDibStart(hdd,rate);
    373 }
    374 
    375 /*************************************************************************
    376328 *              DrawDibStop             [MSVFW32.@]
    377329 */
     
    381333}
    382334
    383 /*************************************************************************
    384  *              DrawDibStop             [MSVIDEO.119]
    385  */
    386 BOOL16 DrawDibStop16(HDRAWDIB16 hdd) {
    387         return DrawDibStop(hdd);
    388 }
    389 
    390335/***********************************************************************
    391336 *              DrawDibSetPalette       [MSVFW32.@]
     
    398343        whdd = GlobalLock16(hdd);
    399344        whdd->hpal = hpal;
    400        
     345
    401346        if (whdd->begun) {
    402347                SelectPalette(whdd->hdc,hpal,0);
     
    408353
    409354/***********************************************************************
    410  *              DrawDibSetPalette       [MSVIDEO.110]
    411  */
    412 BOOL16 VFWAPI DrawDibSetPalette16(HDRAWDIB16 hdd, HPALETTE16 hpal) {
    413         return DrawDibSetPalette(hdd,hpal);
    414 }
    415 
    416 /***********************************************************************
    417355 *              DrawDibGetPalette       [MSVFW32.@]
    418356 */
     
    430368
    431369/***********************************************************************
    432  *              DrawDibGetPalette       [MSVIDEO.108]
    433  */
    434 HPALETTE16 VFWAPI DrawDibGetPalette16(HDRAWDIB16 hdd) {
    435         return (HPALETTE16)DrawDibGetPalette(hdd);
    436 }
    437 
    438 /***********************************************************************
    439370 *              DrawDibRealize          [MSVFW32.@]
    440371 */
     
    445376
    446377        FIXME("(%d,0x%08lx,%d), stub\n",hdd,(DWORD)hdc,fBackground);
    447        
     378
    448379        whdd = GlobalLock16(hdd);
    449380
     
    452383                goto out;
    453384        }
    454        
     385
    455386        if (!whdd->hpal)
    456387                whdd->hpal = CreateHalftonePalette(hdc);
     
    458389        oldPal = SelectPalette(hdc,whdd->hpal,fBackground);
    459390        ret = RealizePalette(hdc);
    460        
     391
    461392 out:
    462393        GlobalUnlock16(hdd);
     
    465396        return ret;
    466397}
    467 
    468 /***********************************************************************
    469  *              DrawDibRealize          [MSVIDEO.112]
    470  */
    471 UINT16 VFWAPI DrawDibRealize16(HDRAWDIB16 hdd, HDC16 hdc, BOOL16 fBackground) {
    472         return (UINT16)DrawDibRealize(hdd,hdc,fBackground);
    473 }
Note: See TracChangeset for help on using the changeset viewer.