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
b9ead1a7
Commit
b9ead1a7
authored
Nov 19, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Nov 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Avoid more cases of allocating a transformation matrix on the heap.
parent
8180b900
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
26 deletions
+13
-26
graphics.c
dlls/gdiplus/graphics.c
+13
-26
No files found.
dlls/gdiplus/graphics.c
View file @
b9ead1a7
...
...
@@ -1439,7 +1439,7 @@ static void draw_cap(GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL s
const
GpCustomLineCap
*
custom
,
REAL
x1
,
REAL
y1
,
REAL
x2
,
REAL
y2
)
{
HGDIOBJ
oldbrush
=
NULL
,
oldpen
=
NULL
;
GpMatrix
*
matrix
=
NULL
;
GpMatrix
matrix
;
HBRUSH
brush
=
NULL
;
HPEN
pen
=
NULL
;
PointF
ptf
[
4
],
*
custptf
=
NULL
;
...
...
@@ -1584,16 +1584,17 @@ static void draw_cap(GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL s
custpt
=
GdipAlloc
(
count
*
sizeof
(
POINT
));
tp
=
GdipAlloc
(
count
);
if
(
!
custptf
||
!
custpt
||
!
tp
||
(
GdipCreateMatrix
(
&
matrix
)
!=
Ok
)
)
if
(
!
custptf
||
!
custpt
||
!
tp
)
goto
custend
;
memcpy
(
custptf
,
custom
->
pathdata
.
Points
,
count
*
sizeof
(
PointF
));
GdipScaleMatrix
(
matrix
,
size
,
size
,
MatrixOrderAppend
);
GdipRotateMatrix
(
matrix
,
(
180
.
0
/
M_PI
)
*
(
theta
-
M_PI_2
),
GdipSetMatrixElements
(
&
matrix
,
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
);
GdipScaleMatrix
(
&
matrix
,
size
,
size
,
MatrixOrderAppend
);
GdipRotateMatrix
(
&
matrix
,
(
180
.
0
/
M_PI
)
*
(
theta
-
M_PI_2
),
MatrixOrderAppend
);
GdipTranslateMatrix
(
matrix
,
x2
,
y2
,
MatrixOrderAppend
);
GdipTransformMatrixPoints
(
matrix
,
custptf
,
count
);
GdipTranslateMatrix
(
&
matrix
,
x2
,
y2
,
MatrixOrderAppend
);
GdipTransformMatrixPoints
(
&
matrix
,
custptf
,
count
);
transform_and_round_points
(
graphics
,
custpt
,
custptf
,
count
);
...
...
@@ -1613,7 +1614,6 @@ custend:
GdipFree
(
custptf
);
GdipFree
(
custpt
);
GdipFree
(
tp
);
GdipDeleteMatrix
(
matrix
);
break
;
default:
break
;
...
...
@@ -3127,7 +3127,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
RECT
dst_area
;
GpRect
src_area
;
int
i
,
x
,
y
,
src_stride
,
dst_stride
;
GpMatrix
*
dst_to_src
;
GpMatrix
dst_to_src
;
REAL
m11
,
m12
,
m21
,
m22
,
mdx
,
mdy
;
LPBYTE
src_data
,
dst_data
;
BitmapData
lockeddata
;
...
...
@@ -3159,22 +3159,13 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
m22
=
(
ptf
[
2
].
Y
-
ptf
[
0
].
Y
)
/
srcheight
;
mdy
=
ptf
[
0
].
Y
-
m12
*
srcx
-
m22
*
srcy
;
stat
=
GdipCreateMatrix2
(
m11
,
m12
,
m21
,
m22
,
mdx
,
mdy
,
&
dst_to_src
);
if
(
stat
!=
Ok
)
return
stat
;
GdipSetMatrixElements
(
&
dst_to_src
,
m11
,
m12
,
m21
,
m22
,
mdx
,
mdy
);
stat
=
GdipInvertMatrix
(
dst_to_src
);
if
(
stat
!=
Ok
)
{
GdipDeleteMatrix
(
dst_to_src
);
return
stat
;
}
stat
=
GdipInvertMatrix
(
&
dst_to_src
);
if
(
stat
!=
Ok
)
return
stat
;
dst_data
=
GdipAlloc
(
sizeof
(
ARGB
)
*
(
dst_area
.
right
-
dst_area
.
left
)
*
(
dst_area
.
bottom
-
dst_area
.
top
));
if
(
!
dst_data
)
{
GdipDeleteMatrix
(
dst_to_src
);
return
OutOfMemory
;
}
if
(
!
dst_data
)
return
OutOfMemory
;
dst_stride
=
sizeof
(
ARGB
)
*
(
dst_area
.
right
-
dst_area
.
left
);
...
...
@@ -3187,7 +3178,6 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
if
(
!
src_data
)
{
GdipFree
(
dst_data
);
GdipDeleteMatrix
(
dst_to_src
);
return
OutOfMemory
;
}
src_stride
=
sizeof
(
ARGB
)
*
src_area
.
Width
;
...
...
@@ -3210,7 +3200,6 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
if
(
src_data
!=
dst_data
)
GdipFree
(
src_data
);
GdipFree
(
dst_data
);
GdipDeleteMatrix
(
dst_to_src
);
return
stat
;
}
...
...
@@ -3219,7 +3208,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
src_stride
,
ColorAdjustTypeBitmap
);
/* Transform the bits as needed to the destination. */
GdipTransformMatrixPoints
(
dst_to_src
,
dst_to_src_points
,
3
);
GdipTransformMatrixPoints
(
&
dst_to_src
,
dst_to_src_points
,
3
);
x_dx
=
dst_to_src_points
[
1
].
X
-
dst_to_src_points
[
0
].
X
;
x_dy
=
dst_to_src_points
[
1
].
Y
-
dst_to_src_points
[
0
].
Y
;
...
...
@@ -3246,8 +3235,6 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
}
}
GdipDeleteMatrix
(
dst_to_src
);
GdipFree
(
src_data
);
stat
=
alpha_blend_pixels
(
graphics
,
dst_area
.
left
,
dst_area
.
top
,
...
...
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