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
6bb35385
Commit
6bb35385
authored
Aug 15, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Aug 15, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Replace convert_unit() by a clearer units_to_pixels() helper.
parent
6f462555
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
59 deletions
+11
-59
gdiplus.c
dlls/gdiplus/gdiplus.c
+0
-23
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+0
-1
graphics.c
dlls/gdiplus/graphics.c
+5
-6
image.c
dlls/gdiplus/image.c
+6
-29
No files found.
dlls/gdiplus/gdiplus.c
View file @
6bb35385
...
...
@@ -320,29 +320,6 @@ GpStatus hresult_to_status(HRESULT res)
}
}
/* converts a given unit to its value in inches */
REAL
convert_unit
(
REAL
logpixels
,
GpUnit
unit
)
{
switch
(
unit
)
{
case
UnitInch
:
return
logpixels
;
case
UnitPoint
:
return
logpixels
/
72
.
0
;
case
UnitDocument
:
return
logpixels
/
300
.
0
;
case
UnitMillimeter
:
return
logpixels
/
25
.
4
;
case
UnitWorld
:
ERR
(
"cannot convert UnitWorld
\n
"
);
return
0
.
0
;
case
UnitPixel
:
case
UnitDisplay
:
default:
return
1
.
0
;
}
}
/* converts a given unit to its value in pixels */
REAL
units_to_pixels
(
REAL
units
,
GpUnit
unit
,
REAL
dpi
)
{
...
...
dlls/gdiplus/gdiplus_private.h
View file @
6bb35385
...
...
@@ -48,7 +48,6 @@ extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
REAL
startAngle
,
REAL
sweepAngle
)
DECLSPEC_HIDDEN
;
extern
REAL
gdiplus_atan2
(
REAL
dy
,
REAL
dx
)
DECLSPEC_HIDDEN
;
extern
GpStatus
hresult_to_status
(
HRESULT
res
)
DECLSPEC_HIDDEN
;
extern
REAL
convert_unit
(
REAL
logpixels
,
GpUnit
unit
)
DECLSPEC_HIDDEN
;
extern
REAL
units_to_pixels
(
REAL
units
,
GpUnit
unit
,
REAL
dpi
)
DECLSPEC_HIDDEN
;
extern
REAL
pixels_to_units
(
REAL
pixels
,
GpUnit
unit
,
REAL
dpi
)
DECLSPEC_HIDDEN
;
extern
REAL
units_scale
(
GpUnit
from
,
GpUnit
to
,
REAL
dpi
)
DECLSPEC_HIDDEN
;
...
...
dlls/gdiplus/graphics.c
View file @
6bb35385
...
...
@@ -254,8 +254,7 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
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
);
width
*=
pen
->
width
*
convert_unit
(
graphics
->
xres
,
pen
->
unit
==
UnitWorld
?
graphics
->
unit
:
pen
->
unit
);
width
*=
units_to_pixels
(
pen
->
width
,
pen
->
unit
==
UnitWorld
?
graphics
->
unit
:
pen
->
unit
,
graphics
->
xres
);
}
if
(
pen
->
dash
==
DashStyleCustom
){
...
...
@@ -311,8 +310,8 @@ static void transform_and_round_points(GpGraphics *graphics, POINT *pti,
GpMatrix
*
matrix
;
int
i
;
scale_x
=
convert_unit
(
graphics
->
xres
,
graphics
->
unit
);
scale_y
=
convert_unit
(
graphics
->
yres
,
graphics
->
unit
);
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
)
...
...
@@ -5990,8 +5989,8 @@ static GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace d
if
(
dst_space
!=
src_space
&&
stat
==
Ok
)
{
scale_x
=
convert_unit
(
graphics
->
xres
,
graphics
->
unit
);
scale_y
=
convert_unit
(
graphics
->
yres
,
graphics
->
unit
);
scale_x
=
units_to_pixels
(
1
.
0
,
graphics
->
unit
,
graphics
->
xres
);
scale_y
=
units_to_pixels
(
1
.
0
,
graphics
->
unit
,
graphics
->
yres
);
if
(
graphics
->
unit
!=
UnitDisplay
)
{
...
...
dlls/gdiplus/image.c
View file @
6bb35385
...
...
@@ -2256,18 +2256,9 @@ GpStatus WINGDIPAPI GdipGetImageDimension(GpImage *image, REAL *width,
return
InvalidParameter
;
if
(
image
->
type
==
ImageTypeMetafile
){
HDC
hdc
=
GetDC
(
0
);
REAL
res
=
(
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
ReleaseDC
(
0
,
hdc
);
*
height
=
convert_unit
(
res
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Height
;
*
width
=
convert_unit
(
res
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Width
;
*
height
=
units_to_pixels
(((
GpMetafile
*
)
image
)
->
bounds
.
Height
,
((
GpMetafile
*
)
image
)
->
unit
,
image
->
yres
);
*
width
=
units_to_pixels
(((
GpMetafile
*
)
image
)
->
bounds
.
Width
,
((
GpMetafile
*
)
image
)
->
unit
,
image
->
xres
);
}
else
if
(
image
->
type
==
ImageTypeBitmap
){
*
height
=
((
GpBitmap
*
)
image
)
->
height
;
*
width
=
((
GpBitmap
*
)
image
)
->
width
;
...
...
@@ -2326,15 +2317,8 @@ GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
if
(
!
image
||
!
height
)
return
InvalidParameter
;
if
(
image
->
type
==
ImageTypeMetafile
){
HDC
hdc
=
GetDC
(
0
);
REAL
res
=
(
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
ReleaseDC
(
0
,
hdc
);
*
height
=
roundr
(
convert_unit
(
res
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Height
);
}
if
(
image
->
type
==
ImageTypeMetafile
)
*
height
=
units_to_pixels
(((
GpMetafile
*
)
image
)
->
bounds
.
Height
,
((
GpMetafile
*
)
image
)
->
unit
,
image
->
yres
);
else
if
(
image
->
type
==
ImageTypeBitmap
)
*
height
=
((
GpBitmap
*
)
image
)
->
height
;
else
...
...
@@ -2433,15 +2417,8 @@ GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
if
(
!
image
||
!
width
)
return
InvalidParameter
;
if
(
image
->
type
==
ImageTypeMetafile
){
HDC
hdc
=
GetDC
(
0
);
REAL
res
=
(
REAL
)
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
ReleaseDC
(
0
,
hdc
);
*
width
=
roundr
(
convert_unit
(
res
,
((
GpMetafile
*
)
image
)
->
unit
)
*
((
GpMetafile
*
)
image
)
->
bounds
.
Width
);
}
if
(
image
->
type
==
ImageTypeMetafile
)
*
width
=
units_to_pixels
(((
GpMetafile
*
)
image
)
->
bounds
.
Width
,
((
GpMetafile
*
)
image
)
->
unit
,
image
->
xres
);
else
if
(
image
->
type
==
ImageTypeBitmap
)
*
width
=
((
GpBitmap
*
)
image
)
->
width
;
else
...
...
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