Changeset 9558 for trunk/src


Ignore:
Timestamp:
Dec 28, 2002, 3:01:37 PM (23 years ago)
Author:
sandervl
Message:

SetDIBitsToDevice fix for inverted blitting

File:
1 edited

Legend:

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

    r9429 r9558  
    1 /* $Id: blit.cpp,v 1.41 2002-11-26 10:53:06 sandervl Exp $ */
     1/* $Id: blit.cpp,v 1.42 2002-12-28 14:01:37 sandervl Exp $ */
    22
    33/*
     
    251251
    252252    //If upside down, reverse scanlines and call SetDIBitsToDevice again
    253     if(info->bmiHeader.biHeight < 0 && info->bmiHeader.biBitCount != 8 && info->bmiHeader.biCompression == 0) {
     253//    if(info->bmiHeader.biHeight < 0 && info->bmiHeader.biBitCount != 8 && info->bmiHeader.biCompression == 0) {
     254    if(info->bmiHeader.biHeight < 0 && (info->bmiHeader.biCompression == BI_RGB ||
     255       info->bmiHeader.biCompression == BI_BITFIELDS))
     256    {
    254257        // upside down
    255258        INT rc = -1;
     
    262265        char *newBits = (char *)malloc( lLineByte * lHeight );
    263266        if(newBits) {
    264             unsigned char *pbSrc = (unsigned char *)bits + lLineByte * (lHeight - 1);
     267            unsigned char *pbSrc = (unsigned char *)bits + xSrc + lLineByte * (ySrc + lHeight - 1);
    265268            unsigned char *pbDst = (unsigned char *)newBits;
    266269            for(int y = 0; y < lHeight; y++) {
     
    269272                pbSrc -= lLineByte;
    270273            }
    271             rc = SetDIBitsToDevice( hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (void *)newBits, &newInfo, coloruse );
     274            //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 );
    272276            free( newBits );
    273277        }
Note: See TracChangeset for help on using the changeset viewer.