[Spice-devel] [PATCH spice-server v2 2/6] Handle top down bitmaps dumping

Frediano Ziglio fziglio at redhat.com
Mon Oct 31 11:01:56 UTC 2016


> 
> On Mon, 2016-10-31 at 06:17 -0400, Frediano Ziglio wrote:
> > ping
> > 
> > > 
> > > The top down flag can be specified using negative heights.
> 
> Will the resulting bitmap be upside down ? Or it depends on the image
> viewer ?
> 
> Pavel
> 

According to https://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx:

"The height of the bitmap, in pixels. If biHeight is positive, the bitmap is a
bottom-up DIB and its origin is the lower-left corner. If biHeight is negative,
the bitmap is a top-down DIB and its origin is the upper-left corner."

I don't know how persistent are Microsoft URLs and which license are
these information (so: can I put the line above in the commit message?).

I could add something like:

"Refer to BITMAPINFOHEADER structure documentation for biHeight field for details."

Frediano

> > > 
> > > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > > ---
> > >  server/spice-bitmap-utils.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/server/spice-bitmap-utils.c b/server/spice-bitmap-
> > > utils.c
> > > index 72a9285..439f05d 100644
> > > --- a/server/spice-bitmap-utils.c
> > > +++ b/server/spice-bitmap-utils.c
> > > @@ -269,7 +269,7 @@ void dump_bitmap(SpiceBitmap *bitmap)
> > >      put_32le(&ptr, bitmap_data_offset);
> > >      put_32le(&ptr, header_size - 14);
> > >      put_32le(&ptr, bitmap->x);
> > > -    put_32le(&ptr, bitmap->y);
> > > +    put_32le(&ptr, bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN ?
> > > -bitmap->y
> > > : bitmap->y);
> > >  
> > >      put_16le(&ptr, 1); // plane
> > >      put_16le(&ptr, n_pixel_bits);
> > 



More information about the Spice-devel mailing list