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
065fbd20
Commit
065fbd20
authored
Mar 09, 2023
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Improve EMR_CREATEDIBPATTERNBRUSHPT playback.
It makes the lbHatch data available after PlayEnhMetaFileRecord returns.
parent
37628a77
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
19 deletions
+40
-19
enhmetafile.c
dlls/gdi32/enhmetafile.c
+3
-17
metafile.c
dlls/gdi32/tests/metafile.c
+37
-2
No files found.
dlls/gdi32/enhmetafile.c
View file @
065fbd20
...
...
@@ -1825,7 +1825,6 @@ BOOL WINAPI PlayEnhMetaFileRecord(
case
EMR_CREATEDIBPATTERNBRUSHPT
:
{
const
EMRCREATEDIBPATTERNBRUSHPT
*
lpCreate
=
(
const
EMRCREATEDIBPATTERNBRUSHPT
*
)
mr
;
LPVOID
lpPackedStruct
;
/* Check that offsets and data are contained within the record
* (including checking for wrap-arounds).
...
...
@@ -1839,28 +1838,15 @@ BOOL WINAPI PlayEnhMetaFileRecord(
break
;
}
/* This is a BITMAPINFO struct followed directly by bitmap bits */
lpPackedStruct
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lpCreate
->
cbBmi
+
lpCreate
->
cbBits
);
if
(
!
lpPackedStruct
)
if
(
lpCreate
->
offBmi
+
lpCreate
->
cbBmi
!=
lpCreate
->
offBits
)
{
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
ERR
(
"Invalid data in EMR_CREATEDIBPATTERNBRUSHPT record
\n
"
);
break
;
}
/* Now pack this structure */
memcpy
(
lpPackedStruct
,
((
const
BYTE
*
)
lpCreate
)
+
lpCreate
->
offBmi
,
lpCreate
->
cbBmi
);
memcpy
(
((
BYTE
*
)
lpPackedStruct
)
+
lpCreate
->
cbBmi
,
((
const
BYTE
*
)
lpCreate
)
+
lpCreate
->
offBits
,
lpCreate
->
cbBits
);
(
handletable
->
objectHandle
)[
lpCreate
->
ihBrush
]
=
CreateDIBPatternBrushPt
(
lpPackedStruct
,
CreateDIBPatternBrushPt
(
(
const
BYTE
*
)
lpCreate
+
lpCreate
->
offBmi
,
(
UINT
)
lpCreate
->
iUsage
);
HeapFree
(
GetProcessHeap
(),
0
,
lpPackedStruct
);
break
;
}
...
...
dlls/gdi32/tests/metafile.c
View file @
065fbd20
...
...
@@ -4183,6 +4183,38 @@ static void test_mf_PatternBrush(void)
HeapFree
(
GetProcessHeap
(),
0
,
orig_lb
);
}
static
int
CALLBACK
pattern_brush_emf_enum_proc
(
HDC
hdc
,
HANDLETABLE
*
htable
,
const
ENHMETARECORD
*
rec
,
int
n
,
LPARAM
arg
)
{
LOGBRUSH
brush
;
BOOL
ret
;
switch
(
rec
->
iType
)
{
case
EMR_HEADER
:
case
EMR_SELECTOBJECT
:
case
EMR_EOF
:
case
EMR_CREATEMONOBRUSH
:
return
1
;
case
EMR_CREATEDIBPATTERNBRUSHPT
:
ok
(
!
htable
->
objectHandle
[
2
],
"objectHandle[2] already used
\n
"
);
ret
=
PlayEnhMetaFileRecord
(
hdc
,
htable
,
rec
,
n
);
ok
(
ret
,
"PlayEnhMetaFileRecord failed
\n
"
);
ok
(
htable
->
objectHandle
[
2
]
!=
NULL
,
"objectHandle[2] not created
\n
"
);
ret
=
GetObjectW
(
htable
->
objectHandle
[
2
],
sizeof
(
brush
),
&
brush
);
ok
(
ret
,
"GetObjectW failed
\n
"
);
ok
(
brush
.
lbStyle
==
BS_DIBPATTERN
,
"brush.lbStyle = %d
\n
"
,
brush
.
lbStyle
);
ok
(
brush
.
lbHatch
>
(
ULONG_PTR
)
rec
&&
brush
.
lbHatch
<
(
ULONG_PTR
)
rec
+
rec
->
nSize
,
"brush.lbHatch = %p, not in %p-%p range
\n
"
,
(
void
*
)
brush
.
lbHatch
,
rec
,
(
const
BYTE
*
)
rec
+
rec
->
nSize
);
return
1
;
default:
ok
(
0
,
"unexpected record %lu
\n
"
,
rec
->
iType
);
return
0
;
}
}
static
void
test_emf_pattern_brush
(
void
)
{
char
buffer
[
sizeof
(
BITMAPINFOHEADER
)
+
(
2
+
32
*
32
/
8
)
*
sizeof
(
RGBQUAD
)];
...
...
@@ -4237,8 +4269,6 @@ static void test_emf_pattern_brush(void)
dump_emf_records
(
emf
,
"emf_pattern_brush"
);
}
ret
=
DeleteEnhMetaFile
(
emf
);
ok
(
ret
,
"DeleteMetaFile error %ld
\n
"
,
GetLastError
());
ret
=
DeleteObject
(
bitmap_brush
);
ok
(
ret
,
"DeleteObject failed
\n
"
);
ret
=
DeleteObject
(
dib_brush
);
...
...
@@ -4246,6 +4276,11 @@ static void test_emf_pattern_brush(void)
ret
=
DeleteObject
((
HBITMAP
)
orig_lb
->
lbHatch
);
ok
(
ret
,
"DeleteObject failed
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
orig_lb
);
ret
=
EnumEnhMetaFile
(
NULL
,
emf
,
pattern_brush_emf_enum_proc
,
NULL
,
NULL
);
ok
(
ret
,
"EnumEnhMetaFile error %ld
\n
"
,
GetLastError
());
ret
=
DeleteEnhMetaFile
(
emf
);
ok
(
ret
,
"DeleteMetaFile error %ld
\n
"
,
GetLastError
());
}
static
void
test_mf_palette_brush
(
void
)
...
...
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