Ignore:
Timestamp:
Oct 28, 2002, 1:21:51 PM (23 years ago)
Author:
sandervl
Message:

PF: StretchDIBits fix for partial blits & RGB conversion

File:
1 edited

Legend:

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

    r8871 r9355  
    1 /* $Id: blit.cpp,v 1.39 2002-07-15 10:02:28 sandervl Exp $ */
     1/* $Id: blit.cpp,v 1.40 2002-10-28 12:21:51 sandervl Exp $ */
    22
    33/*
     
    186186             RGB555to565MMX(newbits, (WORD *)bits, imgsize/sizeof(WORD));
    187187        }
    188         else RGB555to565(newbits, (WORD *)bits, imgsize/sizeof(WORD));
     188        else
     189          RGB555to565(newbits, (WORD *)bits, imgsize/sizeof(WORD));
    189190        bits = newbits;
    190191    }
     
    535536        dprintf(("RGB 555->565 conversion required %x %x %x", bitfields[0], bitfields[1], bitfields[2]));
    536537
    537         int imgsize = CalcBitmapSize(info->bmiHeader.biBitCount,
    538                                      info->bmiHeader.biWidth, info->bmiHeader.biHeight);
    539 
    540         newbits = (WORD *)malloc(imgsize);
     538        ULONG imgsize = CalcBitmapSize(info->bmiHeader.biBitCount,
     539                                     widthSrc, heightSrc);
     540        ULONG offset = CalcBitmapSize(info->bmiHeader.biBitCount,
     541                                     xSrc, ySrc)/sizeof(WORD);
     542        newbits = (WORD *) HeapAlloc(GetProcessHeap(), 0, imgsize);
    541543        if(CPUFeatures & CPUID_MMX) {
    542              RGB555to565MMX(newbits, (WORD *)bits, imgsize/sizeof(WORD));
    543         }
    544         else RGB555to565(newbits, (WORD *)bits, imgsize/sizeof(WORD));
     544             RGB555to565MMX(newbits, (WORD *)bits+offset, imgsize/sizeof(WORD));
     545        }
     546        else
     547          RGB555to565(newbits, (WORD *)bits+offset, imgsize/sizeof(WORD));
    545548        bits = newbits;
    546549    }
     
    558561        ((BITMAPINFO *)info)->bmiHeader.biCompression = BI_BITFIELDS;
    559562    }
    560     if(newbits) free(newbits);
     563    if(newbits) HeapFree(GetProcessHeap(), 0, newbits);
    561564
    562565    //Open32 always returns height of bitmap (regardless of how many scanlines were copied)
Note: See TracChangeset for help on using the changeset viewer.