Bug 42739 - Win32 DIB surfaces not correct for CAIRO_FORMAT_A1
Summary: Win32 DIB surfaces not correct for CAIRO_FORMAT_A1
Alias: None
Product: cairo
Classification: Unclassified
Component: win32 backend (show other bugs)
Version: 1.10.3
Hardware: Other All
: medium blocker
Assignee: cairo-bugs mailing list
QA Contact: cairo-bugs mailing list
Depends on:
Blocks: cairo-1.12
  Show dependency treegraph
Reported: 2011-11-09 05:24 UTC by Alexander Larsson
Modified: 2012-02-15 06:43 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Fix A1 format win32 surfaces (5.06 KB, patch)
2011-11-09 05:24 UTC, Alexander Larsson
Details | Splinter Review

Description Alexander Larsson 2011-11-09 05:24:20 UTC
Created attachment 53328 [details] [review]
Fix A1 format win32 surfaces

The in-memory format for a depth 1 bitmap in GDI is not the same as cairo/pixman. To convert from one to the other you need to mirror the bits in each byte.
I.e. for the leftmost bit set in a 4 byte sequence pixman would use:
 0x01, 0x00, 0x00, 0x00
Whereas GDI uses:
 0x80, 0x00, 0x00, 0x00

This means the DIB bits in the win32 surface are not right in the CAIRO_FORMAT_A1 case. I'm attaching a patch that fixes this by skipping some optimization in this case and converting things when needed.

This was originally discovered inh Gtk+ on win32, see https://bugzilla.gnome.org/show_bug.cgi?id=653653 for the bug report.
Comment 1 Chris Wilson 2012-02-15 06:43:59 UTC
commit ae3319890eacd1c8282ca6df7b263ac74abb5f8d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Feb 12 11:25:07 2012 +0000

    win32: Rebase on the new compositor infrastructure
    Try and undo all the damage that has acrued over the years by plugging
    into the compositor pipeline.
    References: https://bugs.freedesktop.org/show_bug.cgi?id=42739
    References: https://bugs.freedesktop.org/show_bug.cgi?id=42821
    References: https://bugs.freedesktop.org/show_bug.cgi?id=33081
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.