winex11.drv: SetDIBits fails when startscan != 0

Massimo Del Fedele max at veneto.com
Wed Mar 25 07:12:07 CDT 2009


Alexandre Julliard ha scritto:
> Massimo Del Fedele <max at veneto.com> writes:
> 
>>  
>> -  descr.bits      = bits;
>> +  descr.bits      = (BYTE *)bits + widthBytes * (tmpheight > 0 ? (height - startscan - lines) : startscan);
> 
> You shouldn't need to change the bits address.
> 

Well, original code was

   descr.bits      = bits;
   descr.image     = NULL;
   descr.palentry  = NULL;
   descr.infoWidth = width;
   descr.lines     = tmpheight >= 0 ? lines : -lines;
   descr.depth     = physBitmap->pixmap_depth;
   descr.drawable  = physBitmap->pixmap;
   descr.gc        = BITMAP_GC(physBitmap);
   descr.xSrc      = 0;
   descr.ySrc      = 0;
   descr.xDest     = 0;
   descr.yDest     = height - startscan - lines;  <-- HERE
   descr.width     = ds.dsBm.bmWidth;
   descr.height    = lines;

So, wrongly setting DESTINATION bitmap range, instead of SOURCE, which is the correct behaviour for SetDIBits().
I tried this one :
   descr.xSrc      = 0;
   descr.ySrc      = height - startscan - lines;  <-- HERE
   descr.xDest     = 0;
   descr.yDest     = 0;

But it didn't work either, so, or I didn't understand how X11DRV_DIB_SetImageBits( &descr ) works, or it has some bug.
Looking more in depth inside X11DRV_DIB_SetImageBits(); it shows, for example :

< NO FIXING OF bits BEFORE>
case 1:
     X11DRV_DIB_SetImageBits_1( descr->lines, descr->bits, descr->infoWidth,
                                descr->width, descr->xSrc, (int *)(descr->colorMap),
                                bmpImage, descr->dibpitch );

So, X11DRV_DIB_SetImageBits() and X11DRV_DIB_SetImageBits_XXX() don't set correctly the starting of DIB image when transfering.
I could do
bits += height - startscan - lines;
inside X11DRV_DIB_SetImageBits() instead of X11DRV_SetDIBits(), but somewhere it must be done.
Please tell me how you prefere it's done.

Ciao

Max




More information about the wine-devel mailing list