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
af500612
Commit
af500612
authored
Aug 12, 2016
by
Vincent Povirk
Committed by
Alexandre Julliard
Aug 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement recording/playback for TranslateWorldTransform.
Signed-off-by:
Vincent Povirk
<
vincent@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7d9a4392
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
0 deletions
+84
-0
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+1
-0
graphics.c
dlls/gdiplus/graphics.c
+9
-0
metafile.c
dlls/gdiplus/metafile.c
+43
-0
metafile.c
dlls/gdiplus/tests/metafile.c
+31
-0
No files found.
dlls/gdiplus/gdiplus_private.h
View file @
af500612
...
...
@@ -94,6 +94,7 @@ extern GpStatus METAFILE_SetWorldTransform(GpMetafile* metafile, GDIPCONST GpMat
extern
GpStatus
METAFILE_ScaleWorldTransform
(
GpMetafile
*
metafile
,
REAL
sx
,
REAL
sy
,
MatrixOrder
order
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_MultiplyWorldTransform
(
GpMetafile
*
metafile
,
GDIPCONST
GpMatrix
*
matrix
,
MatrixOrder
order
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_RotateWorldTransform
(
GpMetafile
*
metafile
,
REAL
angle
,
MatrixOrder
order
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_TranslateWorldTransform
(
GpMetafile
*
metafile
,
REAL
dx
,
REAL
dy
,
MatrixOrder
order
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_ResetWorldTransform
(
GpMetafile
*
metafile
)
DECLSPEC_HIDDEN
;
extern
GpStatus
METAFILE_GraphicsDeleted
(
GpMetafile
*
metafile
)
DECLSPEC_HIDDEN
;
...
...
dlls/gdiplus/graphics.c
View file @
af500612
...
...
@@ -5517,6 +5517,8 @@ GpStatus WINGDIPAPI GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix
GpStatus
WINGDIPAPI
GdipTranslateWorldTransform
(
GpGraphics
*
graphics
,
REAL
dx
,
REAL
dy
,
GpMatrixOrder
order
)
{
GpStatus
stat
;
TRACE
(
"(%p, %.2f, %.2f, %d)
\n
"
,
graphics
,
dx
,
dy
,
order
);
if
(
!
graphics
)
...
...
@@ -5525,6 +5527,13 @@ GpStatus WINGDIPAPI GdipTranslateWorldTransform(GpGraphics *graphics, REAL dx,
if
(
graphics
->
busy
)
return
ObjectBusy
;
if
(
graphics
->
image
&&
graphics
->
image
->
type
==
ImageTypeMetafile
)
{
stat
=
METAFILE_TranslateWorldTransform
((
GpMetafile
*
)
graphics
->
image
,
dx
,
dy
,
order
);
if
(
stat
!=
Ok
)
return
stat
;
}
return
GdipTranslateMatrix
(
&
graphics
->
worldtrans
,
dx
,
dy
,
order
);
}
...
...
dlls/gdiplus/metafile.c
View file @
af500612
...
...
@@ -109,6 +109,13 @@ typedef struct EmfPlusRotateWorldTransform
REAL
Angle
;
}
EmfPlusRotateWorldTransform
;
typedef
struct
EmfPlusTranslateWorldTransform
{
EmfPlusRecordHeader
Header
;
REAL
dx
;
REAL
dy
;
}
EmfPlusTranslateWorldTransform
;
static
GpStatus
METAFILE_AllocateRecord
(
GpMetafile
*
metafile
,
DWORD
size
,
void
**
result
)
{
DWORD
size_needed
;
...
...
@@ -673,6 +680,30 @@ GpStatus METAFILE_RotateWorldTransform(GpMetafile* metafile, REAL angle, MatrixO
return
Ok
;
}
GpStatus
METAFILE_TranslateWorldTransform
(
GpMetafile
*
metafile
,
REAL
dx
,
REAL
dy
,
MatrixOrder
order
)
{
if
(
metafile
->
metafile_type
==
MetafileTypeEmfPlusOnly
||
metafile
->
metafile_type
==
MetafileTypeEmfPlusDual
)
{
EmfPlusTranslateWorldTransform
*
record
;
GpStatus
stat
;
stat
=
METAFILE_AllocateRecord
(
metafile
,
sizeof
(
EmfPlusTranslateWorldTransform
),
(
void
**
)
&
record
);
if
(
stat
!=
Ok
)
return
stat
;
record
->
Header
.
Type
=
EmfPlusRecordTypeTranslateWorldTransform
;
record
->
Header
.
Flags
=
(
order
==
MatrixOrderAppend
?
0x2000
:
0
);
record
->
dx
=
dx
;
record
->
dy
=
dy
;
METAFILE_WriteRecords
(
metafile
);
}
return
Ok
;
}
GpStatus
METAFILE_ResetWorldTransform
(
GpMetafile
*
metafile
)
{
if
(
metafile
->
metafile_type
==
MetafileTypeEmfPlusOnly
||
metafile
->
metafile_type
==
MetafileTypeEmfPlusDual
)
...
...
@@ -1082,6 +1113,18 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
return
METAFILE_PlaybackUpdateWorldTransform
(
real_metafile
);
}
case
EmfPlusRecordTypeTranslateWorldTransform
:
{
EmfPlusTranslateWorldTransform
*
record
=
(
EmfPlusTranslateWorldTransform
*
)
header
;
MatrixOrder
order
=
(
flags
&
0x2000
)
?
MatrixOrderAppend
:
MatrixOrderPrepend
;
if
(
dataSize
+
sizeof
(
EmfPlusRecordHeader
)
<
sizeof
(
EmfPlusTranslateWorldTransform
))
return
InvalidParameter
;
GdipTranslateMatrix
(
real_metafile
->
world_transform
,
record
->
dx
,
record
->
dy
,
order
);
return
METAFILE_PlaybackUpdateWorldTransform
(
real_metafile
);
}
case
EmfPlusRecordTypeResetWorldTransform
:
{
GdipSetMatrixElements
(
real_metafile
->
world_transform
,
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
);
...
...
dlls/gdiplus/tests/metafile.c
View file @
af500612
...
...
@@ -1298,6 +1298,8 @@ static const emfplus_record worldtransform_records[] = {
{
0
,
EmfPlusRecordTypeFillRects
},
{
0
,
EmfPlusRecordTypeSetWorldTransform
},
{
0
,
EmfPlusRecordTypeFillRects
},
{
0
,
EmfPlusRecordTypeTranslateWorldTransform
},
{
0
,
EmfPlusRecordTypeFillRects
},
{
0
,
EmfPlusRecordTypeEndOfFile
},
{
0
,
EMR_EOF
},
{
0
}
...
...
@@ -1478,6 +1480,31 @@ static void test_worldtransform(void)
stat
=
GdipDeleteBrush
(
brush
);
expect
(
Ok
,
stat
);
/* translate transform */
stat
=
GdipTranslateWorldTransform
(
graphics
,
-
1
.
0
,
0
.
0
,
MatrixOrderAppend
);
expect
(
Ok
,
stat
);
stat
=
GdipGetWorldTransform
(
graphics
,
transform
);
expect
(
Ok
,
stat
);
stat
=
GdipGetMatrixElements
(
transform
,
elements
);
expect
(
Ok
,
stat
);
expectf
(
1
.
0
,
elements
[
0
]);
expectf
(
0
.
0
,
elements
[
1
]);
expectf
(
0
.
0
,
elements
[
2
]);
expectf
(
3
.
0
,
elements
[
3
]);
expectf
(
-
1
.
0
,
elements
[
4
]);
expectf
(
0
.
0
,
elements
[
5
]);
stat
=
GdipCreateSolidFill
((
ARGB
)
0xffffffff
,
(
GpSolidFill
**
)
&
brush
);
expect
(
Ok
,
stat
);
stat
=
GdipFillRectangle
(
graphics
,
brush
,
1
.
0
,
1
.
0
,
1
.
0
,
1
.
0
);
expect
(
Ok
,
stat
);
stat
=
GdipDeleteBrush
(
brush
);
expect
(
Ok
,
stat
);
stat
=
GdipDeleteMatrix
(
transform
);
expect
(
Ok
,
stat
);
...
...
@@ -1524,6 +1551,10 @@ static void test_worldtransform(void)
expect
(
Ok
,
stat
);
expect
(
0xffffff00
,
color
);
stat
=
GdipBitmapGetPixel
(
bitmap
,
10
,
90
,
&
color
);
expect
(
Ok
,
stat
);
expect
(
0xffffffff
,
color
);
stat
=
GdipDeleteGraphics
(
graphics
);
expect
(
Ok
,
stat
);
...
...
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