bfc_decode_feature_switch.c
3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include "bfc_decode_raster.h"
#include "bfc_decode_rgb565.h"
#include "bfc_decode_rgb888.h"
#include "bfc_decode_argb8888.h"
#include "bfc_decode_1bpp.h"
static const SetPixelFuncNoClip setPixelFuncNoClip[5][5] =
{
{
setPixel1BPPNormalNoClip,//1BPP just support Normal style,so switch all other style to Normal style.
setPixel1BPPNormalNoClip,
setPixel1BPPNormalNoClip,
setPixel1BPPNormalNoClip,
setPixel1BPPNormalNoClip
},
{
setPixelRGB565NormalNoClip,
setPixelRGB565BoldNoClip,
setPixelRGB565ItalicNoClip,
setPixelRGB565BoldItalicNoClip,
setPixelRGB565BorderNoClip
},
{
setPixelRGB888NormalNoClip,
setPixelRGB888BoldNoClip,
setPixelRGB888ItalicNoClip,
setPixelRGB888BoldItalicNoClip,
setPixelRGB888BorderNoClip
},
{
setPixelARGB8888NormalNoClip,
setPixelARGB8888BoldNoClip,
setPixelARGB8888ItalicNoClip,
setPixelARGB8888BoldItalicNoClip,
setPixelARGB8888BorderNoClip
},
{
setPixelARGB8888NormalNoClip,
setPixelARGB8888BoldNoClip,
setPixelARGB8888ItalicNoClip,
setPixelARGB8888BoldItalicNoClip,
setPixelARGB8888BorderNoClip
}
};
static const SetPixelFuncWithClip setPixelFuncWithClip[5][5] =
{
{
setPixel1BPPNormalWithClip,//1BPP just support Normal style,so switch all other style to Normal style.
setPixel1BPPNormalWithClip,
setPixel1BPPNormalWithClip,
setPixel1BPPNormalWithClip,
setPixel1BPPNormalWithClip
},
{
setPixelRGB565NormalWithClip,
setPixelRGB565BoldWithClip,
setPixelRGB565ItalicWithClip,
setPixelRGB565BoldItalicWithClip,
setPixelRGB565BorderWithClip
},
{
setPixelRGB888NormalWithClip,
setPixelRGB888BoldWithClip,
setPixelRGB888ItalicWithClip,
setPixelRGB888BoldItalicWithClip,
setPixelRGB888BorderWithClip
},
{
setPixelARGB8888NormalWithClip,
setPixelARGB8888BoldWithClip,
setPixelARGB8888ItalicWithClip,
setPixelARGB8888BoldItalicWithClip,
setPixelARGB8888BorderWithClip
},
{
setPixelARGB8888NormalWithClip,
setPixelARGB8888BoldWithClip,
setPixelARGB8888ItalicWithClip,
setPixelARGB8888BoldItalicWithClip,
setPixelARGB8888BorderWithClip
}
};
static kal_int32 mapStyleToIndex(BFC_STYLE_ENUM style)
{
kal_uint32 select;
switch(style)
{
case BFC_STYLE_NORMAL:
select = 0;
break;
case BFC_STYLE_BOLD:
select = 1;
break;
case BFC_STYLE_ITALIC:
select = 2;
break;
case BFC_STYLE_BOLD_ITALIC:
select = 3;
break;
case BFC_STYLE_BORDER:
select = 4;
break;
default:
ASSERT(0);
return -1;
}
return select;
}
SetPixelFuncNoClip getRasterFuncNoClip(BFC_RGB_FORMAT_ENUM format, BFC_STYLE_ENUM style)
{
return setPixelFuncNoClip[format][mapStyleToIndex(style)];
}
SetPixelFuncWithClip getRasterFuncWithClip(BFC_RGB_FORMAT_ENUM format, BFC_STYLE_ENUM style)
{
return setPixelFuncWithClip[format][mapStyleToIndex(style)];
}