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
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
Show 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
...
@@ -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
)
const
GpCustomLineCap
*
custom
,
REAL
x1
,
REAL
y1
,
REAL
x2
,
REAL
y2
)
{
{
HGDIOBJ
oldbrush
=
NULL
,
oldpen
=
NULL
;
HGDIOBJ
oldbrush
=
NULL
,
oldpen
=
NULL
;
GpMatrix
*
matrix
=
NULL
;
GpMatrix
matrix
;
HBRUSH
brush
=
NULL
;
HBRUSH
brush
=
NULL
;
HPEN
pen
=
NULL
;
HPEN
pen
=
NULL
;
PointF
ptf
[
4
],
*
custptf
=
NULL
;
PointF
ptf
[
4
],
*
custptf
=
NULL
;
...
@@ -1584,16 +1584,17 @@ static void draw_cap(GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL s
...
@@ -1584,16 +1584,17 @@ static void draw_cap(GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL s
custpt
=
GdipAlloc
(
count
*
sizeof
(
POINT
));
custpt
=
GdipAlloc
(
count
*
sizeof
(
POINT
));
tp
=
GdipAlloc
(
count
);
tp
=
GdipAlloc
(
count
);
if
(
!
custptf
||
!
custpt
||
!
tp
||
(
GdipCreateMatrix
(
&
matrix
)
!=
Ok
)
)
if
(
!
custptf
||
!
custpt
||
!
tp
)
goto
custend
;
goto
custend
;
memcpy
(
custptf
,
custom
->
pathdata
.
Points
,
count
*
sizeof
(
PointF
));
memcpy
(
custptf
,
custom
->
pathdata
.
Points
,
count
*
sizeof
(
PointF
));
GdipScaleMatrix
(
matrix
,
size
,
size
,
MatrixOrderAppend
);
GdipSetMatrixElements
(
&
matrix
,
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
);
GdipRotateMatrix
(
matrix
,
(
180
.
0
/
M_PI
)
*
(
theta
-
M_PI_2
),
GdipScaleMatrix
(
&
matrix
,
size
,
size
,
MatrixOrderAppend
);
GdipRotateMatrix
(
&
matrix
,
(
180
.
0
/
M_PI
)
*
(
theta
-
M_PI_2
),
MatrixOrderAppend
);
MatrixOrderAppend
);
GdipTranslateMatrix
(
matrix
,
x2
,
y2
,
MatrixOrderAppend
);
GdipTranslateMatrix
(
&
matrix
,
x2
,
y2
,
MatrixOrderAppend
);
GdipTransformMatrixPoints
(
matrix
,
custptf
,
count
);
GdipTransformMatrixPoints
(
&
matrix
,
custptf
,
count
);
transform_and_round_points
(
graphics
,
custpt
,
custptf
,
count
);
transform_and_round_points
(
graphics
,
custpt
,
custptf
,
count
);
...
@@ -1613,7 +1614,6 @@ custend:
...
@@ -1613,7 +1614,6 @@ custend:
GdipFree
(
custptf
);
GdipFree
(
custptf
);
GdipFree
(
custpt
);
GdipFree
(
custpt
);
GdipFree
(
tp
);
GdipFree
(
tp
);
GdipDeleteMatrix
(
matrix
);
break
;
break
;
default:
default:
break
;
break
;
...
@@ -3127,7 +3127,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
...
@@ -3127,7 +3127,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
RECT
dst_area
;
RECT
dst_area
;
GpRect
src_area
;
GpRect
src_area
;
int
i
,
x
,
y
,
src_stride
,
dst_stride
;
int
i
,
x
,
y
,
src_stride
,
dst_stride
;
GpMatrix
*
dst_to_src
;
GpMatrix
dst_to_src
;
REAL
m11
,
m12
,
m21
,
m22
,
mdx
,
mdy
;
REAL
m11
,
m12
,
m21
,
m22
,
mdx
,
mdy
;
LPBYTE
src_data
,
dst_data
;
LPBYTE
src_data
,
dst_data
;
BitmapData
lockeddata
;
BitmapData
lockeddata
;
...
@@ -3159,22 +3159,13 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
...
@@ -3159,22 +3159,13 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
m22
=
(
ptf
[
2
].
Y
-
ptf
[
0
].
Y
)
/
srcheight
;
m22
=
(
ptf
[
2
].
Y
-
ptf
[
0
].
Y
)
/
srcheight
;
mdy
=
ptf
[
0
].
Y
-
m12
*
srcx
-
m22
*
srcy
;
mdy
=
ptf
[
0
].
Y
-
m12
*
srcx
-
m22
*
srcy
;
stat
=
GdipCreateMatrix2
(
m11
,
m12
,
m21
,
m22
,
mdx
,
mdy
,
&
dst_to_src
);
GdipSetMatrixElements
(
&
dst_to_src
,
m11
,
m12
,
m21
,
m22
,
mdx
,
mdy
);
if
(
stat
!=
Ok
)
return
stat
;
stat
=
GdipInvertMatrix
(
dst_to_src
);
stat
=
GdipInvertMatrix
(
&
dst_to_src
);
if
(
stat
!=
Ok
)
if
(
stat
!=
Ok
)
return
stat
;
{
GdipDeleteMatrix
(
dst_to_src
);
return
stat
;
}
dst_data
=
GdipAlloc
(
sizeof
(
ARGB
)
*
(
dst_area
.
right
-
dst_area
.
left
)
*
(
dst_area
.
bottom
-
dst_area
.
top
));
dst_data
=
GdipAlloc
(
sizeof
(
ARGB
)
*
(
dst_area
.
right
-
dst_area
.
left
)
*
(
dst_area
.
bottom
-
dst_area
.
top
));
if
(
!
dst_data
)
if
(
!
dst_data
)
return
OutOfMemory
;
{
GdipDeleteMatrix
(
dst_to_src
);
return
OutOfMemory
;
}
dst_stride
=
sizeof
(
ARGB
)
*
(
dst_area
.
right
-
dst_area
.
left
);
dst_stride
=
sizeof
(
ARGB
)
*
(
dst_area
.
right
-
dst_area
.
left
);
...
@@ -3187,7 +3178,6 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
...
@@ -3187,7 +3178,6 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
if
(
!
src_data
)
if
(
!
src_data
)
{
{
GdipFree
(
dst_data
);
GdipFree
(
dst_data
);
GdipDeleteMatrix
(
dst_to_src
);
return
OutOfMemory
;
return
OutOfMemory
;
}
}
src_stride
=
sizeof
(
ARGB
)
*
src_area
.
Width
;
src_stride
=
sizeof
(
ARGB
)
*
src_area
.
Width
;
...
@@ -3210,7 +3200,6 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
...
@@ -3210,7 +3200,6 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
if
(
src_data
!=
dst_data
)
if
(
src_data
!=
dst_data
)
GdipFree
(
src_data
);
GdipFree
(
src_data
);
GdipFree
(
dst_data
);
GdipFree
(
dst_data
);
GdipDeleteMatrix
(
dst_to_src
);
return
stat
;
return
stat
;
}
}
...
@@ -3219,7 +3208,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
...
@@ -3219,7 +3208,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
src_stride
,
ColorAdjustTypeBitmap
);
src_stride
,
ColorAdjustTypeBitmap
);
/* Transform the bits as needed to the destination. */
/* 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_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
;
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
...
@@ -3246,8 +3235,6 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
}
}
}
}
GdipDeleteMatrix
(
dst_to_src
);
GdipFree
(
src_data
);
GdipFree
(
src_data
);
stat
=
alpha_blend_pixels
(
graphics
,
dst_area
.
left
,
dst_area
.
top
,
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