~ubuntu-branches/ubuntu/karmic/xmame/karmic

« back to all changes in this revision

Viewing changes to src/unix/blit/blit_normal.h

  • Committer: Bazaar Package Importer
  • Author(s): Bruno Barrera C.
  • Date: 2007-02-16 10:06:54 UTC
  • mfrom: (2.1.5 edgy)
  • Revision ID: james.westby@ubuntu.com-20070216100654-iztas2cl47k5j039
Tags: 0.106-2
* Added Italian debconf templates translation. (closes: #382672)
* Added German debconf templates translation. (closes: #396610)
* Added Japanese debconf templates translation. (closes: #400011)
* Added Portuguese debconf templates translation. (closes: #409960)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* normal blitting routines */
 
2
 
 
3
#if SRC_DEPTH != DEST_DEPTH || SRC_DEPTH == 16
 
4
INLINE void FUNC_NAME(blit_normal_line_1)(SRC_PIXEL *src,
 
5
  SRC_PIXEL *end, RENDER_PIXEL *dst, unsigned int *lookup)
 
6
{
 
7
   for(;src<end;src+=4,dst+=4)
 
8
   {
 
9
      *(dst  ) = GETPIXEL(*(src  ));
 
10
      *(dst+1) = GETPIXEL(*(src+1));
 
11
      *(dst+2) = GETPIXEL(*(src+2));
 
12
      *(dst+3) = GETPIXEL(*(src+3));
 
13
   }
 
14
}
 
15
#endif
 
16
 
 
17
INLINE void FUNC_NAME(blit_normal_line_2)(SRC_PIXEL *src,
 
18
  SRC_PIXEL *end, RENDER_PIXEL *dst, unsigned int *lookup)
 
19
{
 
20
   for(;src<end; src+=4, dst+=8)
 
21
   {
 
22
      *(dst+ 1) = *(dst   ) = GETPIXEL(*(src  ));
 
23
      *(dst+ 3) = *(dst+ 2) = GETPIXEL(*(src+1));
 
24
      *(dst+ 5) = *(dst+ 4) = GETPIXEL(*(src+2));
 
25
      *(dst+ 7) = *(dst+ 6) = GETPIXEL(*(src+3));
 
26
   }
 
27
}
 
28
 
 
29
INLINE void FUNC_NAME(blit_normal_line_3)(SRC_PIXEL *src,
 
30
  SRC_PIXEL *end, RENDER_PIXEL *dst, unsigned int *lookup)
 
31
{
 
32
   for(;src<end; src+=4, dst+=12)
 
33
   {
 
34
      *(dst+ 2) = *(dst+ 1) = *(dst   ) = GETPIXEL(*(src  ));
 
35
      *(dst+ 5) = *(dst+ 4) = *(dst+ 3) = GETPIXEL(*(src+1));
 
36
      *(dst+ 8) = *(dst+ 7) = *(dst+ 6) = GETPIXEL(*(src+2));
 
37
      *(dst+11) = *(dst+10) = *(dst+ 9) = GETPIXEL(*(src+3));
 
38
   }
 
39
}
 
40
 
 
41
INLINE void FUNC_NAME(blit_normal_line_x)(SRC_PIXEL *src,
 
42
  SRC_PIXEL *end, RENDER_PIXEL *dst, unsigned int *lookup)
 
43
{
 
44
   for(;src<end;src++)
 
45
   {
 
46
      const DEST_PIXEL v = GETPIXEL(*(src));
 
47
      dst+=sysdep_display_params.widthscale;
 
48
      switch (sysdep_display_params.widthscale)
 
49
      {
 
50
         case 8:      *(dst-8) = v;
 
51
         case 7:      *(dst-7) = v;
 
52
         case 6:      *(dst-6) = v;
 
53
         case 5:      *(dst-5) = v;
 
54
         case 4:      *(dst-4) = v;
 
55
                      *(dst-3) = v;
 
56
                      *(dst-2) = v;
 
57
                      *(dst-1) = v;
 
58
      }
 
59
   }
 
60
}
 
61
 
 
62
BLIT_BEGIN(blit_normal)
 
63
  switch(sysdep_display_params.widthscale)
 
64
  {
 
65
    case 1:
 
66
#if SRC_DEPTH != DEST_DEPTH || SRC_DEPTH == 16
 
67
      BLIT_LOOP_YARBSIZE(blit_normal_line_1)
 
68
#else /* Speedup hack in case we just have to memcpy */
 
69
      if (sysdep_display_params.orientation) {
 
70
        if (sysdep_display_properties.mode_info[
 
71
             sysdep_display_params.video_mode] &
 
72
             SYSDEP_DISPLAY_DIRECT_FB)
 
73
        { 
 
74
          for (y = dirty_area->min_y; y < dirty_area->max_y; y++) {
 
75
            int reps = ((y+1)*yarbsize)/sysdep_display_params.height -
 
76
              (y*yarbsize)/sysdep_display_params.height;
 
77
            while (reps) {
 
78
              rotate_func(line_dest, bitmap, y, dirty_area);
 
79
              line_dest += DEST_WIDTH;
 
80
              reps--;
 
81
            }
 
82
          }
 
83
        } else {
 
84
          for (y = dirty_area->min_y; y < dirty_area->max_y; y++) {
 
85
            int reps = ((y+1)*yarbsize)/sysdep_display_params.height -
 
86
              (y*yarbsize)/sysdep_display_params.height;
 
87
            if (reps) {
 
88
              rotate_func(line_dest, bitmap, y, dirty_area);
 
89
              while (--reps) {
 
90
                memcpy(line_dest+DEST_WIDTH, line_dest,
 
91
                  (vis_in_dest_out->max_x-vis_in_dest_out->min_x)*
 
92
                  DEST_PIXEL_SIZE);
 
93
                line_dest += DEST_WIDTH;
 
94
              }
 
95
              line_dest += DEST_WIDTH;
 
96
            }
 
97
          }
 
98
        }
 
99
      } else {
 
100
        for (y = dirty_area->min_y; y < dirty_area->max_y; y++) {
 
101
          int reps = ((y+1)*yarbsize)/sysdep_display_params.height -
 
102
            (y*yarbsize)/sysdep_display_params.height;
 
103
          while (reps) {
 
104
            memcpy(line_dest,
 
105
              ((SRC_PIXEL *)(bitmap->line[y])) + dirty_area->min_x,
 
106
              (vis_in_dest_out->max_x-vis_in_dest_out->min_x)*DEST_PIXEL_SIZE);
 
107
            line_dest += DEST_WIDTH;
 
108
            reps--;
 
109
          }
 
110
        }
 
111
      }
 
112
#endif
 
113
      break;
 
114
    case 2:
 
115
      BLIT_LOOP_YARBSIZE(blit_normal_line_2)
 
116
      break;
 
117
    case 3:
 
118
      BLIT_LOOP_YARBSIZE(blit_normal_line_3)
 
119
      break;
 
120
    default:
 
121
      BLIT_LOOP_YARBSIZE(blit_normal_line_x)
 
122
  }
 
123
BLIT_END
 
124
 
 
125
BLIT_BEGIN(blit_fakescan_h)
 
126
  switch(sysdep_display_params.widthscale)
 
127
  {
 
128
    case 1:
 
129
#if SRC_DEPTH != DEST_DEPTH || SRC_DEPTH == 16
 
130
      BLIT_LOOP_FAKESCAN(blit_normal_line_1)
 
131
#else /* Speedup hack in case we just have to memcpy */
 
132
      if (sysdep_display_params.orientation) {
 
133
        if (sysdep_display_properties.mode_info[
 
134
             sysdep_display_params.video_mode] &
 
135
             SYSDEP_DISPLAY_DIRECT_FB)
 
136
        { 
 
137
          for (y = dirty_area->min_y; y < dirty_area->max_y; y++) {
 
138
            int reps = sysdep_display_params.heightscale-1;
 
139
            while (reps) {
 
140
              rotate_func(line_dest, bitmap, y, dirty_area);
 
141
              line_dest += DEST_WIDTH;
 
142
              reps--;
 
143
            }
 
144
            line_dest += DEST_WIDTH;
 
145
          }
 
146
        } else {
 
147
          for (y = dirty_area->min_y; y < dirty_area->max_y; y++) {
 
148
            int reps = sysdep_display_params.heightscale-1;
 
149
            rotate_func(line_dest, bitmap, y, dirty_area);
 
150
            while (--reps) {
 
151
              memcpy(line_dest+DEST_WIDTH, line_dest,
 
152
                (vis_in_dest_out->max_x-vis_in_dest_out->min_x)*
 
153
                DEST_PIXEL_SIZE);
 
154
              line_dest += DEST_WIDTH;
 
155
            }
 
156
            line_dest += 2*DEST_WIDTH;
 
157
          }
 
158
        }
 
159
      } else {
 
160
        for (y = dirty_area->min_y; y < dirty_area->max_y; y++) {
 
161
          int reps = sysdep_display_params.heightscale-1;
 
162
          while(reps) {
 
163
            memcpy(line_dest,
 
164
              ((SRC_PIXEL *)(bitmap->line[y])) + dirty_area->min_x,
 
165
              (vis_in_dest_out->max_x-vis_in_dest_out->min_x)*DEST_PIXEL_SIZE);
 
166
            line_dest += DEST_WIDTH;
 
167
            reps--;
 
168
          }
 
169
          line_dest += DEST_WIDTH;
 
170
        }
 
171
      }
 
172
#endif
 
173
      break;
 
174
    case 2:
 
175
      BLIT_LOOP_FAKESCAN(blit_normal_line_2)
 
176
      break;
 
177
    case 3:
 
178
      BLIT_LOOP_FAKESCAN(blit_normal_line_3)
 
179
      break;
 
180
    default:
 
181
      BLIT_LOOP_FAKESCAN(blit_normal_line_x)
 
182
  }
 
183
BLIT_END