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
85a57106
Commit
85a57106
authored
Aug 08, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
Aug 17, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Don't require an HDC for the convert_unit function.
parent
e2b4d4e7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
19 deletions
+28
-19
gdiplus.c
dlls/gdiplus/gdiplus.c
+5
-5
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+1
-1
graphics.c
dlls/gdiplus/graphics.c
+9
-3
image.c
dlls/gdiplus/image.c
+13
-10
No files found.
dlls/gdiplus/gdiplus.c
View file @
85a57106
...
@@ -314,18 +314,18 @@ GpStatus hresult_to_status(HRESULT res)
...
@@ -314,18 +314,18 @@ GpStatus hresult_to_status(HRESULT res)
}
}
/* converts a given unit to its value in pixels */
/* converts a given unit to its value in pixels */
REAL
convert_unit
(
HDC
hdc
,
GpUnit
unit
)
REAL
convert_unit
(
REAL
logpixels
,
GpUnit
unit
)
{
{
switch
(
unit
)
switch
(
unit
)
{
{
case
UnitInch
:
case
UnitInch
:
return
(
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
)
;
return
logpixels
;
case
UnitPoint
:
case
UnitPoint
:
return
((
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
))
/
72
.
0
;
return
logpixels
/
72
.
0
;
case
UnitDocument
:
case
UnitDocument
:
return
((
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
))
/
300
.
0
;
return
logpixels
/
300
.
0
;
case
UnitMillimeter
:
case
UnitMillimeter
:
return
((
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
))
/
25
.
4
;
return
logpixels
/
25
.
4
;
case
UnitWorld
:
case
UnitWorld
:
ERR
(
"cannot convert UnitWorld
\n
"
);
ERR
(
"cannot convert UnitWorld
\n
"
);
return
0
.
0
;
return
0
.
0
;
...
...
dlls/gdiplus/gdiplus_private.h
View file @
85a57106
...
@@ -47,7 +47,7 @@ extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
...
@@ -47,7 +47,7 @@ extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
REAL
startAngle
,
REAL
sweepAngle
);
REAL
startAngle
,
REAL
sweepAngle
);
extern
REAL
gdiplus_atan2
(
REAL
dy
,
REAL
dx
);
extern
REAL
gdiplus_atan2
(
REAL
dy
,
REAL
dx
);
extern
GpStatus
hresult_to_status
(
HRESULT
res
);
extern
GpStatus
hresult_to_status
(
HRESULT
res
);
extern
REAL
convert_unit
(
HDC
hdc
,
GpUnit
unit
);
extern
REAL
convert_unit
(
REAL
logpixels
,
GpUnit
unit
);
extern
void
calc_curve_bezier
(
CONST
GpPointF
*
pts
,
REAL
tension
,
REAL
*
x1
,
extern
void
calc_curve_bezier
(
CONST
GpPointF
*
pts
,
REAL
tension
,
REAL
*
x1
,
REAL
*
y1
,
REAL
*
x2
,
REAL
*
y2
);
REAL
*
y1
,
REAL
*
x2
,
REAL
*
y2
);
...
...
dlls/gdiplus/graphics.c
View file @
85a57106
...
@@ -84,6 +84,12 @@ static BYTE convert_path_point_type(BYTE type)
...
@@ -84,6 +84,12 @@ static BYTE convert_path_point_type(BYTE type)
return
ret
;
return
ret
;
}
}
static
REAL
graphics_res
(
GpGraphics
*
graphics
)
{
if
(
graphics
->
image
)
return
graphics
->
image
->
xres
;
else
return
(
REAL
)
GetDeviceCaps
(
graphics
->
hdc
,
LOGPIXELSX
);
}
static
INT
prepare_dc
(
GpGraphics
*
graphics
,
GpPen
*
pen
)
static
INT
prepare_dc
(
GpGraphics
*
graphics
,
GpPen
*
pen
)
{
{
HPEN
gdipen
;
HPEN
gdipen
;
...
@@ -108,7 +114,7 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
...
@@ -108,7 +114,7 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
width
=
sqrt
((
pt
[
1
].
X
-
pt
[
0
].
X
)
*
(
pt
[
1
].
X
-
pt
[
0
].
X
)
+
width
=
sqrt
((
pt
[
1
].
X
-
pt
[
0
].
X
)
*
(
pt
[
1
].
X
-
pt
[
0
].
X
)
+
(
pt
[
1
].
Y
-
pt
[
0
].
Y
)
*
(
pt
[
1
].
Y
-
pt
[
0
].
Y
))
/
sqrt
(
2
.
0
);
(
pt
[
1
].
Y
-
pt
[
0
].
Y
)
*
(
pt
[
1
].
Y
-
pt
[
0
].
Y
))
/
sqrt
(
2
.
0
);
width
*=
pen
->
width
*
convert_unit
(
graphics
->
hdc
,
width
*=
pen
->
width
*
convert_unit
(
graphics
_res
(
graphics
)
,
pen
->
unit
==
UnitWorld
?
graphics
->
unit
:
pen
->
unit
);
pen
->
unit
==
UnitWorld
?
graphics
->
unit
:
pen
->
unit
);
}
}
...
@@ -156,7 +162,7 @@ static void transform_and_round_points(GpGraphics *graphics, POINT *pti,
...
@@ -156,7 +162,7 @@ static void transform_and_round_points(GpGraphics *graphics, POINT *pti,
GpMatrix
*
matrix
;
GpMatrix
*
matrix
;
int
i
;
int
i
;
unitscale
=
convert_unit
(
graphics
->
hdc
,
graphics
->
unit
);
unitscale
=
convert_unit
(
graphics
_res
(
graphics
)
,
graphics
->
unit
);
/* apply page scale */
/* apply page scale */
if
(
graphics
->
unit
!=
UnitDisplay
)
if
(
graphics
->
unit
!=
UnitDisplay
)
...
@@ -4602,7 +4608,7 @@ GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace
...
@@ -4602,7 +4608,7 @@ GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace
stat
=
GdipCreateMatrix
(
&
matrix
);
stat
=
GdipCreateMatrix
(
&
matrix
);
if
(
stat
==
Ok
)
if
(
stat
==
Ok
)
{
{
unitscale
=
convert_unit
(
graphics
->
hdc
,
graphics
->
unit
);
unitscale
=
convert_unit
(
graphics
_res
(
graphics
)
,
graphics
->
unit
);
if
(
graphics
->
unit
!=
UnitDisplay
)
if
(
graphics
->
unit
!=
UnitDisplay
)
unitscale
*=
graphics
->
scale
;
unitscale
*=
graphics
->
scale
;
...
...
dlls/gdiplus/image.c
View file @
85a57106
...
@@ -2008,14 +2008,15 @@ GpStatus WINGDIPAPI GdipGetImageDimension(GpImage *image, REAL *width,
...
@@ -2008,14 +2008,15 @@ GpStatus WINGDIPAPI GdipGetImageDimension(GpImage *image, REAL *width,
if
(
image
->
type
==
ImageTypeMetafile
){
if
(
image
->
type
==
ImageTypeMetafile
){
HDC
hdc
=
GetDC
(
0
);
HDC
hdc
=
GetDC
(
0
);
REAL
res
=
(
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
*
height
=
convert_unit
(
hdc
,
((
GpMetafile
*
)
image
)
->
unit
)
*
ReleaseDC
(
0
,
hdc
);
*
height
=
convert_unit
(
res
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Height
;
((
GpMetafile
*
)
image
)
->
bounds
.
Height
;
*
width
=
convert_unit
(
hdc
,
((
GpMetafile
*
)
image
)
->
unit
)
*
*
width
=
convert_unit
(
res
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Width
;
((
GpMetafile
*
)
image
)
->
bounds
.
Width
;
ReleaseDC
(
0
,
hdc
);
}
}
else
if
(
image
->
type
==
ImageTypeBitmap
){
else
if
(
image
->
type
==
ImageTypeBitmap
){
...
@@ -2072,11 +2073,12 @@ GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
...
@@ -2072,11 +2073,12 @@ GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
if
(
image
->
type
==
ImageTypeMetafile
){
if
(
image
->
type
==
ImageTypeMetafile
){
HDC
hdc
=
GetDC
(
0
);
HDC
hdc
=
GetDC
(
0
);
REAL
res
=
(
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
*
height
=
roundr
(
convert_unit
(
hdc
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Height
);
ReleaseDC
(
0
,
hdc
);
ReleaseDC
(
0
,
hdc
);
*
height
=
roundr
(
convert_unit
(
res
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Height
);
}
}
else
if
(
image
->
type
==
ImageTypeBitmap
)
else
if
(
image
->
type
==
ImageTypeBitmap
)
*
height
=
((
GpBitmap
*
)
image
)
->
height
;
*
height
=
((
GpBitmap
*
)
image
)
->
height
;
...
@@ -2178,11 +2180,12 @@ GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
...
@@ -2178,11 +2180,12 @@ GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
if
(
image
->
type
==
ImageTypeMetafile
){
if
(
image
->
type
==
ImageTypeMetafile
){
HDC
hdc
=
GetDC
(
0
);
HDC
hdc
=
GetDC
(
0
);
REAL
res
=
(
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
*
width
=
roundr
(
convert_unit
(
hdc
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Width
);
ReleaseDC
(
0
,
hdc
);
ReleaseDC
(
0
,
hdc
);
*
width
=
roundr
(
convert_unit
(
res
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Width
);
}
}
else
if
(
image
->
type
==
ImageTypeBitmap
)
else
if
(
image
->
type
==
ImageTypeBitmap
)
*
width
=
((
GpBitmap
*
)
image
)
->
width
;
*
width
=
((
GpBitmap
*
)
image
)
->
width
;
...
...
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