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
92473283
Commit
92473283
authored
Oct 30, 2012
by
Huw Davies
Committed by
Alexandre Julliard
Oct 30, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Implement sub-pixel glyph smoothing.
parent
7f50df4e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
295 additions
and
9 deletions
+295
-9
dibdrv.h
dlls/gdi32/dibdrv/dibdrv.h
+2
-0
graphics.c
dlls/gdi32/dibdrv/graphics.c
+31
-5
primitives.c
dlls/gdi32/dibdrv/primitives.c
+153
-0
font.c
dlls/gdi32/font.c
+109
-4
No files found.
dlls/gdi32/dibdrv/dibdrv.h
View file @
92473283
...
@@ -183,6 +183,8 @@ typedef struct primitive_funcs
...
@@ -183,6 +183,8 @@ typedef struct primitive_funcs
BOOL
(
*
gradient_rect
)(
const
dib_info
*
dib
,
const
RECT
*
rc
,
const
TRIVERTEX
*
v
,
int
mode
);
BOOL
(
*
gradient_rect
)(
const
dib_info
*
dib
,
const
RECT
*
rc
,
const
TRIVERTEX
*
v
,
int
mode
);
void
(
*
draw_glyph
)(
const
dib_info
*
dst
,
const
RECT
*
rc
,
const
dib_info
*
glyph
,
void
(
*
draw_glyph
)(
const
dib_info
*
dst
,
const
RECT
*
rc
,
const
dib_info
*
glyph
,
const
POINT
*
origin
,
DWORD
text_pixel
,
const
struct
intensity_range
*
ranges
);
const
POINT
*
origin
,
DWORD
text_pixel
,
const
struct
intensity_range
*
ranges
);
void
(
*
draw_subpixel_glyph
)(
const
dib_info
*
dst
,
const
RECT
*
rc
,
const
dib_info
*
glyph
,
const
POINT
*
origin
,
DWORD
text_pixel
);
DWORD
(
*
get_pixel
)(
const
dib_info
*
dib
,
int
x
,
int
y
);
DWORD
(
*
get_pixel
)(
const
dib_info
*
dib
,
int
x
,
int
y
);
DWORD
(
*
colorref_to_pixel
)(
const
dib_info
*
dib
,
COLORREF
color
);
DWORD
(
*
colorref_to_pixel
)(
const
dib_info
*
dib
,
COLORREF
color
);
COLORREF
(
*
pixel_to_colorref
)(
const
dib_info
*
dib
,
DWORD
pixel
);
COLORREF
(
*
pixel_to_colorref
)(
const
dib_info
*
dib
,
DWORD
pixel
);
...
...
dlls/gdi32/dibdrv/graphics.c
View file @
92473283
...
@@ -462,12 +462,38 @@ static void draw_glyph( dib_info *dib, int x, int y, const GLYPHMETRICS *metrics
...
@@ -462,12 +462,38 @@ static void draw_glyph( dib_info *dib, int x, int y, const GLYPHMETRICS *metrics
src_origin
.
x
=
clipped_rect
.
left
-
rect
.
left
;
src_origin
.
x
=
clipped_rect
.
left
-
rect
.
left
;
src_origin
.
y
=
clipped_rect
.
top
-
rect
.
top
;
src_origin
.
y
=
clipped_rect
.
top
-
rect
.
top
;
dib
->
funcs
->
draw_glyph
(
dib
,
&
clipped_rect
,
glyph_dib
,
&
src_origin
,
if
(
glyph_dib
->
bit_count
==
32
)
text_color
,
ranges
);
dib
->
funcs
->
draw_subpixel_glyph
(
dib
,
&
clipped_rect
,
glyph_dib
,
&
src_origin
,
text_color
);
else
dib
->
funcs
->
draw_glyph
(
dib
,
&
clipped_rect
,
glyph_dib
,
&
src_origin
,
text_color
,
ranges
);
}
}
}
}
}
}
static
int
get_glyph_depth
(
UINT
aa_flags
)
{
switch
(
aa_flags
)
{
case
GGO_BITMAP
:
return
1
;
case
GGO_GRAY2_BITMAP
:
case
GGO_GRAY4_BITMAP
:
case
GGO_GRAY8_BITMAP
:
case
WINE_GGO_GRAY16_BITMAP
:
return
8
;
case
WINE_GGO_HRGB_BITMAP
:
case
WINE_GGO_HBGR_BITMAP
:
case
WINE_GGO_VRGB_BITMAP
:
case
WINE_GGO_VBGR_BITMAP
:
return
32
;
default:
ERR
(
"Unexpected flags %08x
\n
"
,
aa_flags
);
return
0
;
}
}
static
const
BYTE
masks
[
8
]
=
{
0x80
,
0x40
,
0x20
,
0x10
,
0x08
,
0x04
,
0x02
,
0x01
};
static
const
BYTE
masks
[
8
]
=
{
0x80
,
0x40
,
0x20
,
0x10
,
0x08
,
0x04
,
0x02
,
0x01
};
static
const
int
padding
[
4
]
=
{
0
,
3
,
2
,
1
};
static
const
int
padding
[
4
]
=
{
0
,
3
,
2
,
1
};
...
@@ -488,7 +514,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags, GLYPHMETRICS
...
@@ -488,7 +514,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags, GLYPHMETRICS
int
i
,
x
,
y
;
int
i
,
x
,
y
;
DWORD
ret
,
size
;
DWORD
ret
,
size
;
BYTE
*
buf
,
*
dst
,
*
src
;
BYTE
*
buf
,
*
dst
,
*
src
;
int
pad
;
int
pad
=
0
,
depth
=
get_glyph_depth
(
aa_flags
)
;
glyph_dib
->
bits
.
ptr
=
NULL
;
glyph_dib
->
bits
.
ptr
=
NULL
;
glyph_dib
->
bits
.
is_copy
=
FALSE
;
glyph_dib
->
bits
.
is_copy
=
FALSE
;
...
@@ -508,7 +534,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags, GLYPHMETRICS
...
@@ -508,7 +534,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags, GLYPHMETRICS
if
(
!
ret
)
return
ERROR_SUCCESS
;
/* empty glyph */
if
(
!
ret
)
return
ERROR_SUCCESS
;
/* empty glyph */
/* We'll convert non-antialiased 1-bpp bitmaps to 8-bpp, so these sizes relate to 8-bpp */
/* We'll convert non-antialiased 1-bpp bitmaps to 8-bpp, so these sizes relate to 8-bpp */
glyph_dib
->
bit_count
=
8
;
glyph_dib
->
bit_count
=
depth
==
1
?
8
:
depth
;
glyph_dib
->
width
=
metrics
->
gmBlackBoxX
;
glyph_dib
->
width
=
metrics
->
gmBlackBoxX
;
glyph_dib
->
height
=
metrics
->
gmBlackBoxY
;
glyph_dib
->
height
=
metrics
->
gmBlackBoxY
;
glyph_dib
->
rect
.
left
=
0
;
glyph_dib
->
rect
.
left
=
0
;
...
@@ -517,7 +543,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags, GLYPHMETRICS
...
@@ -517,7 +543,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT aa_flags, GLYPHMETRICS
glyph_dib
->
rect
.
bottom
=
metrics
->
gmBlackBoxY
;
glyph_dib
->
rect
.
bottom
=
metrics
->
gmBlackBoxY
;
glyph_dib
->
stride
=
get_dib_stride
(
metrics
->
gmBlackBoxX
,
glyph_dib
->
bit_count
);
glyph_dib
->
stride
=
get_dib_stride
(
metrics
->
gmBlackBoxX
,
glyph_dib
->
bit_count
);
pad
=
padding
[
metrics
->
gmBlackBoxX
%
4
];
if
(
glyph_dib
->
bit_count
==
8
)
pad
=
padding
[
metrics
->
gmBlackBoxX
%
4
];
size
=
metrics
->
gmBlackBoxY
*
glyph_dib
->
stride
;
size
=
metrics
->
gmBlackBoxY
*
glyph_dib
->
stride
;
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
...
...
dlls/gdi32/dibdrv/primitives.c
View file @
92473283
...
@@ -4859,6 +4859,150 @@ static void draw_glyph_null( const dib_info *dib, const RECT *rect, const dib_in
...
@@ -4859,6 +4859,150 @@ static void draw_glyph_null( const dib_info *dib, const RECT *rect, const dib_in
return
;
return
;
}
}
static
DWORD
blend_subpixel
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
DWORD
text
,
DWORD
alpha
)
{
return
blend_color
(
r
,
text
>>
16
,
(
BYTE
)(
alpha
>>
16
)
)
<<
16
|
blend_color
(
g
,
text
>>
8
,
(
BYTE
)(
alpha
>>
8
)
)
<<
8
|
blend_color
(
b
,
text
,
(
BYTE
)
alpha
);
}
static
void
draw_subpixel_glyph_8888
(
const
dib_info
*
dib
,
const
RECT
*
rect
,
const
dib_info
*
glyph
,
const
POINT
*
origin
,
DWORD
text_pixel
)
{
DWORD
*
dst_ptr
=
get_pixel_ptr_32
(
dib
,
rect
->
left
,
rect
->
top
);
const
DWORD
*
glyph_ptr
=
get_pixel_ptr_32
(
glyph
,
origin
->
x
,
origin
->
y
);
int
x
,
y
;
for
(
y
=
rect
->
top
;
y
<
rect
->
bottom
;
y
++
)
{
for
(
x
=
0
;
x
<
rect
->
right
-
rect
->
left
;
x
++
)
{
if
(
glyph_ptr
[
x
]
==
0
)
continue
;
dst_ptr
[
x
]
=
blend_subpixel
(
dst_ptr
[
x
]
>>
16
,
dst_ptr
[
x
]
>>
8
,
dst_ptr
[
x
],
text_pixel
,
glyph_ptr
[
x
]
);
}
dst_ptr
+=
dib
->
stride
/
4
;
glyph_ptr
+=
glyph
->
stride
/
4
;
}
}
static
void
draw_subpixel_glyph_32
(
const
dib_info
*
dib
,
const
RECT
*
rect
,
const
dib_info
*
glyph
,
const
POINT
*
origin
,
DWORD
text_pixel
)
{
DWORD
*
dst_ptr
=
get_pixel_ptr_32
(
dib
,
rect
->
left
,
rect
->
top
);
const
DWORD
*
glyph_ptr
=
get_pixel_ptr_32
(
glyph
,
origin
->
x
,
origin
->
y
);
int
x
,
y
;
DWORD
text
,
val
;
text
=
get_field
(
text_pixel
,
dib
->
red_shift
,
dib
->
red_len
)
<<
16
|
get_field
(
text_pixel
,
dib
->
green_shift
,
dib
->
green_len
)
<<
8
|
get_field
(
text_pixel
,
dib
->
blue_shift
,
dib
->
blue_len
);
for
(
y
=
rect
->
top
;
y
<
rect
->
bottom
;
y
++
)
{
for
(
x
=
0
;
x
<
rect
->
right
-
rect
->
left
;
x
++
)
{
if
(
glyph_ptr
[
x
]
==
0
)
continue
;
val
=
blend_subpixel
(
get_field
(
dst_ptr
[
x
],
dib
->
red_shift
,
dib
->
red_len
),
get_field
(
dst_ptr
[
x
],
dib
->
green_shift
,
dib
->
green_len
),
get_field
(
dst_ptr
[
x
],
dib
->
blue_shift
,
dib
->
blue_len
),
text
,
glyph_ptr
[
x
]
);
dst_ptr
[
x
]
=
(
put_field
(
val
>>
16
,
dib
->
red_shift
,
dib
->
red_len
)
|
put_field
(
val
>>
8
,
dib
->
green_shift
,
dib
->
green_len
)
|
put_field
(
val
,
dib
->
blue_shift
,
dib
->
blue_len
));
}
dst_ptr
+=
dib
->
stride
/
4
;
glyph_ptr
+=
glyph
->
stride
/
4
;
}
}
static
void
draw_subpixel_glyph_24
(
const
dib_info
*
dib
,
const
RECT
*
rect
,
const
dib_info
*
glyph
,
const
POINT
*
origin
,
DWORD
text_pixel
)
{
BYTE
*
dst_ptr
=
get_pixel_ptr_24
(
dib
,
rect
->
left
,
rect
->
top
);
const
DWORD
*
glyph_ptr
=
get_pixel_ptr_32
(
glyph
,
origin
->
x
,
origin
->
y
);
int
x
,
y
;
DWORD
val
;
for
(
y
=
rect
->
top
;
y
<
rect
->
bottom
;
y
++
)
{
for
(
x
=
0
;
x
<
rect
->
right
-
rect
->
left
;
x
++
)
{
if
(
glyph_ptr
[
x
]
==
0
)
continue
;
val
=
blend_subpixel
(
dst_ptr
[
x
*
3
+
2
],
dst_ptr
[
x
*
3
+
1
],
dst_ptr
[
x
*
3
],
text_pixel
,
glyph_ptr
[
x
]
);
dst_ptr
[
x
*
3
]
=
val
;
dst_ptr
[
x
*
3
+
1
]
=
val
>>
8
;
dst_ptr
[
x
*
3
+
2
]
=
val
>>
16
;
}
dst_ptr
+=
dib
->
stride
;
glyph_ptr
+=
glyph
->
stride
/
4
;
}
}
static
void
draw_subpixel_glyph_555
(
const
dib_info
*
dib
,
const
RECT
*
rect
,
const
dib_info
*
glyph
,
const
POINT
*
origin
,
DWORD
text_pixel
)
{
WORD
*
dst_ptr
=
get_pixel_ptr_16
(
dib
,
rect
->
left
,
rect
->
top
);
const
DWORD
*
glyph_ptr
=
get_pixel_ptr_32
(
glyph
,
origin
->
x
,
origin
->
y
);
int
x
,
y
;
DWORD
text
,
val
;
text
=
((
text_pixel
<<
9
)
&
0xf80000
)
|
((
text_pixel
<<
4
)
&
0x070000
)
|
((
text_pixel
<<
6
)
&
0x00f800
)
|
((
text_pixel
<<
1
)
&
0x000700
)
|
((
text_pixel
<<
3
)
&
0x0000f8
)
|
((
text_pixel
>>
2
)
&
0x000007
);
for
(
y
=
rect
->
top
;
y
<
rect
->
bottom
;
y
++
)
{
for
(
x
=
0
;
x
<
rect
->
right
-
rect
->
left
;
x
++
)
{
if
(
glyph_ptr
[
x
]
==
0
)
continue
;
val
=
blend_subpixel
(
((
dst_ptr
[
x
]
>>
7
)
&
0xf8
)
|
((
dst_ptr
[
x
]
>>
12
)
&
0x07
),
((
dst_ptr
[
x
]
>>
2
)
&
0xf8
)
|
((
dst_ptr
[
x
]
>>
7
)
&
0x07
),
((
dst_ptr
[
x
]
<<
3
)
&
0xf8
)
|
((
dst_ptr
[
x
]
>>
2
)
&
0x07
),
text
,
glyph_ptr
[
x
]
);
dst_ptr
[
x
]
=
((
val
>>
9
)
&
0x7c00
)
|
((
val
>>
6
)
&
0x03e0
)
|
((
val
>>
3
)
&
0x001f
);
}
dst_ptr
+=
dib
->
stride
/
2
;
glyph_ptr
+=
glyph
->
stride
/
4
;
}
}
static
void
draw_subpixel_glyph_16
(
const
dib_info
*
dib
,
const
RECT
*
rect
,
const
dib_info
*
glyph
,
const
POINT
*
origin
,
DWORD
text_pixel
)
{
WORD
*
dst_ptr
=
get_pixel_ptr_16
(
dib
,
rect
->
left
,
rect
->
top
);
const
DWORD
*
glyph_ptr
=
get_pixel_ptr_32
(
glyph
,
origin
->
x
,
origin
->
y
);
int
x
,
y
;
DWORD
text
,
val
;
text
=
get_field
(
text_pixel
,
dib
->
red_shift
,
dib
->
red_len
)
<<
16
|
get_field
(
text_pixel
,
dib
->
green_shift
,
dib
->
green_len
)
<<
8
|
get_field
(
text_pixel
,
dib
->
blue_shift
,
dib
->
blue_len
);
for
(
y
=
rect
->
top
;
y
<
rect
->
bottom
;
y
++
)
{
for
(
x
=
0
;
x
<
rect
->
right
-
rect
->
left
;
x
++
)
{
if
(
glyph_ptr
[
x
]
==
0
)
continue
;
val
=
blend_subpixel
(
get_field
(
dst_ptr
[
x
],
dib
->
red_shift
,
dib
->
red_len
),
get_field
(
dst_ptr
[
x
],
dib
->
green_shift
,
dib
->
green_len
),
get_field
(
dst_ptr
[
x
],
dib
->
blue_shift
,
dib
->
blue_len
),
text
,
glyph_ptr
[
x
]
);
dst_ptr
[
x
]
=
(
put_field
(
val
>>
16
,
dib
->
red_shift
,
dib
->
red_len
)
|
put_field
(
val
>>
8
,
dib
->
green_shift
,
dib
->
green_len
)
|
put_field
(
val
,
dib
->
blue_shift
,
dib
->
blue_len
));
}
dst_ptr
+=
dib
->
stride
/
2
;
glyph_ptr
+=
glyph
->
stride
/
4
;
}
}
static
void
draw_subpixel_glyph_null
(
const
dib_info
*
dib
,
const
RECT
*
rect
,
const
dib_info
*
glyph
,
const
POINT
*
origin
,
DWORD
text_pixel
)
{
return
;
}
static
void
create_rop_masks_32
(
const
dib_info
*
dib
,
const
BYTE
*
hatch_ptr
,
static
void
create_rop_masks_32
(
const
dib_info
*
dib
,
const
BYTE
*
hatch_ptr
,
const
rop_mask
*
fg
,
const
rop_mask
*
bg
,
rop_mask_bits
*
bits
)
const
rop_mask
*
fg
,
const
rop_mask
*
bg
,
rop_mask_bits
*
bits
)
{
{
...
@@ -5647,6 +5791,7 @@ const primitive_funcs funcs_8888 =
...
@@ -5647,6 +5791,7 @@ const primitive_funcs funcs_8888 =
blend_rect_8888
,
blend_rect_8888
,
gradient_rect_8888
,
gradient_rect_8888
,
draw_glyph_8888
,
draw_glyph_8888
,
draw_subpixel_glyph_8888
,
get_pixel_32
,
get_pixel_32
,
colorref_to_pixel_888
,
colorref_to_pixel_888
,
pixel_to_colorref_888
,
pixel_to_colorref_888
,
...
@@ -5666,6 +5811,7 @@ const primitive_funcs funcs_32 =
...
@@ -5666,6 +5811,7 @@ const primitive_funcs funcs_32 =
blend_rect_32
,
blend_rect_32
,
gradient_rect_32
,
gradient_rect_32
,
draw_glyph_32
,
draw_glyph_32
,
draw_subpixel_glyph_32
,
get_pixel_32
,
get_pixel_32
,
colorref_to_pixel_masks
,
colorref_to_pixel_masks
,
pixel_to_colorref_masks
,
pixel_to_colorref_masks
,
...
@@ -5685,6 +5831,7 @@ const primitive_funcs funcs_24 =
...
@@ -5685,6 +5831,7 @@ const primitive_funcs funcs_24 =
blend_rect_24
,
blend_rect_24
,
gradient_rect_24
,
gradient_rect_24
,
draw_glyph_24
,
draw_glyph_24
,
draw_subpixel_glyph_24
,
get_pixel_24
,
get_pixel_24
,
colorref_to_pixel_888
,
colorref_to_pixel_888
,
pixel_to_colorref_888
,
pixel_to_colorref_888
,
...
@@ -5704,6 +5851,7 @@ const primitive_funcs funcs_555 =
...
@@ -5704,6 +5851,7 @@ const primitive_funcs funcs_555 =
blend_rect_555
,
blend_rect_555
,
gradient_rect_555
,
gradient_rect_555
,
draw_glyph_555
,
draw_glyph_555
,
draw_subpixel_glyph_555
,
get_pixel_16
,
get_pixel_16
,
colorref_to_pixel_555
,
colorref_to_pixel_555
,
pixel_to_colorref_555
,
pixel_to_colorref_555
,
...
@@ -5723,6 +5871,7 @@ const primitive_funcs funcs_16 =
...
@@ -5723,6 +5871,7 @@ const primitive_funcs funcs_16 =
blend_rect_16
,
blend_rect_16
,
gradient_rect_16
,
gradient_rect_16
,
draw_glyph_16
,
draw_glyph_16
,
draw_subpixel_glyph_16
,
get_pixel_16
,
get_pixel_16
,
colorref_to_pixel_masks
,
colorref_to_pixel_masks
,
pixel_to_colorref_masks
,
pixel_to_colorref_masks
,
...
@@ -5742,6 +5891,7 @@ const primitive_funcs funcs_8 =
...
@@ -5742,6 +5891,7 @@ const primitive_funcs funcs_8 =
blend_rect_8
,
blend_rect_8
,
gradient_rect_8
,
gradient_rect_8
,
draw_glyph_8
,
draw_glyph_8
,
draw_subpixel_glyph_null
,
get_pixel_8
,
get_pixel_8
,
colorref_to_pixel_colortable
,
colorref_to_pixel_colortable
,
pixel_to_colorref_colortable
,
pixel_to_colorref_colortable
,
...
@@ -5761,6 +5911,7 @@ const primitive_funcs funcs_4 =
...
@@ -5761,6 +5911,7 @@ const primitive_funcs funcs_4 =
blend_rect_4
,
blend_rect_4
,
gradient_rect_4
,
gradient_rect_4
,
draw_glyph_4
,
draw_glyph_4
,
draw_subpixel_glyph_null
,
get_pixel_4
,
get_pixel_4
,
colorref_to_pixel_colortable
,
colorref_to_pixel_colortable
,
pixel_to_colorref_colortable
,
pixel_to_colorref_colortable
,
...
@@ -5780,6 +5931,7 @@ const primitive_funcs funcs_1 =
...
@@ -5780,6 +5931,7 @@ const primitive_funcs funcs_1 =
blend_rect_1
,
blend_rect_1
,
gradient_rect_1
,
gradient_rect_1
,
draw_glyph_1
,
draw_glyph_1
,
draw_subpixel_glyph_null
,
get_pixel_1
,
get_pixel_1
,
colorref_to_pixel_colortable
,
colorref_to_pixel_colortable
,
pixel_to_colorref_colortable
,
pixel_to_colorref_colortable
,
...
@@ -5799,6 +5951,7 @@ const primitive_funcs funcs_null =
...
@@ -5799,6 +5951,7 @@ const primitive_funcs funcs_null =
blend_rect_null
,
blend_rect_null
,
gradient_rect_null
,
gradient_rect_null
,
draw_glyph_null
,
draw_glyph_null
,
draw_subpixel_glyph_null
,
get_pixel_null
,
get_pixel_null
,
colorref_to_pixel_null
,
colorref_to_pixel_null
,
pixel_to_colorref_null
,
pixel_to_colorref_null
,
...
...
dlls/gdi32/font.c
View file @
92473283
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include "winbase.h"
#include "winbase.h"
#include "winnls.h"
#include "winnls.h"
#include "winternl.h"
#include "winternl.h"
#include "winreg.h"
#include "gdi_private.h"
#include "gdi_private.h"
#include "wine/exception.h"
#include "wine/exception.h"
#include "wine/unicode.h"
#include "wine/unicode.h"
...
@@ -328,10 +329,74 @@ done:
...
@@ -328,10 +329,74 @@ done:
return
ret
;
return
ret
;
}
}
enum
smoothing
{
no_smoothing
,
aa_smoothing
,
subpixel_smoothing
};
static
DWORD
get_desktop_value
(
const
WCHAR
*
name
,
DWORD
*
value
)
{
static
const
WCHAR
desktop
[]
=
{
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
' '
,
'P'
,
'a'
,
'n'
,
'e'
,
'l'
,
'\\'
,
'D'
,
'e'
,
's'
,
'k'
,
't'
,
'o'
,
'p'
,
0
};
HKEY
key
;
WCHAR
buf
[
12
];
DWORD
count
=
sizeof
(
buf
),
type
,
err
;
err
=
RegOpenKeyW
(
HKEY_CURRENT_USER
,
desktop
,
&
key
);
if
(
!
err
)
{
err
=
RegQueryValueExW
(
key
,
name
,
NULL
,
&
type
,
(
BYTE
*
)
buf
,
&
count
);
if
(
!
err
)
*
value
=
atoiW
(
buf
);
RegCloseKey
(
key
);
}
return
err
;
}
static
enum
smoothing
get_default_smoothing
(
void
)
{
static
const
WCHAR
smoothing_type
[]
=
{
'F'
,
'o'
,
'n'
,
't'
,
'S'
,
'm'
,
'o'
,
'o'
,
't'
,
'h'
,
'i'
,
'n'
,
'g'
,
'T'
,
'y'
,
'p'
,
'e'
,
0
};
DWORD
type
,
err
;
/* FIXME: Ignoring FontSmoothing for now since this is
set to off by default in wine.inf */
err
=
get_desktop_value
(
smoothing_type
,
&
type
);
if
(
err
)
return
aa_smoothing
;
switch
(
type
)
{
case
1
:
/* FE_FONTSMOOTHINGSTANDARD */
return
aa_smoothing
;
case
2
:
/* FE_FONTSMOOTHINGCLEARTYPE */
return
subpixel_smoothing
;
}
return
aa_smoothing
;
}
static
UINT
get_subpixel_orientation
(
void
)
{
static
const
WCHAR
smoothing_orientation
[]
=
{
'F'
,
'o'
,
'n'
,
't'
,
'S'
,
'm'
,
'o'
,
'o'
,
't'
,
'h'
,
'i'
,
'n'
,
'g'
,
'O'
,
'r'
,
'i'
,
'e'
,
'n'
,
't'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
DWORD
orient
,
err
;
/* FIXME: handle vertical orientations even though Windows doesn't */
err
=
get_desktop_value
(
smoothing_orientation
,
&
orient
);
if
(
err
)
return
GGO_GRAY4_BITMAP
;
switch
(
orient
)
{
case
0
:
/* FE_FONTSMOOTHINGORIENTATIONBGR */
return
WINE_GGO_HBGR_BITMAP
;
case
1
:
/* FE_FONTSMOOTHINGORIENTATIONRGB */
return
WINE_GGO_HRGB_BITMAP
;
}
return
GGO_GRAY4_BITMAP
;
}
UINT
get_font_aa_flags
(
HDC
hdc
)
UINT
get_font_aa_flags
(
HDC
hdc
)
{
{
LOGFONTW
lf
;
LOGFONTW
lf
;
WORD
gasp_flags
;
WORD
gasp_flags
;
static
int
hinter
=
-
1
;
static
int
subpixel_enabled
=
-
1
;
enum
smoothing
smoothing
;
if
(
GetObjectType
(
hdc
)
==
OBJ_MEMDC
)
if
(
GetObjectType
(
hdc
)
==
OBJ_MEMDC
)
{
{
...
@@ -344,11 +409,48 @@ UINT get_font_aa_flags( HDC hdc )
...
@@ -344,11 +409,48 @@ UINT get_font_aa_flags( HDC hdc )
GetObjectW
(
GetCurrentObject
(
hdc
,
OBJ_FONT
),
sizeof
(
lf
),
&
lf
);
GetObjectW
(
GetCurrentObject
(
hdc
,
OBJ_FONT
),
sizeof
(
lf
),
&
lf
);
if
(
lf
.
lfQuality
==
NONANTIALIASED_QUALITY
)
return
GGO_BITMAP
;
if
(
lf
.
lfQuality
==
NONANTIALIASED_QUALITY
)
return
GGO_BITMAP
;
if
(
get_gasp_flags
(
hdc
,
&
gasp_flags
)
&&
!
(
gasp_flags
&
GASP_DOGRAY
))
if
(
hinter
==
-
1
||
subpixel_enabled
==
-
1
)
return
GGO_BITMAP
;
{
RASTERIZER_STATUS
status
;
GetRasterizerCaps
(
&
status
,
sizeof
(
status
));
hinter
=
status
.
wFlags
&
WINE_TT_HINTER_ENABLED
;
subpixel_enabled
=
status
.
wFlags
&
WINE_TT_SUBPIXEL_RENDERING_ENABLED
;
}
/* FIXME, check user prefs */
switch
(
lf
.
lfQuality
)
return
GGO_GRAY4_BITMAP
;
{
case
ANTIALIASED_QUALITY
:
smoothing
=
aa_smoothing
;
break
;
case
CLEARTYPE_QUALITY
:
case
CLEARTYPE_NATURAL_QUALITY
:
smoothing
=
subpixel_smoothing
;
break
;
case
DEFAULT_QUALITY
:
case
DRAFT_QUALITY
:
case
PROOF_QUALITY
:
default:
smoothing
=
get_default_smoothing
();
}
if
(
smoothing
==
subpixel_smoothing
)
{
if
(
subpixel_enabled
)
{
UINT
ret
=
get_subpixel_orientation
();
if
(
ret
!=
GGO_GRAY4_BITMAP
)
return
ret
;
}
smoothing
=
aa_smoothing
;
}
if
(
smoothing
==
aa_smoothing
)
{
if
(
hinter
&&
get_gasp_flags
(
hdc
,
&
gasp_flags
)
&&
!
(
gasp_flags
&
GASP_DOGRAY
))
return
GGO_BITMAP
;
return
GGO_GRAY4_BITMAP
;
}
return
GGO_BITMAP
;
}
}
/***********************************************************************
/***********************************************************************
...
@@ -1877,6 +1979,9 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect
...
@@ -1877,6 +1979,9 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect
struct
bitblt_coords
src
,
dst
;
struct
bitblt_coords
src
,
dst
;
PHYSDEV
dst_dev
;
PHYSDEV
dst_dev
;
/* FIXME Subpixel modes */
aa_flags
=
GGO_GRAY4_BITMAP
;
dst_dev
=
GET_DC_PHYSDEV
(
dc
,
pPutImage
);
dst_dev
=
GET_DC_PHYSDEV
(
dc
,
pPutImage
);
src
.
visrect
=
get_total_extents
(
dev
->
hdc
,
x
,
y
,
flags
,
aa_flags
,
str
,
count
,
dx
);
src
.
visrect
=
get_total_extents
(
dev
->
hdc
,
x
,
y
,
flags
,
aa_flags
,
str
,
count
,
dx
);
if
(
flags
&
ETO_CLIPPED
)
intersect_rect
(
&
src
.
visrect
,
&
src
.
visrect
,
rect
);
if
(
flags
&
ETO_CLIPPED
)
intersect_rect
(
&
src
.
visrect
,
&
src
.
visrect
,
rect
);
...
...
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