[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re : Re: CreateDIBSection() patch
From:       eric.pouech () lemel ! fr (eric pouech)
Date:       1999-08-24 11:51:20
[Download RAW message or body]

- first, your patch has already been applied by Alexandre (nothing's wrong 
with that)
- to better answer your question, you could try a little test program on 
windows to see what is returned
- the latest point (still unanswered) is to know whether Windows stores the 
BITMAPINFOHEADER with a negative height, or just changes the result upon 
GetObject() queries. The only way to really know is to grab your best 
dissassembler (in a country where this is allowed)

well to be complete, just a last issue.
MS doc says that in a BITMAP the height is always >= 0 (or may be strict > 
0)
X11DRV_DIB_CreateDIBSection before your first patch left the height of 
BITMAP < 0 (and the BITMAPINFOHEADER also < 0). I fear that to be correct, 
the dsBm.height must be > 0 and the dsBmih.height < 0 (could someone comment
 on this ?) in X11DRV_DIB_CreateDIBSection 
if this is true, is means that:
- in X11DRV_DIB_CreateDIBSection(), set the BITMAP.height to a positive 
value (and dsBmih.height as a positive or negative value)
- in DIB_GetObject() (if this is also confirmed) to change the sign of the 
height in the BITMAPINFOHEADER (BITMAP.height should be already positive)

A+

>First, my appologies; I somehow managed to send in the wrong patch in my
>previous mail to wine-patches, which wouldn't even compile! But now we
>should better finish the discussion before I send in the corrected patch.
>
>> Date: Fri, 20 Aug 1999 18:10:01 +0200
>> From: Eric Pouech <Eric.Pouech@wanadoo.fr>
>
>> just a question: altering the sign of bmHeight in DIB creation will
>> change the Y axis orientation of the bitmap which I doubt will be
>> compatible with all apps i'd rather leave X11DRV_DIB_CreateDIBSection
>> untouched, but change the sign of bmHeight in bitmap.c
>> (BITMAP_GetObject for DIBSECTIONs) (which is anyway what the KB
>> article says)
>
>Ok, I tried this, and it also fixes the problem in the "Magic the
>Gathering" demo. Here is the small patch:
>
>----------------------------------------------------------------------
>--- ./objects/bitmap.c  1999/08/24 05:14:18     1.1
>+++ ./objects/bitmap.c  1999/08/24 05:21:52
>@@ -719,6 +719,14 @@
>        }
> 
>        memcpy( buffer, bmp->dib, count );
>+       if(count >= sizeof(BITMAP) &&
>+          ((DIBSECTION *)buffer)->dsBm.bmHeight < 0)
>+         ((DIBSECTION *)buffer)->dsBm.bmHeight =
>+           -((DIBSECTION *)buffer)->dsBm.bmHeight;
>+       if(count >= sizeof(DIBSECTION) &&
>+          ((DIBSECTION *)buffer)->dsBmih.biHeight < 0)
>+         ((DIBSECTION *)buffer)->dsBmih.biHeight =
>+           -((DIBSECTION *)buffer)->dsBmih.biHeight;
>        return count;
>     }
>     else
>----------------------------------------------------------------------
>
>Note that the sign in the returned BITMAP must be changed for the
>program to work, not just in the BITMAPINFOHEADER as per the
>knowledgebase article.
>
>Hm, can we get a definite ruling as to which approach is the correct one
>(changing the sign once at creation, or every time in the GetObject())?
>I wonder if applications will even be able to tell the difference (the
>knowledge base article seems to imply that they cannot), are there any
>other ways than GetObject() to see the internal structure of a DIB?
>
>Anyway, if people are happy with this new patch I will submit it to
>wine-patches.
>
> - Kristian.
>
>> Kristian Nielsen wrote:
>> > 
>> > This patch fixes a bug in CreateDIBSection() when called with a 
negative
>> > height. In this case, the created DIB must NOT have a negative
>> > height. Microsoft knowledgebase article #Q186586 says on the subject:
>> > 
>> > ----------------------------------------------------------------------
>> > PRB: GetObject() Always Returns Positive Height For DIB Sections
>> > 
>> > SYMPTOMS
>> > 
>> > When you use GetObject() to obtain information about a DIB section,
>> > GetObject() always returns a DIBSECTION containing a BITMAPINFOHEADER
>> > with a positive height value, regardless of the sign of the height it
>> > was created with. If you need to track the sign of the height in an
>> > application, you will need to do this programmatically.
>> > ----------------------------------------------------------------------
>
>
>


=========================================================================

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic