Some "cast to pointer from integer of different size" warnings removed.
[AROS-Contrib.git] / MultiMedia / radium / common / gfx_shrink_t.c
blob443ae87f463122083d9ab751dc14aaee40d36e07
1 /* Copyright 2001 Kjetil S. Matheussen
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License
5 as published by the Free Software Foundation; either version 2
6 of the License, or (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /*******************************************************************
19 Various functions that is called between the programs GFX_*
20 routines and the OS/hardware ones. The difference between
21 this and gfx_shrink.c is that this functions cuts the
22 x parameters after temponodeare.x2 before calling the GFXS_*
23 functions.
24 ********************************************************************/
26 #include "nsmtracker.h"
28 #define GFX_DONTSHRINK
29 #include "visual_proc.h"
31 #include <string.h>
33 #define getMinX(a) a->wblock->t.x1
36 void GFXST_LineType(
37 void (*GFX_OSFunc)(
38 struct Tracker_Windows *window,
39 int color,
40 int x,int y,int x2,int y2
42 struct Tracker_Windows *window,
43 int color,
44 int x,int y,int x2,int y2
47 int minx=getMinX(window);
49 if(x<minx){
50 if(x2<minx){
51 return;
54 y=y2-(((y2-y)*(x2-minx))/(x2-x));
55 x=minx;
58 if(x2<minx){
59 y2=y+(((y2-y)*(minx-x2))/(x-x2));
61 x2=minx;
65 GFXS_LineType(GFX_OSFunc,window,color,x,y,x2,y2);
70 void GFXST_BoxType(
71 void (*GFX_OSFunc)(
72 struct Tracker_Windows *window,
73 int color,
74 int x,int y,int x2,int y2
76 struct Tracker_Windows *window,
77 int color,
78 int x,int y,int x2,int y2
81 int minx=getMinX(window);
83 if(x2<minx) return;
84 if(x>x2) return;
85 if(y>y2) return;
87 GFXS_BoxType(GFX_OSFunc,window,color,max(minx,x),y,x2,y2);
91 void GFXST_TextType(
92 void (*GFX_OSFunc)(
93 struct Tracker_Windows *window,
94 int color,char *text,
95 int x,int y,
96 bool clear
98 struct Tracker_Windows *window,
99 int color,char *text,
100 int x,int y,
101 bool clear
104 int minx=getMinX(window);
105 char temp[600];
107 if(GFX_OSFunc==GFX_Text){
108 if(x<minx){
109 x=minx;
110 sprintf(temp,"<--%s",text);
111 GFXS_TextType(GFX_OSFunc,window,color,temp,x,y,clear);
112 }else
113 GFXS_TextType(GFX_OSFunc,window,color,text,x,y,clear);
114 }else{
115 if(x<minx){
116 if((strlen(text)+1)*window->fontwidth<minx) return;
117 text+=(minx-x)/window->fontwidth;
118 x=minx;
120 GFXS_TextType(GFX_OSFunc,window,color,text,x,y,clear);
126 void GFXST_TextType2(
127 void (*GFX_OSFunc)(
128 struct Tracker_Windows *window,
129 int color,int len,
130 int x,int y,
131 bool clear
133 struct Tracker_Windows *window,
134 int color,int len,
135 int x,int y,
136 bool clear
139 int minx=getMinX(window);
140 GFXS_TextType2(GFX_OSFunc,window,color,len,max(minx,x),y,clear);
143 void GFXST_BorderType(
144 void (*GFX_P_OSFunc)(
145 struct Tracker_Windows *window,
146 int x, int y, int y2
148 struct Tracker_Windows *window,
149 int x, int y, int y2
152 int minx=getMinX(window);
153 if(x<minx) return;
155 GFXS_BorderType(GFX_P_OSFunc,window,x,y,y2);
158 void GFXST_BorderType2(
159 void (*GFX_P_OSFunc)(
160 struct Tracker_Windows *window,
161 int x, int y, int y2
163 struct Tracker_Windows *window,
164 int x, int y, int y2
167 int minx=getMinX(window);
168 if(x<minx) return;
170 GFXS_BorderType2(GFX_P_OSFunc,window,x,y,y2);