Ignore:
Timestamp:
Apr 1, 2003, 5:57:05 PM (22 years ago)
Author:
sandervl
Message:

Fix for partial dibsection resyncs

File:
1 edited

Legend:

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

    r9762 r9966  
    1 /* $Id: dibsect.cpp,v 1.64 2003-02-06 19:20:03 sandervl Exp $ */
     1/* $Id: dibsect.cpp,v 1.65 2003-04-01 15:57:05 sandervl Exp $ */
    22
    33/*
     
    3131#define DBG_LOCALLOG  DBG_dibsect
    3232#include "dbglocal.h"
     33
    3334
    3435//******************************************************************************
     
    8384   this->dwOffset = dwOffset;
    8485   if(hSection) {
    85         bmpBits = (char *)MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS_W, 0, dwOffset, bmpsize*pbmi->biHeight);
     86        bmpBits = (char *)MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS_W, 0, dwOffset, bmpsize*pbmi->biHeight - dwOffset);
    8687        if(!bmpBits) {
    8788            dprintf(("Dibsection: mapViewOfFile %x failed!", hSection));
     
    522523#else
    523524  point[2].y = nYsrc;
    524   point[3].y = nYsrc + nSrcHeight - 1;
     525  point[3].y = nYsrc + nSrcHeight;
    525526#endif
    526527
     
    555556        fRestoryYInversion = TRUE;
    556557  }
     558#else
     559  dprintf(("Sync destination dibsection: hdc y inversion = %d", GpiQueryYInversion(hdc)));
    557560#endif
    558561
     
    591594        break;
    592595  }
     596#ifndef INVERT
     597  if(!(fFlip & FLIP_VERT)) {
     598#else
    593599  if(fFlip & FLIP_VERT) {
     600#endif
    594601        //manually reverse bitmap data
    595602        char *src = bmpBits + (pOS2bmp->cy-1)*dibinfo.dsBm.bmWidthBytes;
     
    683690      }
    684691  }
    685 #endif
    686 
     692#else
     693  dprintf(("Sync destination dibsection: hdc y inversion = %d", GpiQueryYInversion(hdc)));
     694#endif
     695
     696#ifndef INVERT
     697  if(!(fFlip & FLIP_VERT)) {
     698#else
    687699  if(fFlip & FLIP_VERT) {
     700#endif
    688701        destBuf = bmpBitsDblBuffer + nYdest*dibinfo.dsBm.bmWidthBytes;
    689702
     
    695708        tmphdr->cbImage = dibinfo.dsBm.bmHeight*dibinfo.dsBm.bmWidthBytes;
    696709
    697         rc = GpiQueryBitmapBits(hdc, nYdest, nDestHeight, destBuf,
     710#ifdef INVERT
     711        int dest = dibinfo.dsBm.bmHeight - nYdest - nDestHeight;
     712#else
     713        int dest = nYdest;
     714#endif
     715        rc = GpiQueryBitmapBits(hdc, dest, nDestHeight, destBuf,
    698716                                tmphdr);
    699717        if(rc == GPI_ALTERROR) {
     
    719737
    720738        destBuf = GetDIBObject() + nYdest*dibinfo.dsBm.bmWidthBytes;
     739
     740#ifdef INVERT
     741        int dest = dibinfo.dsBm.bmHeight - nYdest - nDestHeight;
     742#else
     743        int dest = nYdest;
     744#endif
    721745        rc = GpiQueryBitmapBits(hdc, nYdest, nDestHeight, destBuf,
    722746                                tmphdr);
     
    736760
    737761  if(dibinfo.dsBitfields[1] == 0x3E0) {//RGB 555?
    738     dprintf(("DIBSection::sync: convert RGB 565 to RGB 555"));
    739 
    740     destBuf = GetDIBObject() + nYdest*dibinfo.dsBm.bmWidthBytes;
    741 
    742     if(CPUFeatures & CPUID_MMX) {
     762      dprintf(("DIBSection::sync: convert RGB 565 to RGB 555"));
     763
     764      destBuf = GetDIBObject() + nYdest*dibinfo.dsBm.bmWidthBytes;
     765
     766      if(CPUFeatures & CPUID_MMX) {
    743767            RGB565to555MMX((WORD *)destBuf, (WORD *)destBuf, (nDestHeight*dibinfo.dsBm.bmWidthBytes)/sizeof(WORD));
    744     }
    745     else    RGB565to555((WORD *)destBuf, (WORD *)destBuf, (nDestHeight*dibinfo.dsBm.bmWidthBytes)/sizeof(WORD));
     768      }
     769      else  RGB565to555((WORD *)destBuf, (WORD *)destBuf, (nDestHeight*dibinfo.dsBm.bmWidthBytes)/sizeof(WORD));
    746770  }
    747771
    748772  free(tmphdr);
    749773  if(rc != nDestHeight) {
    750     dprintf(("!WARNING!: GpiQueryBitmapBits returned %d instead of %d scanlines", rc, nDestHeight));
     774      dprintf(("!WARNING!: GpiQueryBitmapBits returned %d instead of %d scanlines", rc, nDestHeight));
    751775  }
    752776
Note: See TracChangeset for help on using the changeset viewer.