Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
5265e0f2
Commit
5265e0f2
authored
Apr 28, 2009
by
Rein Klazes
Committed by
Alexandre Julliard
Apr 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: GetPixel() on a monochrome bitmap should return black or white, not dark red.
parent
2fa64f52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
1 deletion
+82
-1
dc.c
dlls/gdi32/tests/dc.c
+76
-0
graphics.c
dlls/winex11.drv/graphics.c
+6
-1
No files found.
dlls/gdi32/tests/dc.c
View file @
5265e0f2
...
...
@@ -253,10 +253,86 @@ static void test_CreateCompatibleDC(void)
ok
(
hNewDC
==
NULL
,
"CreateCompatibleDC returned %p
\n
"
,
hNewDC
);
}
static
void
test_DC_bitmap
(
void
)
{
HDC
hdc
,
hdcmem
;
DWORD
bits
[
64
];
HBITMAP
hbmp
,
oldhbmp
;
COLORREF
col
;
int
i
,
bitspixel
;
/* fill bitmap data with b&w pattern */
for
(
i
=
0
;
i
<
64
;
i
++
)
bits
[
i
]
=
i
&
1
?
0
:
0xffffff
;
hdc
=
GetDC
(
0
);
ok
(
hdc
!=
NULL
,
"CreateDC rets %p
\n
"
,
hdc
);
bitspixel
=
GetDeviceCaps
(
hdc
,
BITSPIXEL
);
/* create a memory dc */
hdcmem
=
CreateCompatibleDC
(
hdc
);
ok
(
hdcmem
!=
NULL
,
"CreateCompatibleDC rets %p
\n
"
,
hdcmem
);
/* tests */
/* test monochrome bitmap: should always work */
hbmp
=
CreateBitmap
(
32
,
32
,
1
,
1
,
bits
);
ok
(
hbmp
!=
NULL
,
"CreateBitmap returns %p
\n
"
,
hbmp
);
oldhbmp
=
SelectObject
(
hdcmem
,
hbmp
);
ok
(
oldhbmp
!=
NULL
,
"SelectObject returned NULL
\n
"
);
/* a memdc always has a bitmap selected */
col
=
GetPixel
(
hdcmem
,
0
,
0
);
ok
(
col
==
0xffffff
,
"GetPixel returned %08x, expected 00ffffff
\n
"
,
col
);
col
=
GetPixel
(
hdcmem
,
1
,
1
);
ok
(
col
==
0x000000
,
"GetPixel returned %08x, expected 00000000
\n
"
,
col
);
col
=
GetPixel
(
hdcmem
,
100
,
1
);
ok
(
col
==
CLR_INVALID
,
"GetPixel returned %08x, expected ffffffff
\n
"
,
col
);
SelectObject
(
hdcmem
,
oldhbmp
);
DeleteObject
(
hbmp
);
/* test with 2 bits color depth, not likely to succeed */
hbmp
=
CreateBitmap
(
16
,
16
,
1
,
2
,
bits
);
ok
(
hbmp
!=
NULL
,
"CreateBitmap returns %p
\n
"
,
hbmp
);
oldhbmp
=
SelectObject
(
hdcmem
,
hbmp
);
if
(
bitspixel
!=
2
)
ok
(
!
oldhbmp
,
"SelectObject of a bitmap with 2 bits/pixel should return NULL
\n
"
);
if
(
oldhbmp
)
SelectObject
(
hdcmem
,
oldhbmp
);
DeleteObject
(
hbmp
);
/* test with 16 bits color depth, might succeed */
hbmp
=
CreateBitmap
(
6
,
6
,
1
,
16
,
bits
);
ok
(
hbmp
!=
NULL
,
"CreateBitmap returns %p
\n
"
,
hbmp
);
oldhbmp
=
SelectObject
(
hdcmem
,
hbmp
);
if
(
bitspixel
==
16
)
{
ok
(
oldhbmp
!=
NULL
,
"SelectObject returned NULL
\n
"
);
col
=
GetPixel
(
hdcmem
,
0
,
0
);
ok
(
col
==
0xffffff
,
"GetPixel of a bitmap with 16 bits/pixel returned %08x, expected 00ffffff
\n
"
,
col
);
col
=
GetPixel
(
hdcmem
,
1
,
1
);
ok
(
col
==
0x000000
,
"GetPixel of a bitmap with 16 bits/pixel returned returned %08x, expected 00000000
\n
"
,
col
);
}
if
(
oldhbmp
)
SelectObject
(
hdcmem
,
oldhbmp
);
DeleteObject
(
hbmp
);
/* test with 32 bits color depth, probably succeed */
hbmp
=
CreateBitmap
(
4
,
4
,
1
,
32
,
bits
);
ok
(
hbmp
!=
NULL
,
"CreateBitmap returns %p
\n
"
,
hbmp
);
oldhbmp
=
SelectObject
(
hdcmem
,
hbmp
);
if
(
bitspixel
==
32
)
{
ok
(
oldhbmp
!=
NULL
,
"SelectObject returned NULL
\n
"
);
col
=
GetPixel
(
hdcmem
,
0
,
0
);
ok
(
col
==
0xffffff
,
"GetPixel of a bitmap with 32 bits/pixel returned %08x, expected 00ffffff
\n
"
,
col
);
col
=
GetPixel
(
hdcmem
,
1
,
1
);
ok
(
col
==
0x000000
,
"GetPixel of a bitmap with 32 bits/pixel returned returned %08x, expected 00000000
\n
"
,
col
);
}
if
(
oldhbmp
)
SelectObject
(
hdcmem
,
oldhbmp
);
DeleteObject
(
hbmp
);
ReleaseDC
(
0
,
hdc
);
}
START_TEST
(
dc
)
{
test_savedc
();
test_savedc_2
();
test_GdiConvertToDevmodeW
();
test_CreateCompatibleDC
();
test_DC_bitmap
();
}
dlls/winex11.drv/graphics.c
View file @
5265e0f2
...
...
@@ -1082,8 +1082,13 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y )
/* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection
(
physDev
,
FALSE
);
if
(
physDev
->
depth
>
1
)
pixel
=
X11DRV_PALETTE_ToLogical
(
pixel
);
else
/* monochrome bitmaps return black or white */
if
(
pixel
)
pixel
=
0xffffff
;
return
pixel
;
return
X11DRV_PALETTE_ToLogical
(
pixel
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment