Lines 80-99
Link Here
|
80 |
static uint16_t bcmfb_palette16[16] = { |
80 |
static struct argb bcmfb_palette[16] = { |
81 |
0x0000, |
|
|
82 |
0x0015, |
83 |
0x0540, |
84 |
0x0555, |
85 |
0xa800, |
86 |
0xa815, |
87 |
0xaaa0, |
88 |
0xad55, |
89 |
0x52aa, |
90 |
0x52bf, |
91 |
0x57ea, |
92 |
0x57ff, |
93 |
0xfaaa, |
94 |
0xfabf, |
95 |
0xffea, |
96 |
0xffff |
97 |
}; |
98 |
|
99 |
static struct argb bcmfb_palette24[16] = { |
100 |
-- |
Lines 118-136
Link Here
|
118 |
static uint32_t bcmfb_palette32[16] = { |
|
|
119 |
0x00000000, |
120 |
0x00aa0000, |
121 |
0x0000aa00, |
122 |
0x00aaaa00, |
123 |
0x000000aa, |
124 |
0x00aa00aa, |
125 |
0x000055aa, |
126 |
0x00aaaaaa, |
127 |
0x00555555, |
128 |
0x00ff5555, |
129 |
0x0055ff55, |
130 |
0x00ffff55, |
131 |
0x005555ff, |
132 |
0x00ff55ff, |
133 |
0x0055ffff, |
134 |
0x00ffffff |
135 |
}; |
136 |
|
Line 943
Link Here
|
943 |
int i, j; |
905 |
int i, j, k; |
944 |
-- |
|
|
Lines 945-946
Link Here
|
945 |
uint16_t *addr16; |
|
|
946 |
uint32_t *addr32; |
Lines 948-953
Link Here
|
948 |
uint8_t fg, bg; |
908 |
uint8_t fg, bg, color; |
949 |
uint32_t fg32, bg32; |
909 |
uint16_t rgb; |
950 |
uint8_t fg24r, bg24r, fg24g, bg24g, fg24b, bg24b; |
|
|
951 |
uint16_t fg16, bg16; |
952 |
u_char pa; |
953 |
uint32_t stride; |
954 |
-- |
Line 963
Link Here
|
|
|
919 |
addr = (uint8_t *)sc->fb_addr |
920 |
+ (row + sc->ymargin)*(sc->stride) |
921 |
+ (sc->depth/8) * (col + sc->xmargin); |
Lines 967-969
Link Here
|
967 |
addr = (uint8_t *)sc->fb_addr |
926 |
for (i = 0; i < BCMFB_FONT_HEIGHT; i++) { |
968 |
+ (row + sc->ymargin)*(sc->stride) |
927 |
for (j = 0, k = 7; j < 8; j++, k--) { |
969 |
+ (sc->depth/8) * (col + sc->xmargin); |
928 |
if ((p[i] & (1 << k)) == 0) |
970 |
-- |
929 |
color = bg; |
|
|
930 |
else |
931 |
color = fg; |
Lines 971-1019
Link Here
|
971 |
switch (sc->depth) { |
933 |
switch (sc->depth) { |
972 |
case 32: |
934 |
case 32: |
973 |
fg32 = bcmfb_palette32[fg]; |
935 |
addr[4*j+0] = bcmfb_palette[color].r; |
974 |
bg32 = bcmfb_palette32[bg]; |
936 |
addr[4*j+1] = bcmfb_palette[color].g; |
975 |
addr32 = (uint32_t *)addr; |
937 |
addr[4*j+2] = bcmfb_palette[color].b; |
976 |
stride = sc->stride >> 2; |
938 |
addr[4*j+3] = bcmfb_palette[color].a; |
977 |
for (i = 0; i < BCMFB_FONT_HEIGHT; i++) { |
939 |
break; |
978 |
pa = p[i]; |
940 |
case 24: |
979 |
for (j = 0; j < 8; j++) { |
941 |
addr[3*j] = bcmfb_palette[color].r; |
980 |
addr32[j] = (pa & 128) ? fg32 : bg32; |
942 |
addr[3*j+1] = bcmfb_palette[color].g; |
981 |
pa = pa << 1; |
943 |
addr[3*j+2] = bcmfb_palette[color].b; |
982 |
} |
944 |
break; |
983 |
addr32 += stride; |
945 |
case 16: |
984 |
} |
946 |
rgb = (bcmfb_palette[color].r >> 3) << 11; |
985 |
break; |
947 |
rgb |= (bcmfb_palette[color].g >> 2) << 5; |
986 |
case 24: |
948 |
rgb |= (bcmfb_palette[color].b >> 3); |
987 |
fg24r = bcmfb_palette24[fg].r; |
949 |
addr[2*j] = rgb & 0xff; |
988 |
fg24g = bcmfb_palette24[fg].g; |
950 |
addr[2*j + 1] = (rgb >> 8) & 0xff; |
989 |
fg24b = bcmfb_palette24[fg].b; |
951 |
default: |
990 |
bg24r = bcmfb_palette24[bg].r; |
952 |
/* Not supported yet */ |
991 |
bg24g = bcmfb_palette24[bg].g; |
953 |
break; |
992 |
bg24b = bcmfb_palette24[bg].b; |
|
|
993 |
for (i = 0; i < BCMFB_FONT_HEIGHT; i++) { |
994 |
pa = p[i]; |
995 |
for (j = 0; j < 24; j+=3) { |
996 |
if (pa & 128) { |
997 |
addr[j] = fg24r; |
998 |
addr[j+1] = fg24g; |
999 |
addr[j+2] = fg24b; |
1000 |
} else { |
1001 |
addr[j] = bg24r; |
1002 |
addr[j+1] = bg24g; |
1003 |
addr[j+2] = bg24b; |
1004 |
} |
1005 |
pa = pa << 1; |
1006 |
} |
1007 |
addr += sc->stride; |
1008 |
} |
1009 |
break; |
1010 |
case 16: |
1011 |
fg16 = bcmfb_palette16[fg]; |
1012 |
bg16 = bcmfb_palette16[bg]; |
1013 |
stride = sc->stride >> 1; |
1014 |
addr16 = (uint16_t *)addr; |
1015 |
for (i = 0; i < BCMFB_FONT_HEIGHT; i++) { |
1016 |
pa = p[i]; |
1017 |
for (j = 0; j < 8; j++) { |
1018 |
addr16[j] = (pa & 128) ? fg16 : bg16; |
1019 |
pa = pa << 1; |
1020 |
-- |
Line 1021
Link Here
|
1021 |
addr16 += stride; |
|
|
Line 1023
Link Here
|
1023 |
break; |
956 |
|
1024 |
-- |
957 |
addr += (sc->stride); |
Line 1025
Link Here
|
1025 |
return (0); |
959 |
|
1026 |
-- |
960 |
return (0); |