Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
3a5ddab9
Commit
3a5ddab9
authored
May 14, 2010
by
Roderick Colenbrander
Committed by
Alexandre Julliard
May 14, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opengl32: Add 32-bit bitmap rendering test.
parent
e91f4ae7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
+87
-0
opengl.c
dlls/opengl32/tests/opengl.c
+87
-0
No files found.
dlls/opengl32/tests/opengl.c
View file @
3a5ddab9
...
...
@@ -22,6 +22,10 @@
#include <wingdi.h>
#include "wine/test.h"
void
WINAPI
glClearColor
(
float
red
,
float
green
,
float
blue
,
float
alpha
);
void
WINAPI
glClear
(
unsigned
int
mask
);
void
WINAPI
glFinish
(
void
);
#define GL_COLOR_BUFFER_BIT 0x00004000
const
unsigned
char
*
WINAPI
glGetString
(
unsigned
int
);
#define GL_VENDOR 0x1F00
#define GL_RENDERER 0x1F01
...
...
@@ -499,6 +503,88 @@ static void test_acceleration(HDC hdc)
}
}
static
void
test_bitmap_rendering
(
void
)
{
PIXELFORMATDESCRIPTOR
pfd
;
int
i
,
iPixelFormat
=
0
;
unsigned
int
nFormats
;
HGLRC
hglrc
;
BITMAPINFO
biDst
;
HBITMAP
bmpDst
,
oldDst
;
HDC
hdcDst
,
hdcScreen
;
UINT32
*
dstBuffer
;
memset
(
&
biDst
,
0
,
sizeof
(
BITMAPINFO
));
biDst
.
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
);
biDst
.
bmiHeader
.
biWidth
=
2
;
biDst
.
bmiHeader
.
biHeight
=
-
2
;
biDst
.
bmiHeader
.
biPlanes
=
1
;
biDst
.
bmiHeader
.
biBitCount
=
32
;
biDst
.
bmiHeader
.
biCompression
=
BI_RGB
;
hdcScreen
=
CreateCompatibleDC
(
0
);
if
(
GetDeviceCaps
(
hdcScreen
,
BITSPIXEL
)
!=
32
)
{
DeleteDC
(
hdcScreen
);
trace
(
"Skipping bitmap rendering test
\n
"
);
return
;
}
hdcDst
=
CreateCompatibleDC
(
hdcScreen
);
bmpDst
=
CreateDIBSection
(
hdcDst
,
&
biDst
,
DIB_RGB_COLORS
,
(
void
**
)
&
dstBuffer
,
NULL
,
0
);
oldDst
=
SelectObject
(
hdcDst
,
bmpDst
);
/* Pick a pixel format by hand because ChoosePixelFormat is unreliable */
nFormats
=
DescribePixelFormat
(
hdcDst
,
0
,
0
,
NULL
);
for
(
i
=
1
;
i
<=
nFormats
;
i
++
)
{
memset
(
&
pfd
,
0
,
sizeof
(
PIXELFORMATDESCRIPTOR
));
DescribePixelFormat
(
hdcDst
,
i
,
sizeof
(
PIXELFORMATDESCRIPTOR
),
&
pfd
);
if
((
pfd
.
dwFlags
&
PFD_DRAW_TO_BITMAP
)
&&
(
pfd
.
dwFlags
&
PFD_SUPPORT_OPENGL
)
&&
(
pfd
.
cColorBits
==
32
)
&&
(
pfd
.
cAlphaBits
==
8
)
)
{
iPixelFormat
=
i
;
break
;
}
}
if
(
!
iPixelFormat
)
{
skip
(
"Unable to find a suitable pixel format"
);
}
else
{
SetPixelFormat
(
hdcDst
,
iPixelFormat
,
&
pfd
);
hglrc
=
wglCreateContext
(
hdcDst
);
todo_wine
ok
(
hglrc
!=
NULL
,
"Unable to create a context
\n
"
);
if
(
hglrc
)
{
wglMakeCurrent
(
hdcDst
,
hglrc
);
/* Note this is RGBA but we read ARGB back */
glClearColor
((
float
)
0x22
/
0xff
,
(
float
)
0x33
/
0xff
,
(
float
)
0x44
/
0xff
,
(
float
)
0x11
/
0xff
);
glClear
(
GL_COLOR_BUFFER_BIT
);
glFinish
();
/* Note apparently the alpha channel is not supported by the software renderer (bitmap only works using software) */
ok
(
dstBuffer
[
0
]
==
0x223344
,
"Expected color=0x223344, received color=%x
\n
"
,
dstBuffer
[
0
]);
wglMakeCurrent
(
NULL
,
NULL
);
wglDeleteContext
(
hglrc
);
}
}
SelectObject
(
hdcDst
,
oldDst
);
DeleteObject
(
bmpDst
);
DeleteDC
(
hdcDst
);
DeleteDC
(
hdcScreen
);
}
struct
wgl_thread_param
{
HANDLE
test_finished
;
...
...
@@ -833,6 +919,7 @@ START_TEST(opengl)
res
=
SetPixelFormat
(
hdc
,
iPixelFormat
,
&
pfd
);
ok
(
res
,
"SetPixelformat failed: %x
\n
"
,
GetLastError
());
test_bitmap_rendering
();
test_minimized
();
test_dc
(
hwnd
,
hdc
);
...
...
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