Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
03e0d96b
Commit
03e0d96b
authored
13 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
gdi32: Retrieve the brush pattern bits from the cache for enhanced metafiles.
parent
7d0b65c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/gdi32/enhmfdrv/objects.c
+37
-69
37 additions, 69 deletions
dlls/gdi32/enhmfdrv/objects.c
with
37 additions
and
69 deletions
dlls/gdi32/enhmfdrv/objects.c
+
37
−
69
View file @
03e0d96b
...
...
@@ -132,86 +132,54 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
index
=
0
;
}
break
;
case
BS_DIBPATTERN
:
{
EMRCREATEDIBPATTERNBRUSHPT
*
emr
;
DWORD
bmSize
,
biSize
,
size
;
BITMAPINFO
*
info
=
(
BITMAPINFO
*
)
logbrush
.
lbHatch
;
if
(
info
->
bmiHeader
.
biCompression
)
bmSize
=
info
->
bmiHeader
.
biSizeImage
;
else
bmSize
=
get_dib_image_size
(
info
);
biSize
=
bitmap_info_size
(
info
,
LOWORD
(
logbrush
.
lbColor
));
size
=
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
)
+
biSize
+
bmSize
;
emr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
emr
)
break
;
emr
->
emr
.
iType
=
EMR_CREATEDIBPATTERNBRUSHPT
;
emr
->
emr
.
nSize
=
size
;
emr
->
ihBrush
=
index
=
EMFDRV_AddHandle
(
dev
,
hBrush
);
emr
->
iUsage
=
LOWORD
(
logbrush
.
lbColor
);
emr
->
offBmi
=
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
);
emr
->
cbBmi
=
biSize
;
emr
->
offBits
=
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
)
+
biSize
;
emr
->
cbBits
=
bmSize
;
memcpy
((
char
*
)
emr
+
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
),
info
,
biSize
+
bmSize
);
if
(
!
EMFDRV_WriteRecord
(
dev
,
&
emr
->
emr
))
index
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
emr
);
}
break
;
case
BS_PATTERN
:
case
BS_DIBPATTERN
:
{
EMRCREATEDIBPATTERNBRUSHPT
*
emr
;
char
buffer
[
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
)];
BITMAPINFO
*
dst_info
,
*
src_info
=
(
BITMAPINFO
*
)
buffer
;
struct
gdi_image_bits
bits
;
DWORD
size
;
BITMAPINFO
*
info
=
(
BITMAPINFO
*
)
buffer
;
DWORD
info_size
,
image_size
;
void
*
bits
;
UINT
usage
;
if
(
!
get_bitmap_image
(
(
HANDLE
)
logbrush
.
lbHatch
,
src_info
,
&
bits
))
break
;
if
(
src_info
->
bmiHeader
.
biBitCount
!=
1
)
{
FIXME
(
"Trying to create a color pattern brush
\n
"
);
if
(
bits
.
free
)
bits
.
free
(
&
bits
);
break
;
}
if
(
!
get_brush_bitmap_info
(
hBrush
,
info
,
&
bits
,
&
usage
))
break
;
info_size
=
bitmap_info_size
(
info
,
usage
);
image_size
=
get_dib_image_size
(
info
);
/* FIXME: There is an extra DWORD written by native before the BMI.
* Not sure what its meant to contain.
*/
size
=
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
)
+
sizeof
(
DWORD
)
+
sizeof
(
BITMAPINFOHEADER
)
+
src_info
->
bmiHeader
.
biSizeImage
;
emr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
)
+
info_size
+
image_size
);
if
(
!
emr
)
break
;
emr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
emr
)
if
(
logbrush
.
lbStyle
==
BS_PATTERN
&&
info
->
bmiHeader
.
biBitCount
==
1
)
{
if
(
bits
.
free
)
bits
.
free
(
&
bits
);
break
;
/* Presumably to reduce the size of the written EMF, MS supports an
* undocumented iUsage value of 2, indicating a mono bitmap without the
* 8 byte 2 entry black/white palette. Stupidly, they could have saved
* over 20 bytes more by also ignoring the BITMAPINFO fields that are
* irrelevant/constant for monochrome bitmaps.
* FIXME: It may be that the DIB functions themselves accept this value.
*/
emr
->
emr
.
iType
=
EMR_CREATEMONOBRUSH
;
usage
=
DIB_PAL_MONO
;
/* FIXME: There is an extra DWORD written by native before the BMI.
* Not sure what its meant to contain.
*/
emr
->
offBmi
=
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
)
+
sizeof
(
DWORD
);
emr
->
cbBmi
=
sizeof
(
BITMAPINFOHEADER
);
}
dst_info
=
(
BITMAPINFO
*
)((
LPBYTE
)(
emr
+
1
)
+
sizeof
(
DWORD
));
dst_info
->
bmiHeader
=
src_info
->
bmiHeader
;
memcpy
(
&
dst_info
->
bmiHeader
+
1
,
bits
.
ptr
,
dst_info
->
bmiHeader
.
biSizeImage
);
if
(
bits
.
free
)
bits
.
free
(
&
bits
);
emr
->
emr
.
iType
=
EMR_CREATEMONOBRUSH
;
emr
->
emr
.
nSize
=
size
;
else
{
emr
->
emr
.
iType
=
EMR_CREATEDIBPATTERNBRUSHPT
;
emr
->
offBmi
=
sizeof
(
EMRCREATEDIBPATTERNBRUSHPT
);
emr
->
cbBmi
=
info_size
;
}
emr
->
emr
.
nSize
=
emr
->
offBits
+
emr
->
cbBits
;
emr
->
ihBrush
=
index
=
EMFDRV_AddHandle
(
dev
,
hBrush
);
/* Presumably to reduce the size of the written EMF, MS supports an
* undocumented iUsage value of 2, indicating a mono bitmap without the
* 8 byte 2 entry black/white palette. Stupidly, they could have saved
* over 20 bytes more by also ignoring the BITMAPINFO fields that are
* irrelevant/constant for monochrome bitmaps.
* FIXME: It may be that the DIB functions themselves accept this value.
*/
emr
->
iUsage
=
DIB_PAL_MONO
;
emr
->
offBmi
=
(
LPBYTE
)
dst_info
-
(
LPBYTE
)
emr
;
emr
->
cbBmi
=
sizeof
(
BITMAPINFOHEADER
);
emr
->
iUsage
=
usage
;
emr
->
offBits
=
emr
->
offBmi
+
emr
->
cbBmi
;
emr
->
cbBits
=
dst_info
->
bmiHeader
.
biSizeImage
;
emr
->
cbBits
=
image_size
;
memcpy
(
(
BYTE
*
)
emr
+
emr
->
offBmi
,
info
,
emr
->
cbBmi
);
memcpy
(
(
BYTE
*
)
emr
+
emr
->
offBits
,
bits
,
emr
->
cbBits
);
if
(
!
EMFDRV_WriteRecord
(
dev
,
&
emr
->
emr
))
index
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment