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
a7b2f5e8
Commit
a7b2f5e8
authored
Apr 15, 2015
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Take the world transform into account when calculating the bitmap brush texcoord transform.
parent
aad0ab81
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
21 deletions
+44
-21
render_target.c
dlls/d2d1/render_target.c
+44
-21
No files found.
dlls/d2d1/render_target.c
View file @
a7b2f5e8
...
...
@@ -32,6 +32,18 @@ struct d2d_draw_text_layout_ctx
D2D1_DRAW_TEXT_OPTIONS
options
;
};
static
void
d2d_matrix_multiply
(
D2D_MATRIX_3X2_F
*
a
,
const
D2D_MATRIX_3X2_F
*
b
)
{
D2D_MATRIX_3X2_F
tmp
=
*
a
;
a
->
_11
=
tmp
.
_11
*
b
->
_11
+
tmp
.
_12
*
b
->
_21
;
a
->
_12
=
tmp
.
_11
*
b
->
_12
+
tmp
.
_12
*
b
->
_22
;
a
->
_21
=
tmp
.
_21
*
b
->
_11
+
tmp
.
_22
*
b
->
_21
;
a
->
_22
=
tmp
.
_21
*
b
->
_12
+
tmp
.
_22
*
b
->
_22
;
a
->
_31
=
tmp
.
_31
*
b
->
_11
+
tmp
.
_32
*
b
->
_21
+
b
->
_31
;
a
->
_32
=
tmp
.
_31
*
b
->
_12
+
tmp
.
_32
*
b
->
_22
+
b
->
_32
;
}
static
void
d2d_point_transform
(
D2D1_POINT_2F
*
dst
,
const
D2D1_MATRIX_3X2_F
*
matrix
,
float
x
,
float
y
)
{
dst
->
x
=
x
*
matrix
->
_11
+
y
*
matrix
->
_21
+
matrix
->
_31
;
...
...
@@ -543,7 +555,7 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillRectangle(ID2D1RenderTar
{
float
_11
,
_21
,
_31
,
pad0
;
float
_12
,
_22
,
_32
,
pad1
;
}
transform
,
transform_inverse
;
}
transform
;
TRACE
(
"iface %p, rect %p, brush %p.
\n
"
,
iface
,
rect
,
brush
);
...
...
@@ -598,38 +610,49 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillRectangle(ID2D1RenderTar
if
(
brush_impl
->
type
==
D2D_BRUSH_TYPE_BITMAP
)
{
struct
d2d_bitmap
*
bitmap
=
brush_impl
->
u
.
bitmap
.
bitmap
;
float
rt_scale
,
rt_bitmap_scale
,
d
;
D2D_MATRIX_3X2_F
w
,
b
;
float
dpi_scale
,
d
;
ps
=
render_target
->
rect_bitmap_ps
;
/* Scale for dpi. */
w
=
render_target
->
drawing_state
.
transform
;
dpi_scale
=
render_target
->
dpi_x
/
96
.
0
f
;
w
.
_11
*=
dpi_scale
;
w
.
_21
*=
dpi_scale
;
w
.
_31
*=
dpi_scale
;
dpi_scale
=
render_target
->
dpi_y
/
96
.
0
f
;
w
.
_12
*=
dpi_scale
;
w
.
_22
*=
dpi_scale
;
w
.
_32
*=
dpi_scale
;
/* Scale for bitmap size and dpi. */
rt_scale
=
render_target
->
dpi_x
/
96
.
0
f
;
rt_bitmap_scale
=
bitmap
->
pixel_size
.
width
*
(
bitmap
->
dpi_x
/
96
.
0
f
)
*
rt_scale
;
transform
.
_11
=
brush_impl
->
transform
.
_11
*
rt_bitmap_scale
;
transform
.
_21
=
brush_impl
->
transform
.
_21
*
rt_bitmap_scale
;
transform
.
_31
=
brush_impl
->
transform
.
_31
*
rt_scale
;
rt_scale
=
render_target
->
dpi_y
/
96
.
0
f
;
rt_bitmap_scale
=
bitmap
->
pixel_size
.
height
*
(
bitmap
->
dpi_y
/
96
.
0
f
)
*
rt_scale
;
transform
.
_12
=
brush_impl
->
transform
.
_12
*
rt_bitmap_scale
;
transform
.
_22
=
brush_impl
->
transform
.
_22
*
rt_bitmap_scale
;
transform
.
_32
=
brush_impl
->
transform
.
_32
*
rt_scale
;
b
=
brush_impl
->
transform
;
dpi_scale
=
bitmap
->
pixel_size
.
width
*
(
bitmap
->
dpi_x
/
96
.
0
f
);
b
.
_11
*=
dpi_scale
;
b
.
_21
*=
dpi_scale
;
dpi_scale
=
bitmap
->
pixel_size
.
height
*
(
bitmap
->
dpi_y
/
96
.
0
f
);
b
.
_12
*=
dpi_scale
;
b
.
_22
*=
dpi_scale
;
d2d_matrix_multiply
(
&
b
,
&
w
);
/* Invert the matrix. (Because the matrix is applied to the sampling
* coordinates. I.e., to scale the bitmap by 2 we need to divide the
* coordinates by 2.) */
d
=
transform
.
_11
*
transform
.
_22
-
transform
.
_21
*
transform
.
_12
;
d
=
b
.
_11
*
b
.
_22
-
b
.
_21
*
b
.
_12
;
if
(
d
!=
0
.
0
f
)
{
transform
_inverse
.
_11
=
transform
.
_22
/
d
;
transform
_inverse
.
_21
=
-
transform
.
_21
/
d
;
transform
_inverse
.
_31
=
(
transform
.
_21
*
transform
.
_32
-
transform
.
_31
*
transform
.
_22
)
/
d
;
transform
_inverse
.
_12
=
-
transform
.
_12
/
d
;
transform
_inverse
.
_22
=
transform
.
_11
/
d
;
transform
_inverse
.
_32
=
-
(
transform
.
_11
*
transform
.
_32
-
transform
.
_31
*
transform
.
_12
)
/
d
;
transform
.
_11
=
b
.
_22
/
d
;
transform
.
_21
=
-
b
.
_21
/
d
;
transform
.
_31
=
(
b
.
_21
*
b
.
_32
-
b
.
_31
*
b
.
_22
)
/
d
;
transform
.
_12
=
-
b
.
_12
/
d
;
transform
.
_22
=
b
.
_11
/
d
;
transform
.
_32
=
-
(
b
.
_11
*
b
.
_32
-
b
.
_31
*
b
.
_12
)
/
d
;
}
buffer_desc
.
ByteWidth
=
sizeof
(
transform
_inverse
);
buffer_data
.
pSysMem
=
&
transform
_inverse
;
buffer_desc
.
ByteWidth
=
sizeof
(
transform
);
buffer_data
.
pSysMem
=
&
transform
;
}
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