11 #ifndef _FBCON_ROTATE_H
12 #define _FBCON_ROTATE_H
14 #define GETVYRES(s,i) ({ \
15 (s == SCROLL_REDRAW || s == SCROLL_MOVE) ? \
16 (i)->var.yres : (i)->var.yres_virtual; })
18 #define GETVXRES(s,i) ({ \
19 (s == SCROLL_REDRAW || s == SCROLL_MOVE || !(i)->fix.xpanstep) ? \
20 (i)->var.xres : (i)->var.xres_virtual; })
23 static inline int pattern_test_bit(
u32 x,
u32 y,
u32 pitch,
const char *
pat)
28 return (*pat) & (0x80 >>
bit);
31 static inline void pattern_set_bit(
u32 x,
u32 y,
u32 pitch,
char *
pat)
37 (*pat) |= 0x80 >>
bit;
43 int shift = (8 - (width % 8)) & 7;
45 width = (width + 7) & ~7;
47 for (i = 0; i <
height; i++) {
48 for (j = 0; j < width - shift; j++) {
49 if (pattern_test_bit(j, i, width, in))
50 pattern_set_bit(width - (1 + j + shift),
58 static inline void rotate_cw(
const char *in,
char *out,
u32 width,
u32 height)
61 int shift = (8 - (height % 8)) & 7;
63 width = (width + 7) & ~7;
64 height = (height + 7) & ~7;
66 for (i = 0; i <
h; i++) {
67 for (j = 0; j <
w; j++) {
68 if (pattern_test_bit(j, i, width, in))
69 pattern_set_bit(height - 1 - i - shift, j,
76 static inline void rotate_ccw(
const char *in,
char *out,
u32 width,
u32 height)
79 int shift = (8 - (width % 8)) & 7;
81 width = (width + 7) & ~7;
82 height = (height + 7) & ~7;
84 for (i = 0; i <
h; i++) {
85 for (j = 0; j <
w; j++) {
86 if (pattern_test_bit(j, i, width, in))
87 pattern_set_bit(i, width - 1 - j - shift,