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
5c6247f7
Commit
5c6247f7
authored
Jun 24, 2016
by
Vincent Povirk
Committed by
Alexandre Julliard
Jul 03, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement writing Clear operation to metafiles.
Signed-off-by:
Vincent Povirk
<
vincent@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
10516308
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
0 deletions
+121
-0
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+1
-0
graphics.c
dlls/gdiplus/graphics.c
+3
-0
metafile.c
dlls/gdiplus/metafile.c
+27
-0
metafile.c
dlls/gdiplus/tests/metafile.c
+90
-0
No files found.
dlls/gdiplus/gdiplus_private.h
View file @
5c6247f7
...
...
@@ -86,6 +86,7 @@ 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_GraphicsClear
(
GpMetafile
*
metafile
,
ARGB
color
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_FillRectangles
(
GpMetafile
*
metafile
,
GpBrush
*
brush
,
GDIPCONST
GpRectF
*
rects
,
INT
count
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_SetPageTransform
(
GpMetafile
*
metafile
,
GpUnit
unit
,
REAL
scale
)
DECLSPEC_HIDDEN
;
...
...
dlls/gdiplus/graphics.c
View file @
5c6247f7
...
...
@@ -4379,6 +4379,9 @@ GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics *graphics, ARGB color)
if
(
graphics
->
busy
)
return
ObjectBusy
;
if
(
graphics
->
image
&&
graphics
->
image
->
type
==
ImageTypeMetafile
)
return
METAFILE_GraphicsClear
((
GpMetafile
*
)
graphics
->
image
,
color
);
if
((
stat
=
GdipCreateSolidFill
(
color
,
&
brush
))
!=
Ok
)
return
stat
;
...
...
dlls/gdiplus/metafile.c
View file @
5c6247f7
...
...
@@ -57,6 +57,12 @@ typedef struct EmfPlusHeader
DWORD
LogicalDpiY
;
}
EmfPlusHeader
;
typedef
struct
EmfPlusClear
{
EmfPlusRecordHeader
Header
;
DWORD
Color
;
}
EmfPlusClear
;
typedef
struct
EmfPlusFillRects
{
EmfPlusRecordHeader
Header
;
...
...
@@ -370,6 +376,27 @@ GpStatus METAFILE_GetDC(GpMetafile* metafile, HDC *hdc)
return
Ok
;
}
GpStatus
METAFILE_GraphicsClear
(
GpMetafile
*
metafile
,
ARGB
color
)
{
if
(
metafile
->
metafile_type
==
MetafileTypeEmfPlusOnly
||
metafile
->
metafile_type
==
MetafileTypeEmfPlusDual
)
{
EmfPlusClear
*
record
;
GpStatus
stat
;
stat
=
METAFILE_AllocateRecord
(
metafile
,
sizeof
(
EmfPlusClear
),
(
void
**
)
&
record
);
if
(
stat
!=
Ok
)
return
stat
;
record
->
Header
.
Type
=
EmfPlusRecordTypeClear
;
record
->
Header
.
Flags
=
0
;
record
->
Color
=
color
;
METAFILE_WriteRecords
(
metafile
);
}
return
Ok
;
}
static
BOOL
is_integer_rect
(
const
GpRectF
*
rect
)
{
SHORT
x
,
y
,
width
,
height
;
...
...
dlls/gdiplus/tests/metafile.c
View file @
5c6247f7
...
...
@@ -862,6 +862,95 @@ static void test_fillrect(void)
expect
(
Ok
,
stat
);
}
static
const
emfplus_record
clear_emf_records
[]
=
{
{
0
,
EMR_HEADER
},
{
0
,
EmfPlusRecordTypeHeader
},
{
0
,
EmfPlusRecordTypeClear
},
{
1
,
EMR_SAVEDC
},
{
1
,
EMR_SETICMMODE
},
{
1
,
EMR_BITBLT
},
{
1
,
EMR_RESTOREDC
},
{
0
,
EmfPlusRecordTypeEndOfFile
},
{
0
,
EMR_EOF
},
{
0
}
};
static
void
test_clear
(
void
)
{
GpStatus
stat
;
GpMetafile
*
metafile
;
GpGraphics
*
graphics
;
HDC
hdc
;
HENHMETAFILE
hemf
;
static
const
GpRectF
frame
=
{
0
.
0
,
0
.
0
,
100
.
0
,
100
.
0
};
static
const
GpPointF
dst_points
[
3
]
=
{{
10
.
0
,
10
.
0
},{
20
.
0
,
10
.
0
},{
10
.
0
,
20
.
0
}};
static
const
WCHAR
description
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
0
};
GpBitmap
*
bitmap
;
ARGB
color
;
hdc
=
CreateCompatibleDC
(
0
);
stat
=
GdipRecordMetafile
(
hdc
,
EmfTypeEmfPlusOnly
,
&
frame
,
MetafileFrameUnitPixel
,
description
,
&
metafile
);
expect
(
Ok
,
stat
);
DeleteDC
(
hdc
);
if
(
stat
!=
Ok
)
return
;
stat
=
GdipGetHemfFromMetafile
(
metafile
,
&
hemf
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipGetImageGraphicsContext
((
GpImage
*
)
metafile
,
&
graphics
);
expect
(
Ok
,
stat
);
stat
=
GdipGraphicsClear
(
graphics
,
0xffffff00
);
expect
(
Ok
,
stat
);
stat
=
GdipDeleteGraphics
(
graphics
);
expect
(
Ok
,
stat
);
save_metafile
(
metafile
,
"clear.emf"
);
stat
=
GdipCreateBitmapFromScan0
(
30
,
30
,
0
,
PixelFormat32bppRGB
,
NULL
,
&
bitmap
);
expect
(
Ok
,
stat
);
stat
=
GdipGetImageGraphicsContext
((
GpImage
*
)
bitmap
,
&
graphics
);
expect
(
Ok
,
stat
);
stat
=
GdipDrawImagePointsRect
(
graphics
,
(
GpImage
*
)
metafile
,
dst_points
,
3
,
0
.
0
,
0
.
0
,
100
.
0
,
100
.
0
,
UnitPixel
,
NULL
,
NULL
,
NULL
);
expect
(
Ok
,
stat
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
5
,
5
,
&
color
);
expect
(
Ok
,
stat
);
expect
(
0xff000000
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
15
,
15
,
&
color
);
expect
(
Ok
,
stat
);
todo_wine
expect
(
0xffffff00
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
25
,
25
,
&
color
);
expect
(
Ok
,
stat
);
expect
(
0xff000000
,
color
);
stat
=
GdipDeleteGraphics
(
graphics
);
expect
(
Ok
,
stat
);
stat
=
GdipDisposeImage
((
GpImage
*
)
bitmap
);
expect
(
Ok
,
stat
);
stat
=
GdipGetHemfFromMetafile
(
metafile
,
&
hemf
);
expect
(
Ok
,
stat
);
stat
=
GdipDisposeImage
((
GpImage
*
)
metafile
);
expect
(
Ok
,
stat
);
check_emfplus
(
hemf
,
clear_emf_records
,
"clear emf"
);
DeleteEnhMetaFile
(
hemf
);
}
static
void
test_nullframerect
(
void
)
{
GpStatus
stat
;
GpMetafile
*
metafile
;
...
...
@@ -1345,6 +1434,7 @@ START_TEST(metafile)
test_getdc
();
test_emfonly
();
test_fillrect
();
test_clear
();
test_nullframerect
();
test_pagetransform
();
test_converttoemfplus
();
...
...
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