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
6ee26aca
Commit
6ee26aca
authored
Mar 23, 2015
by
Vincent Povirk
Committed by
Alexandre Julliard
Mar 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Apply page scale to pen thickness.
parent
792b47ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
124 additions
and
0 deletions
+124
-0
graphics.c
dlls/gdiplus/graphics.c
+1
-0
graphics.c
dlls/gdiplus/tests/graphics.c
+123
-0
No files found.
dlls/gdiplus/graphics.c
View file @
6ee26aca
...
...
@@ -251,6 +251,7 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
(
pt
[
1
].
Y
-
pt
[
0
].
Y
)
*
(
pt
[
1
].
Y
-
pt
[
0
].
Y
))
/
sqrt
(
2
.
0
);
width
*=
units_to_pixels
(
pen
->
width
,
pen
->
unit
==
UnitWorld
?
graphics
->
unit
:
pen
->
unit
,
graphics
->
xres
);
width
*=
graphics
->
scale
;
}
if
(
pen
->
dash
==
DashStyleCustom
){
...
...
dlls/gdiplus/tests/graphics.c
View file @
6ee26aca
...
...
@@ -3813,6 +3813,128 @@ static void test_transform(void)
}
}
static
void
test_pen_thickness
(
void
)
{
static
const
struct
test_data
{
REAL
res_x
,
res_y
,
scale
;
GpUnit
pen_unit
,
page_unit
;
REAL
pen_width
;
INT
cx
,
cy
;
}
td
[]
=
{
{
10
.
0
,
10
.
0
,
1
.
0
,
UnitPixel
,
UnitPixel
,
1
.
0
,
1
,
1
},
{
10
.
0
,
10
.
0
,
3
.
0
,
UnitPixel
,
UnitPixel
,
2
.
0
,
2
,
2
},
{
10
.
0
,
10
.
0
,
30
.
0
,
UnitPixel
,
UnitInch
,
1
.
0
,
1
,
1
},
{
10
.
0
,
10
.
0
,
1
.
0
,
UnitWorld
,
UnitPixel
,
1
.
0
,
1
,
1
},
{
10
.
0
,
10
.
0
,
3
.
0
,
UnitWorld
,
UnitPixel
,
2
.
0
,
6
,
6
},
{
10
.
0
,
10
.
0
,
2
.
0
,
UnitWorld
,
UnitInch
,
1
.
0
,
20
,
20
},
};
GpStatus
status
;
int
i
,
j
;
GpGraphics
*
graphics
;
union
{
GpBitmap
*
bitmap
;
GpImage
*
image
;
}
u
;
GpPen
*
pen
;
GpPointF
corner
;
BitmapData
bd
;
INT
min
,
max
,
size
;
for
(
i
=
0
;
i
<
sizeof
(
td
)
/
sizeof
(
td
[
0
]);
i
++
)
{
status
=
GdipCreateBitmapFromScan0
(
100
,
100
,
0
,
PixelFormat24bppRGB
,
NULL
,
&
u
.
bitmap
);
expect
(
Ok
,
status
);
status
=
GdipBitmapSetResolution
(
u
.
bitmap
,
td
[
i
].
res_x
,
td
[
i
].
res_y
);
expect
(
Ok
,
status
);
status
=
GdipGetImageGraphicsContext
(
u
.
image
,
&
graphics
);
expect
(
Ok
,
status
);
status
=
GdipSetPageUnit
(
graphics
,
td
[
i
].
page_unit
);
expect
(
Ok
,
status
);
status
=
GdipSetPageScale
(
graphics
,
td
[
i
].
scale
);
expect
(
Ok
,
status
);
status
=
GdipCreatePen1
(
0xffffffff
,
td
[
i
].
pen_width
,
td
[
i
].
pen_unit
,
&
pen
);
expect
(
Ok
,
status
);
corner
.
X
=
corner
.
Y
=
100
.
0
;
status
=
GdipTransformPoints
(
graphics
,
CoordinateSpaceWorld
,
CoordinateSpaceDevice
,
&
corner
,
1
);
expect
(
Ok
,
status
);
status
=
GdipDrawLine
(
graphics
,
pen
,
corner
.
X
/
2
,
0
,
corner
.
X
/
2
,
corner
.
Y
);
expect
(
Ok
,
status
);
status
=
GdipDrawLine
(
graphics
,
pen
,
0
,
corner
.
Y
/
2
,
corner
.
X
,
corner
.
Y
/
2
);
expect
(
Ok
,
status
);
status
=
GdipBitmapLockBits
(
u
.
bitmap
,
NULL
,
ImageLockModeRead
,
PixelFormat24bppRGB
,
&
bd
);
expect
(
Ok
,
status
);
min
=
-
1
;
max
=
-
2
;
for
(
j
=
0
;
j
<
100
;
j
++
)
{
if
(((
BYTE
*
)
bd
.
Scan0
)[
j
*
3
]
==
0xff
)
{
min
=
j
;
break
;
}
}
for
(
j
=
99
;
j
>=
0
;
j
--
)
{
if
(((
BYTE
*
)
bd
.
Scan0
)[
j
*
3
]
==
0xff
)
{
max
=
j
;
break
;
}
}
size
=
max
-
min
+
1
;
ok
(
size
==
td
[
i
].
cx
,
"%u: expected %d, got %d
\n
"
,
i
,
td
[
i
].
cx
,
size
);
min
=
-
1
;
max
=
-
2
;
for
(
j
=
0
;
j
<
100
;
j
++
)
{
if
(((
BYTE
*
)
bd
.
Scan0
)[
bd
.
Stride
*
j
]
==
0xff
)
{
min
=
j
;
break
;
}
}
for
(
j
=
99
;
j
>=
0
;
j
--
)
{
if
(((
BYTE
*
)
bd
.
Scan0
)[
bd
.
Stride
*
j
]
==
0xff
)
{
max
=
j
;
break
;
}
}
size
=
max
-
min
+
1
;
ok
(
size
==
td
[
i
].
cy
,
"%u: expected %d, got %d
\n
"
,
i
,
td
[
i
].
cy
,
size
);
status
=
GdipBitmapUnlockBits
(
u
.
bitmap
,
&
bd
);
expect
(
Ok
,
status
);
GdipDeletePen
(
pen
);
GdipDeleteGraphics
(
graphics
);
GdipDisposeImage
(
u
.
image
);
}
}
/* Many people on the net ask why there is so much difference in rendered
* text height between gdiplus and gdi32, this test suggests an answer to
* that question. Important: this test assumes that font dpi == device dpi.
...
...
@@ -5728,6 +5850,7 @@ START_TEST(graphics)
test_measure_string
();
test_font_height_scaling
();
test_transform
();
test_pen_thickness
();
test_GdipMeasureString
();
test_constructor_destructor
();
test_save_restore
();
...
...
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