Commit b830a46d authored by Ilia Docin's avatar Ilia Docin Committed by Alexandre Julliard

sane.ds: Set monochrome DIB color table.

parent 76f622a6
...@@ -335,10 +335,8 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin, ...@@ -335,10 +335,8 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
switch (activeDS.frame_params.format) switch (activeDS.frame_params.format)
{ {
case FMT_GRAY: case FMT_GRAY:
if (activeDS.frame_params.depth == 8) if (activeDS.frame_params.depth == 8 || activeDS.frame_params.depth == 1)
color_size = (1 << 8) * sizeof(*colors); color_size = (1 << activeDS.frame_params.depth) * sizeof(*colors);
else if (activeDS.frame_params.depth == 1)
;
else else
{ {
FIXME("For NATIVE, we support only 1 bit monochrome and 8 bit Grayscale, not %d\n", activeDS.frame_params.depth); FIXME("For NATIVE, we support only 1 bit monochrome and 8 bit Grayscale, not %d\n", activeDS.frame_params.depth);
...@@ -405,8 +403,15 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin, ...@@ -405,8 +403,15 @@ TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
{ {
colors = (RGBQUAD *) p; colors = (RGBQUAD *) p;
p += color_size; p += color_size;
for (i = 0; i < (color_size / sizeof(*colors)); i++) if (activeDS.frame_params.depth == 1)
colors[i].rgbBlue = colors[i].rgbRed = colors[i].rgbGreen = i; {
/* Sane uses 1 to represent minimum intensity (black) and 0 for maximum (white) */
colors[0].rgbBlue = colors[0].rgbRed = colors[0].rgbGreen = 255;
colors[1].rgbBlue = colors[1].rgbRed = colors[1].rgbGreen = 0;
}
else
for (i = 0; i < (color_size / sizeof(*colors)); i++)
colors[i].rgbBlue = colors[i].rgbRed = colors[i].rgbGreen = i;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment