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
c491d528
Commit
c491d528
authored
Nov 20, 2013
by
Vincent Povirk
Committed by
Alexandre Julliard
Nov 25, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Write FillRects records to metafiles.
parent
8babdc86
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
0 deletions
+103
-0
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+2
-0
graphics.c
dlls/gdiplus/graphics.c
+7
-0
metafile.c
dlls/gdiplus/metafile.c
+94
-0
No files found.
dlls/gdiplus/gdiplus_private.h
View file @
c491d528
...
...
@@ -57,6 +57,8 @@ extern GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics) DECLS
extern
GpStatus
METAFILE_GetGraphicsContext
(
GpMetafile
*
metafile
,
GpGraphics
**
result
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_GetDC
(
GpMetafile
*
metafile
,
HDC
*
hdc
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_ReleaseDC
(
GpMetafile
*
metafile
,
HDC
hdc
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_FillRectangles
(
GpMetafile
*
metafile
,
GpBrush
*
brush
,
GDIPCONST
GpRectF
*
rects
,
INT
count
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_GraphicsDeleted
(
GpMetafile
*
metafile
)
DECLSPEC_HIDDEN
;
extern
MetafileType
METAFILE_GetEmfType
(
HENHMETAFILE
hemf
)
DECLSPEC_HIDDEN
;
...
...
dlls/gdiplus/graphics.c
View file @
c491d528
...
...
@@ -3858,6 +3858,13 @@ GpStatus WINGDIPAPI GdipFillRectangles(GpGraphics *graphics, GpBrush *brush, GDI
if
(
!
rects
)
return
InvalidParameter
;
if
(
graphics
->
image
&&
graphics
->
image
->
type
==
ImageTypeMetafile
)
{
status
=
METAFILE_FillRectangles
((
GpMetafile
*
)
graphics
->
image
,
brush
,
rects
,
count
);
/* FIXME: Add gdi32 drawing. */
return
status
;
}
status
=
GdipCreatePath
(
FillModeAlternate
,
&
path
);
if
(
status
!=
Ok
)
return
status
;
...
...
dlls/gdiplus/metafile.c
View file @
c491d528
...
...
@@ -57,6 +57,21 @@ typedef struct EmfPlusHeader
DWORD
LogicalDpiY
;
}
EmfPlusHeader
;
typedef
struct
EmfPlusFillRects
{
EmfPlusRecordHeader
Header
;
DWORD
BrushID
;
DWORD
Count
;
}
EmfPlusFillRects
;
typedef
struct
EmfPlusRect
{
SHORT
X
;
SHORT
Y
;
SHORT
Width
;
SHORT
Height
;
}
EmfPlusRect
;
static
GpStatus
METAFILE_AllocateRecord
(
GpMetafile
*
metafile
,
DWORD
size
,
void
**
result
)
{
DWORD
size_needed
;
...
...
@@ -316,6 +331,85 @@ GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc)
return
Ok
;
}
static
BOOL
is_integer_rect
(
const
GpRectF
*
rect
)
{
SHORT
x
,
y
,
width
,
height
;
x
=
rect
->
X
;
y
=
rect
->
Y
;
width
=
rect
->
Width
;
height
=
rect
->
Height
;
if
(
rect
->
X
!=
(
REAL
)
x
||
rect
->
Y
!=
(
REAL
)
y
||
rect
->
Width
!=
(
REAL
)
width
||
rect
->
Height
!=
(
REAL
)
height
)
return
FALSE
;
return
TRUE
;
}
GpStatus
METAFILE_FillRectangles
(
GpMetafile
*
metafile
,
GpBrush
*
brush
,
GDIPCONST
GpRectF
*
rects
,
INT
count
)
{
if
(
metafile
->
metafile_type
==
MetafileTypeEmfPlusOnly
||
metafile
->
metafile_type
==
MetafileTypeEmfPlusDual
)
{
EmfPlusFillRects
*
record
;
GpStatus
stat
;
BOOL
integer_rects
=
1
;
int
i
;
DWORD
brushid
;
int
flags
=
0
;
if
(
brush
->
bt
==
BrushTypeSolidColor
)
{
flags
|=
0x8000
;
brushid
=
((
GpSolidFill
*
)
brush
)
->
color
;
}
else
{
FIXME
(
"brush serialization not implemented
\n
"
);
return
NotImplemented
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
!
is_integer_rect
(
&
rects
[
i
]))
{
integer_rects
=
0
;
break
;
}
}
if
(
integer_rects
)
flags
|=
0x4000
;
stat
=
METAFILE_AllocateRecord
(
metafile
,
sizeof
(
EmfPlusFillRects
)
+
count
*
(
integer_rects
?
sizeof
(
EmfPlusRect
)
:
sizeof
(
GpRectF
)),
(
void
**
)
&
record
);
if
(
stat
!=
Ok
)
return
stat
;
record
->
Header
.
Type
=
EmfPlusRecordTypeFillRects
;
record
->
Header
.
Flags
=
flags
;
record
->
BrushID
=
brushid
;
record
->
Count
=
count
;
if
(
integer_rects
)
{
EmfPlusRect
*
record_rects
=
(
EmfPlusRect
*
)(
record
+
1
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
record_rects
[
i
].
X
=
(
SHORT
)
rects
[
i
].
X
;
record_rects
[
i
].
Y
=
(
SHORT
)
rects
[
i
].
Y
;
record_rects
[
i
].
Width
=
(
SHORT
)
rects
[
i
].
Width
;
record_rects
[
i
].
Height
=
(
SHORT
)
rects
[
i
].
Height
;
}
}
else
memcpy
(
record
+
1
,
rects
,
sizeof
(
GpRectF
)
*
count
);
METAFILE_WriteRecords
(
metafile
);
}
return
Ok
;
}
GpStatus
METAFILE_ReleaseDC
(
GpMetafile
*
metafile
,
HDC
hdc
)
{
if
(
hdc
!=
metafile
->
record_dc
)
...
...
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