Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5131 clevermous 1
/*!
2
  \file Draw_VLine.c
3
  \author Mario Palomo 
4
  \author Jose M. de la Huerga Fernández
5
  \author Pepe González Mora
6
  \date 05-2002
7
 
8
  This library is free software; you can redistribute it and/or
9
  modify it under the terms of the GNU Library General Public
10
  License as published by the Free Software Foundation; either
11
  version 2 of the License, or (at your option) any later version.
12
 
13
  This library is distributed in the hope that it will be useful,
14
  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
  Library General Public License for more details.
17
 
18
  You should have received a copy of the GNU Library General Public
19
  License along with this library; if not, write to the Free Foundation,
20
  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
 
23
#if SDL_DRAW_BPP == 1
24
#define SDL_DRAW_PUTPIXEL  \
25
  i = y1-y0+1;                             \
26
  switch( i % 4 ) {                        \
27
    do{                                    \
28
      case 0: *p = color; p+=super->pitch; \
29
      case 3: *p = color; p+=super->pitch; \
30
      case 2: *p = color; p+=super->pitch; \
31
      case 1: *p = color; p+=super->pitch; \
32
    }while( (i-=4) > 0 );                  \
33
  }
34
 
35
#elif SDL_DRAW_BPP == 2
36
#define SDL_DRAW_PUTPIXEL  \
37
  i = y1-y0+1;                                      \
38
  switch( i % 4 ) {                                 \
39
    do{                                             \
40
      case 0: *(Uint16*)p = color; p+=super->pitch; \
41
      case 3: *(Uint16*)p = color; p+=super->pitch; \
42
      case 2: *(Uint16*)p = color; p+=super->pitch; \
43
      case 1: *(Uint16*)p = color; p+=super->pitch; \
44
    }while( (i-=4) > 0 );                           \
45
  }
46
 
47
#elif SDL_DRAW_BPP == 3
48
#define SDL_DRAW_PUTPIXEL_BPP_3_AUX \
49
    if (SDL_BYTEORDER == SDL_BIG_ENDIAN) { \
50
      p[0] = colorbyte2;                   \
51
      p[1] = colorbyte1;                   \
52
      p[2] = colorbyte0;                   \
53
    } else {                               \
54
      p[0] = colorbyte0;                   \
55
      p[1] = colorbyte1;                   \
56
      p[2] = colorbyte2;                   \
57
    }
58
 
59
#define SDL_DRAW_PUTPIXEL \
60
  i = y1-y0+1;                                             \
61
  switch( i % 4 ) {                                        \
62
    do{                                                    \
63
      case 0: SDL_DRAW_PUTPIXEL_BPP_3_AUX p+=super->pitch; \
64
      case 3: SDL_DRAW_PUTPIXEL_BPP_3_AUX p+=super->pitch; \
65
      case 2: SDL_DRAW_PUTPIXEL_BPP_3_AUX p+=super->pitch; \
66
      case 1: SDL_DRAW_PUTPIXEL_BPP_3_AUX p+=super->pitch; \
67
    }while( (i-=4) > 0 );                                  \
68
  }
69
 
70
 
71
#elif SDL_DRAW_BPP == 4
72
#define SDL_DRAW_PUTPIXEL \
73
  i = y1-y0+1;                                      \
74
  switch( i % 4 ) {                                 \
75
    do{                                             \
76
      case 0: *(Uint32*)p = color; p+=super->pitch; \
77
      case 3: *(Uint32*)p = color; p+=super->pitch; \
78
      case 2: *(Uint32*)p = color; p+=super->pitch; \
79
      case 1: *(Uint32*)p = color; p+=super->pitch; \
80
    }while( (i-=4) > 0 );                           \
81
  }
82
 
83
#endif /*SDL_DRAW_BPP*/
84
 
85
 
86
void SDL_DRAWFUNCTION(SDL_Surface *super,
87
                      Sint16 x0,Sint16 y0, Sint16 y1,
88
                      Uint32 color)
89
{
90
#if SDL_DRAW_BPP == 3
91
  Uint8 colorbyte0 = (Uint8) (color & 0xff);
92
  Uint8 colorbyte1 = (Uint8) ((color >> 8) & 0xff);
93
  Uint8 colorbyte2 = (Uint8) ((color >> 16) & 0xff);
94
#endif
95
 
96
  register Uint8 *p;
97
  register Sint16 i;
98
 
99
  if (y0 > y1)  { i=y1; y1=y0; y0=i; }
100
  p = (Uint8*)super->pixels + y0 * super->pitch + x0 * SDL_DRAW_BPP;
101
 
102
  SDL_DRAW_PUTPIXEL
103
 
104
}/*Draw_VLine*/
105
 
106
 
107
#undef SDL_DRAW_PUTPIXEL
108
#undef SDL_DRAW_PUTPIXEL_BPP_3_AUX
109