Ignore:
Timestamp:
Jan 1, 2003, 5:32:07 PM (23 years ago)
Author:
sandervl
Message:

Cleaned up SetDIBitsToDevice

File:
1 edited

Legend:

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

    r9558 r9576  
    1 /* $Id: blit.cpp,v 1.42 2002-12-28 14:01:37 sandervl Exp $ */
     1/* $Id: blit.cpp,v 1.43 2003-01-01 16:32:07 sandervl Exp $ */
    22
    33/*
     
    1515#include <string.h>
    1616#include <cpuhlp.h>
    17 #include "misc.h"
     17#include <winuser32.h>
     18#include <dbglog.h>
    1819#include "dibsect.h"
    1920#include "rgbcvt.h"
     
    250251    char *newBits = NULL;
    251252
     253    if(startscan != 0 || lines != abs(info->bmiHeader.biHeight)) {
     254        dprintf(("WARNING: SetDIBitsToDevice: startscan != 0 || lines != abs(info->bmiHeader.biHeight"));
     255    }
     256
    252257    //If upside down, reverse scanlines and call SetDIBitsToDevice again
    253258//    if(info->bmiHeader.biHeight < 0 && info->bmiHeader.biBitCount != 8 && info->bmiHeader.biCompression == 0) {
     
    257262        // upside down
    258263        INT rc = -1;
    259         BITMAPINFO newInfo;
    260         newInfo.bmiHeader = info->bmiHeader;
    261         long lLineByte = ((newInfo.bmiHeader.biWidth * (info->bmiHeader.biBitCount == 15 ? 16 : info->bmiHeader.biBitCount) + 31) / 32) * 4;
    262         long lHeight   = -newInfo.bmiHeader.biHeight;
    263         newInfo.bmiHeader.biHeight = -info->bmiHeader.biHeight;
     264        long lLineByte = DIB_GetDIBWidthBytes(info->bmiHeader.biWidth, info->bmiHeader.biBitCount);
     265        long lHeight   = -info->bmiHeader.biHeight;
     266
     267        //TODO: doesn't work if memory is readonly!!
     268        ((BITMAPINFO *)info)->bmiHeader.biHeight = -info->bmiHeader.biHeight;
    264269
    265270        char *newBits = (char *)malloc( lLineByte * lHeight );
     
    273278            }
    274279            //We only convert the necessary data so xSrc & ySrc are now 0
    275             rc = SetDIBitsToDevice( hdc, xDest, yDest, cx, cy, 0, 0, startscan, lines, (void *)newBits, &newInfo, coloruse );
     280            rc = SetDIBitsToDevice( hdc, xDest, yDest, cx, cy, 0, 0, startscan, lines, (void *)newBits, info, coloruse );
    276281            free( newBits );
    277282        }
    278283        else DebugInt3();
     284
     285        //TODO: doesn't work if memory is readonly!!
     286        ((BITMAPINFO *)info)->bmiHeader.biHeight = -info->bmiHeader.biHeight;
    279287
    280288        return rc;
Note: See TracChangeset for help on using the changeset viewer.