xref: /haiku/src/add-ons/accelerants/neomagic/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 4/2003-3/2004
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 	/* do each blit */
17 	i=0;
18 	while (count--)
19 	{
20 		nm_acc_blit
21 		(
22 			list[i].src_left,
23 			list[i].src_top,
24 			list[i].dest_left,
25 			list[i].dest_top,
26 			list[i].width,
27 			list[i].height
28 		);
29 		i++;
30 	}
31 }
32 
33 void SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT(engine_token *et, scaled_blit_params *list, uint32 count) {
34 	int i;
35 
36 	/* do each blit */
37 	i=0;
38 	while (count--)
39 	{
40 		nm_acc_video_blit
41 		(
42 			list[i].src_left,
43 			list[i].src_top,
44 			list[i].src_width,
45 			list[i].src_height,
46 			list[i].dest_left,
47 			list[i].dest_top,
48 			list[i].dest_width,
49 			list[i].dest_height
50 		);
51 		i++;
52 	}
53 }
54 
55 void SCREEN_TO_SCREEN_TRANSPARENT_BLIT(engine_token *et, uint32 transparent_colour, blit_params *list, uint32 count) {
56 	int i;
57 
58 	/* do each blit */
59 	i=0;
60 	while (count--)
61 	{
62 		nm_acc_transparent_blit
63 		(
64 			list[i].src_left,
65 			list[i].src_top,
66 			list[i].dest_left,
67 			list[i].dest_top,
68 			list[i].width,
69 			list[i].height,
70 			transparent_colour
71 		);
72 		i++;
73 	}
74 }
75 
76 void FILL_RECTANGLE(engine_token *et, uint32 colorIndex, fill_rect_params *list, uint32 count) {
77 	int i;
78 
79 	/* init acc engine for fill function */
80 	nm_acc_setup_rectangle(colorIndex);
81 
82 	/* draw each rectangle */
83 	i=0;
84 	while (count--)
85 	{
86 		nm_acc_rectangle
87 		(
88 			list[i].left,
89 			(list[i].right)+1,
90 			list[i].top,
91 			(list[i].bottom-list[i].top)+1
92 		);
93 		i++;
94 	}
95 }
96 
97 void INVERT_RECTANGLE(engine_token *et, fill_rect_params *list, uint32 count) {
98 	int i;
99 
100 	/* init acc engine for invert function */
101 	nm_acc_setup_rect_invert();
102 
103 	/* invert each rectangle */
104 	i=0;
105 	while (count--)
106 	{
107 		nm_acc_rectangle_invert
108 		(
109 			list[i].left,
110 			(list[i].right)+1,
111 			list[i].top,
112 			(list[i].bottom-list[i].top)+1
113 		);
114 		i++;
115 	}
116 }
117 
118 void FILL_SPAN(engine_token *et, uint32 colorIndex, uint16 *list, uint32 count) {
119 	int i;
120 
121 	/* init acc engine for fill function */
122 	nm_acc_setup_rectangle(colorIndex);
123 
124 	/* draw each span */
125 	i=0;
126 	while (count--)
127 	{
128 		nm_acc_rectangle
129 		(
130 			list[i+1],
131 			list[i+2]+1,
132 			list[i],
133 			1
134 		);
135 		i+=3;
136 	}
137 }
138