Ignore:
Timestamp:
Jan 18, 2001, 7:13:18 PM (25 years ago)
Author:
sandervl
Message:

SetDIBitsToDevice fix + more logging

File:
1 edited

Legend:

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

    r4676 r4963  
    1 /* $Id: blit.cpp,v 1.21 2000-11-22 21:03:53 sandervl Exp $ */
     1/* $Id: blit.cpp,v 1.22 2001-01-18 18:13:17 sandervl Exp $ */
    22
    33/*
     
    9898    INT result, imgsize, palsize, height, width;
    9999    char *ptr;
    100     ULONG compression = 0, iHeight, bmpsize;
     100    ULONG compression = 0, bmpsize;
    101101    WORD *newbits = 0;
    102102
     
    172172    }
    173173
    174     iHeight = info->bmiHeader.biHeight;
    175     if(info->bmiHeader.biHeight < 0) {
    176         ((BITMAPINFO *)info)->bmiHeader.biHeight = -info->bmiHeader.biHeight;
    177     }
    178     result = O32_SetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (PBITMAPINFO)info, coloruse);
    179     //SvL: Wrong Open32 return value
    180 //    result = (result == TRUE) ? lines : 0;
    181     result = (result == TRUE) ? cy : 0;
    182 
     174    result = O32_StretchDIBits(hdc, xDest, yDest, cx, cy, xSrc, ySrc,
     175                             info->bmiHeader.biWidth, info->bmiHeader.biHeight, (void *)bits,
     176                             (PBITMAPINFO)info, coloruse, SRCCOPY);
     177
     178    //Open32 always returns height of bitmap (regardless of how many scanlines were copied)
     179    if(result != info->bmiHeader.biHeight) {
     180        dprintf(("SetDIBitsToDevice failed with rc %x", result));
     181    }
     182    else
     183    {
     184        result = info->bmiHeader.biHeight;
     185
     186        DIBSection *destdib = DIBSection::findHDC(hdc);
     187        if(destdib) {
     188                if(cx == info->bmiHeader.biWidth && cy == info->bmiHeader.biHeight &&
     189                   destdib->GetBitCount() == info->bmiHeader.biBitCount &&
     190                   destdib->GetBitCount() == 8)
     191                {
     192                        destdib->sync(xDest, yDest, cx, cy, (PVOID)bits);
     193                }
     194                else    destdib->sync(hdc, yDest, cy);
     195        }
     196    }
    183197    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 returned %d",
    184198                 hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (LPVOID) bits, (PBITMAPINFO)info, coloruse, result));
     
    189203        if(newbits) free(newbits);
    190204    }
    191     ((BITMAPINFO *)info)->bmiHeader.biHeight = iHeight;
    192205    ((BITMAPINFO *)info)->bmiHeader.biSizeImage = bmpsize;
    193206    return result;
Note: See TracChangeset for help on using the changeset viewer.