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
b157f805
Commit
b157f805
authored
Apr 24, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Apr 29, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
evr/tests: Sync compare_rgb32 / dump_rgb32 helpers with mf tests.
parent
f5c9dea1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
16 deletions
+27
-16
evr.c
dlls/evr/tests/evr.c
+27
-16
No files found.
dlls/evr/tests/evr.c
View file @
b157f805
...
@@ -39,34 +39,39 @@ static void load_resource(const WCHAR *filename, const BYTE **data, DWORD *lengt
...
@@ -39,34 +39,39 @@ static void load_resource(const WCHAR *filename, const BYTE **data, DWORD *lengt
*
length
=
SizeofResource
(
GetModuleHandleW
(
NULL
),
resource
);
*
length
=
SizeofResource
(
GetModuleHandleW
(
NULL
),
resource
);
}
}
static
DWORD
compare_rgb
32
(
const
BYTE
*
data
,
DWORD
*
length
,
const
RECT
*
rect
,
const
BYTE
*
expect
)
static
DWORD
compare_rgb
(
const
BYTE
*
data
,
DWORD
*
length
,
const
SIZE
*
size
,
const
RECT
*
rect
,
const
BYTE
*
expect
,
UINT
bits
)
{
{
DWORD
x
,
y
,
s
ize
,
diff
=
0
,
width
=
rect
->
right
,
height
=
rect
->
bottom
;
DWORD
x
,
y
,
s
tep
=
bits
/
8
,
data_size
,
diff
=
0
,
width
=
size
->
cx
,
height
=
size
->
cy
;
/* skip BMP header from the dump */
/* skip BMP header from the dump */
size
=
*
(
DWORD
*
)(
expect
+
2
+
2
*
sizeof
(
DWORD
));
data_
size
=
*
(
DWORD
*
)(
expect
+
2
+
2
*
sizeof
(
DWORD
));
*
length
=
*
length
+
size
;
*
length
=
*
length
+
data_
size
;
expect
=
expect
+
size
;
expect
=
expect
+
data_
size
;
for
(
y
=
0
;
y
<
height
;
y
++
,
data
+=
width
*
4
,
expect
+=
width
*
4
)
for
(
y
=
0
;
y
<
height
;
y
++
,
data
+=
width
*
step
,
expect
+=
width
*
step
)
{
{
if
(
y
<
rect
->
top
||
y
>=
rect
->
bottom
)
continue
;
if
(
y
<
rect
->
top
||
y
>=
rect
->
bottom
)
continue
;
for
(
x
=
0
;
x
<
width
;
x
++
)
for
(
x
=
0
;
x
<
width
;
x
++
)
{
{
if
(
x
<
rect
->
left
||
x
>=
rect
->
right
)
continue
;
if
(
x
<
rect
->
left
||
x
>=
rect
->
right
)
continue
;
diff
+=
abs
((
int
)
expect
[
4
*
x
+
0
]
-
(
int
)
data
[
4
*
x
+
0
]);
diff
+=
abs
((
int
)
expect
[
step
*
x
+
0
]
-
(
int
)
data
[
step
*
x
+
0
]);
diff
+=
abs
((
int
)
expect
[
4
*
x
+
1
]
-
(
int
)
data
[
4
*
x
+
1
]);
diff
+=
abs
((
int
)
expect
[
step
*
x
+
1
]
-
(
int
)
data
[
step
*
x
+
1
]);
diff
+=
abs
((
int
)
expect
[
4
*
x
+
2
]
-
(
int
)
data
[
4
*
x
+
2
]);
if
(
step
>=
3
)
diff
+=
abs
((
int
)
expect
[
step
*
x
+
2
]
-
(
int
)
data
[
step
*
x
+
2
]);
}
}
}
}
size
=
(
rect
->
right
-
rect
->
left
)
*
(
rect
->
bottom
-
rect
->
top
)
*
3
;
data_size
=
(
rect
->
right
-
rect
->
left
)
*
(
rect
->
bottom
-
rect
->
top
)
*
min
(
step
,
3
)
;
return
diff
*
100
/
256
/
size
;
return
diff
*
100
/
256
/
data_
size
;
}
}
static
void
dump_rgb32
(
const
BYTE
*
data
,
DWORD
length
,
const
RECT
*
rect
,
HANDLE
outpu
t
)
static
DWORD
compare_rgb32
(
const
BYTE
*
data
,
DWORD
*
length
,
const
SIZE
*
size
,
const
RECT
*
rect
,
const
BYTE
*
expec
t
)
{
{
DWORD
width
=
rect
->
right
,
height
=
rect
->
bottom
;
return
compare_rgb
(
data
,
length
,
size
,
rect
,
expect
,
32
);
}
static
void
dump_rgb
(
const
BYTE
*
data
,
DWORD
length
,
const
SIZE
*
size
,
HANDLE
output
,
UINT
bits
)
{
DWORD
width
=
size
->
cx
,
height
=
size
->
cy
;
static
const
char
magic
[
2
]
=
"BM"
;
static
const
char
magic
[
2
]
=
"BM"
;
struct
struct
{
{
...
@@ -80,7 +85,7 @@ static void dump_rgb32(const BYTE *data, DWORD length, const RECT *rect, HANDLE
...
@@ -80,7 +85,7 @@ static void dump_rgb32(const BYTE *data, DWORD length, const RECT *rect, HANDLE
.
biHeader
=
.
biHeader
=
{
{
.
biSize
=
sizeof
(
BITMAPINFOHEADER
),
.
biWidth
=
width
,
.
biHeight
=
height
,
.
biPlanes
=
1
,
.
biSize
=
sizeof
(
BITMAPINFOHEADER
),
.
biWidth
=
width
,
.
biHeight
=
height
,
.
biPlanes
=
1
,
.
biBitCount
=
32
,
.
biCompression
=
BI_RGB
,
.
biSizeImage
=
width
*
height
*
4
,
.
biBitCount
=
bits
,
.
biCompression
=
BI_RGB
,
.
biSizeImage
=
width
*
height
*
(
bits
/
8
)
,
},
},
};
};
DWORD
written
;
DWORD
written
;
...
@@ -97,9 +102,15 @@ static void dump_rgb32(const BYTE *data, DWORD length, const RECT *rect, HANDLE
...
@@ -97,9 +102,15 @@ static void dump_rgb32(const BYTE *data, DWORD length, const RECT *rect, HANDLE
ok
(
written
==
length
,
"written %lu bytes
\n
"
,
written
);
ok
(
written
==
length
,
"written %lu bytes
\n
"
,
written
);
}
}
static
void
dump_rgb32
(
const
BYTE
*
data
,
DWORD
length
,
const
SIZE
*
size
,
HANDLE
output
)
{
return
dump_rgb
(
data
,
length
,
size
,
output
,
32
);
}
#define check_rgb32_data(a, b, c, d) check_rgb32_data_(__LINE__, a, b, c, d)
#define check_rgb32_data(a, b, c, d) check_rgb32_data_(__LINE__, a, b, c, d)
static
DWORD
check_rgb32_data_
(
int
line
,
const
WCHAR
*
filename
,
const
BYTE
*
data
,
DWORD
length
,
const
RECT
*
rect
)
static
DWORD
check_rgb32_data_
(
int
line
,
const
WCHAR
*
filename
,
const
BYTE
*
data
,
DWORD
length
,
const
RECT
*
rect
)
{
{
SIZE
size
=
{
rect
->
right
,
rect
->
bottom
};
WCHAR
output_path
[
MAX_PATH
];
WCHAR
output_path
[
MAX_PATH
];
const
BYTE
*
expect_data
;
const
BYTE
*
expect_data
;
HRSRC
resource
;
HRSRC
resource
;
...
@@ -109,7 +120,7 @@ static DWORD check_rgb32_data_(int line, const WCHAR *filename, const BYTE *data
...
@@ -109,7 +120,7 @@ static DWORD check_rgb32_data_(int line, const WCHAR *filename, const BYTE *data
lstrcatW
(
output_path
,
filename
);
lstrcatW
(
output_path
,
filename
);
output
=
CreateFileW
(
output_path
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
output
=
CreateFileW
(
output_path
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
output
!=
INVALID_HANDLE_VALUE
,
"CreateFileW failed, error %lu
\n
"
,
GetLastError
());
ok
(
output
!=
INVALID_HANDLE_VALUE
,
"CreateFileW failed, error %lu
\n
"
,
GetLastError
());
dump_rgb32
(
data
,
length
,
rect
,
output
);
dump_rgb32
(
data
,
length
,
&
size
,
output
);
trace
(
"created %s
\n
"
,
debugstr_w
(
output_path
));
trace
(
"created %s
\n
"
,
debugstr_w
(
output_path
));
CloseHandle
(
output
);
CloseHandle
(
output
);
...
@@ -117,7 +128,7 @@ static DWORD check_rgb32_data_(int line, const WCHAR *filename, const BYTE *data
...
@@ -117,7 +128,7 @@ static DWORD check_rgb32_data_(int line, const WCHAR *filename, const BYTE *data
ok
(
resource
!=
0
,
"FindResourceW failed, error %lu
\n
"
,
GetLastError
());
ok
(
resource
!=
0
,
"FindResourceW failed, error %lu
\n
"
,
GetLastError
());
expect_data
=
LockResource
(
LoadResource
(
GetModuleHandleW
(
NULL
),
resource
));
expect_data
=
LockResource
(
LoadResource
(
GetModuleHandleW
(
NULL
),
resource
));
return
compare_rgb32
(
data
,
&
length
,
rect
,
expect_data
);
return
compare_rgb32
(
data
,
&
length
,
&
size
,
rect
,
expect_data
);
}
}
static
void
set_rect
(
MFVideoNormalizedRect
*
rect
,
float
left
,
float
top
,
float
right
,
float
bottom
)
static
void
set_rect
(
MFVideoNormalizedRect
*
rect
,
float
left
,
float
top
,
float
right
,
float
bottom
)
...
...
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