diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2007-05-08 03:39:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:30 -0400 |
commit | dc0e6e0544f1cb2af44e5d7a7e68acda05dec6fa (patch) | |
tree | 7f5d28d54c333c5ba84bb4b4afe3821246696818 /drivers/video/sysfillrect.c | |
parent | 52102c07a68a26fe6f8926e6a8497b577655f18a (diff) |
fbdev: consolidate common drawing functions into a header file
Consolidate common drawing functions into a single header file.
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/sysfillrect.c')
-rw-r--r-- | drivers/video/sysfillrect.c | 68 |
1 files changed, 1 insertions, 67 deletions
diff --git a/drivers/video/sysfillrect.c b/drivers/video/sysfillrect.c index 10de70779a50..a261e9e6a675 100644 --- a/drivers/video/sysfillrect.c +++ b/drivers/video/sysfillrect.c | |||
@@ -15,73 +15,7 @@ | |||
15 | #include <linux/string.h> | 15 | #include <linux/string.h> |
16 | #include <linux/fb.h> | 16 | #include <linux/fb.h> |
17 | #include <asm/types.h> | 17 | #include <asm/types.h> |
18 | 18 | #include "fb_draw.h" | |
19 | /* | ||
20 | * Compose two values, using a bitmask as decision value | ||
21 | * This is equivalent to (a & mask) | (b & ~mask) | ||
22 | */ | ||
23 | |||
24 | static inline unsigned long | ||
25 | comp(unsigned long a, unsigned long b, unsigned long mask) | ||
26 | { | ||
27 | return ((a ^ b) & mask) ^ b; | ||
28 | } | ||
29 | |||
30 | /* | ||
31 | * Create a pattern with the given pixel's color | ||
32 | */ | ||
33 | |||
34 | #if BITS_PER_LONG == 64 | ||
35 | static inline unsigned long | ||
36 | pixel_to_pat( u32 bpp, u32 pixel) | ||
37 | { | ||
38 | switch (bpp) { | ||
39 | case 1: | ||
40 | return 0xfffffffffffffffful*pixel; | ||
41 | case 2: | ||
42 | return 0x5555555555555555ul*pixel; | ||
43 | case 4: | ||
44 | return 0x1111111111111111ul*pixel; | ||
45 | case 8: | ||
46 | return 0x0101010101010101ul*pixel; | ||
47 | case 12: | ||
48 | return 0x0001001001001001ul*pixel; | ||
49 | case 16: | ||
50 | return 0x0001000100010001ul*pixel; | ||
51 | case 24: | ||
52 | return 0x0000000001000001ul*pixel; | ||
53 | case 32: | ||
54 | return 0x0000000100000001ul*pixel; | ||
55 | default: | ||
56 | panic("pixel_to_pat(): unsupported pixelformat\n"); | ||
57 | } | ||
58 | } | ||
59 | #else | ||
60 | static inline unsigned long | ||
61 | pixel_to_pat( u32 bpp, u32 pixel) | ||
62 | { | ||
63 | switch (bpp) { | ||
64 | case 1: | ||
65 | return 0xfffffffful*pixel; | ||
66 | case 2: | ||
67 | return 0x55555555ul*pixel; | ||
68 | case 4: | ||
69 | return 0x11111111ul*pixel; | ||
70 | case 8: | ||
71 | return 0x01010101ul*pixel; | ||
72 | case 12: | ||
73 | return 0x00001001ul*pixel; | ||
74 | case 16: | ||
75 | return 0x00010001ul*pixel; | ||
76 | case 24: | ||
77 | return 0x00000001ul*pixel; | ||
78 | case 32: | ||
79 | return 0x00000001ul*pixel; | ||
80 | default: | ||
81 | panic("pixel_to_pat(): unsupported pixelformat\n"); | ||
82 | } | ||
83 | } | ||
84 | #endif | ||
85 | 19 | ||
86 | /* | 20 | /* |
87 | * Aligned pattern fill using 32/64-bit memory accesses | 21 | * Aligned pattern fill using 32/64-bit memory accesses |