xref: /haiku/src/add-ons/accelerants/via/Acceleration.c (revision b55a57da7173b9af0432bd3e148d03f06161d036)
1 /*
2 	Copyright 1999, Be Incorporated.   All Rights Reserved.
3 	This file may be used under the terms of the Be Sample Code License.
4 
5 	Other authors:
6 	Rudolf Cornelissen 9/2003.
7 */
8 
9 #define MODULE_BIT 0x40000000
10 
11 #include "acc_std.h"
12 
13 void SCREEN_TO_SCREEN_BLIT(engine_token *et, blit_params *list, uint32 count) {
14 	int i;
15 
16 	/* init acc engine for blit function */
17 	eng_acc_setup_blit();
18 
19 	/* do each blit */
20 	i=0;
21 	while (count--)
22 	{
23 		eng_acc_blit
24 		(
25 			list[i].src_left,
26 			list[i].src_top,
27 			list[i].dest_left,
28 			list[i].dest_top,
29 			list[i].width,
30 			list[i].height
31 		);
32 		i++;
33 	}
34 }
35 
36 void SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT(engine_token *et, scaled_blit_params *list, uint32 count) {
37 	int i;
38 
39 	/* do each blit */
40 	i=0;
41 	while (count--)
42 	{
43 		eng_acc_video_blit
44 		(
45 			list[i].src_left,
46 			list[i].src_top,
47 			list[i].src_width,
48 			list[i].src_height,
49 			list[i].dest_left,
50 			list[i].dest_top,
51 			list[i].dest_width,
52 			list[i].dest_height
53 		);
54 		i++;
55 	}
56 }
57 
58 void SCREEN_TO_SCREEN_TRANSPARENT_BLIT(engine_token *et, uint32 transparent_colour, blit_params *list, uint32 count) {
59 	int i;
60 
61 	/* do each blit */
62 	i=0;
63 	while (count--)
64 	{
65 		eng_acc_transparent_blit
66 		(
67 			list[i].src_left,
68 			list[i].src_top,
69 			list[i].dest_left,
70 			list[i].dest_top,
71 			list[i].width,
72 			list[i].height,
73 			transparent_colour
74 		);
75 		i++;
76 	}
77 }
78 
79 void FILL_RECTANGLE(engine_token *et, uint32 colorIndex, fill_rect_params *list, uint32 count) {
80 	int i;
81 
82 	/* init acc engine for fill function */
83 	eng_acc_setup_rectangle(colorIndex);
84 
85 	/* draw each rectangle */
86 	i=0;
87 	while (count--)
88 	{
89 		eng_acc_rectangle
90 		(
91 			list[i].left,
92 			(list[i].right)+1,
93 			list[i].top,
94 			(list[i].bottom-list[i].top)+1
95 		);
96 		i++;
97 	}
98 }
99 
100 void INVERT_RECTANGLE(engine_token *et, fill_rect_params *list, uint32 count) {
101 	int i;
102 
103 	/* init acc engine for invert function */
104 	eng_acc_setup_rect_invert();
105 
106 	/* invert each rectangle */
107 	i=0;
108 	while (count--)
109 	{
110 		eng_acc_rectangle_invert
111 		(
112 			list[i].left,
113 			(list[i].right)+1,
114 			list[i].top,
115 			(list[i].bottom-list[i].top)+1
116 		);
117 		i++;
118 	}
119 }
120 
121 void FILL_SPAN(engine_token *et, uint32 colorIndex, uint16 *list, uint32 count) {
122 	int i;
123 
124 	/* init acc engine for fill function */
125 	eng_acc_setup_rectangle(colorIndex);
126 
127 	/* draw each span */
128 	i=0;
129 	while (count--)
130 	{
131 		eng_acc_rectangle
132 		(
133 			list[i+1],
134 			list[i+2]+1,
135 			list[i],
136 			1
137 		);
138 		i+=3;
139 	}
140 }
141