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
93e8507a
Commit
93e8507a
authored
Aug 31, 2017
by
Vincent Povirk
Committed by
Alexandre Julliard
Sep 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Account for gdi32 transform in GdipDrawImage.
Signed-off-by:
Vincent Povirk
<
vincent@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
be952527
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
30 deletions
+19
-30
graphics.c
dlls/gdiplus/graphics.c
+19
-30
No files found.
dlls/gdiplus/graphics.c
View file @
93e8507a
...
...
@@ -284,43 +284,23 @@ static void restore_dc(GpGraphics *graphics, INT state)
RestoreDC
(
graphics
->
hdc
,
state
);
}
/* This helper applies all the changes that the points listed in ptf need in
* order to be drawn on the device context. In the end, this should include at
* least:
* -scaling by page unit
* -applying world transformation
* -converting from float to int
* Native gdiplus uses gdi32 to do all this (via SetMapMode, SetViewportExtEx,
* SetWindowExtEx, SetWorldTransform, etc.) but we cannot because we are using
* gdi to draw, and these functions would irreparably mess with line widths.
*/
static
void
transform_and_round_points
(
GpGraphics
*
graphics
,
POINT
*
pti
,
GpPointF
*
ptf
,
INT
count
)
static
void
round_points
(
POINT
*
pti
,
GpPointF
*
ptf
,
INT
count
)
{
REAL
scale_x
,
scale_y
;
GpMatrix
matrix
;
int
i
;
scale_x
=
units_to_pixels
(
1
.
0
,
graphics
->
unit
,
graphics
->
xres
);
scale_y
=
units_to_pixels
(
1
.
0
,
graphics
->
unit
,
graphics
->
yres
);
/* apply page scale */
if
(
graphics
->
unit
!=
UnitDisplay
)
{
scale_x
*=
graphics
->
scale
;
scale_y
*=
graphics
->
scale
;
}
matrix
=
graphics
->
worldtrans
;
GdipScaleMatrix
(
&
matrix
,
scale_x
,
scale_y
,
MatrixOrderAppend
);
GdipTransformMatrixPoints
(
&
matrix
,
ptf
,
count
);
for
(
i
=
0
;
i
<
count
;
i
++
){
pti
[
i
].
x
=
gdip_round
(
ptf
[
i
].
X
);
pti
[
i
].
y
=
gdip_round
(
ptf
[
i
].
Y
);
}
}
static
void
transform_and_round_points
(
GpGraphics
*
graphics
,
POINT
*
pti
,
GpPointF
*
ptf
,
INT
count
)
{
gdip_transform_points
(
graphics
,
CoordinateSpaceDevice
,
CoordinateSpaceWorld
,
ptf
,
count
);
round_points
(
pti
,
ptf
,
count
);
}
static
void
gdi_alpha_blend
(
GpGraphics
*
graphics
,
INT
dst_x
,
INT
dst_y
,
INT
dst_width
,
INT
dst_height
,
HDC
hdc
,
INT
src_x
,
INT
src_y
,
INT
src_width
,
INT
src_height
)
{
...
...
@@ -2943,7 +2923,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
ptf
[
3
].
Y
=
ptf
[
2
].
Y
+
ptf
[
1
].
Y
-
ptf
[
0
].
Y
;
if
(
!
srcwidth
||
!
srcheight
||
(
ptf
[
3
].
X
==
ptf
[
0
].
X
&&
ptf
[
3
].
Y
==
ptf
[
0
].
Y
))
return
Ok
;
transform_and_round_points
(
graphics
,
pti
,
ptf
,
4
);
gdip_transform_points
(
graphics
,
WineCoordinateSpaceGdiDevice
,
CoordinateSpaceWorld
,
ptf
,
4
);
round_points
(
pti
,
ptf
,
4
);
TRACE
(
"%s %s %s %s
\n
"
,
wine_dbgstr_point
(
&
pti
[
0
]),
wine_dbgstr_point
(
&
pti
[
1
]),
wine_dbgstr_point
(
&
pti
[
2
]),
wine_dbgstr_point
(
&
pti
[
3
]));
...
...
@@ -3005,7 +2986,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
if
(
dst_area
.
bottom
<
pti
[
i
].
y
)
dst_area
.
bottom
=
pti
[
i
].
y
;
}
stat
=
get_graphics_bounds
(
graphics
,
&
graphics_bounds
);
stat
=
get_graphics_
device_
bounds
(
graphics
,
&
graphics_bounds
);
if
(
stat
!=
Ok
)
return
stat
;
if
(
graphics_bounds
.
X
>
dst_area
.
left
)
dst_area
.
left
=
floorf
(
graphics_bounds
.
X
);
...
...
@@ -3121,10 +3102,14 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
dst_stride
=
src_stride
;
}
gdi_transform_acquire
(
graphics
);
stat
=
alpha_blend_pixels
(
graphics
,
dst_area
.
left
,
dst_area
.
top
,
dst_data
,
dst_area
.
right
-
dst_area
.
left
,
dst_area
.
bottom
-
dst_area
.
top
,
dst_stride
,
lockeddata
.
PixelFormat
);
gdi_transform_release
(
graphics
);
heap_free
(
src_data
);
heap_free
(
dst_dyn_data
);
...
...
@@ -3208,6 +3193,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
DeleteObject
(
hrgn
);
}
gdi_transform_acquire
(
graphics
);
if
(
bitmap
->
format
&
(
PixelFormatAlpha
|
PixelFormatPAlpha
))
{
gdi_alpha_blend
(
graphics
,
pti
[
0
].
x
,
pti
[
0
].
y
,
pti
[
1
].
x
-
pti
[
0
].
x
,
pti
[
2
].
y
-
pti
[
0
].
y
,
...
...
@@ -3219,6 +3206,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
hdc
,
srcx
,
srcy
,
srcwidth
,
srcheight
,
SRCCOPY
);
}
gdi_transform_release
(
graphics
);
RestoreDC
(
graphics
->
hdc
,
save_state
);
if
(
temp_hdc
)
...
...
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