Subversion Repositories Kolibri OS

Rev

Rev 882 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
882 serge 1
 
2
3
 
4
 
5
{
6
     __m64 dst_color;
7
8
 
9
     dst_color = _mm_unpacklo_pi32(dst_color, dst_color);
10
11
 
12
     {
13
        __asm__ __volatile__ (
14
        "movq %[clr],   (%0)\n\t"
15
        "movq %[clr],  8(%0)\n\t"
16
        "movq %[clr], 16(%0)\n\t"
17
        "movq %[clr], 24(%0)\n\t"
18
        :: "r" (addr), [clr] "y" (dst_color));
19
        addr += 32;
20
        width -= 8;
21
     }
22
     if (width >= 4)
23
     {
24
        __asm__ __volatile__ (
25
        "movq %[clr],   (%0)\n\t"
26
        "movq %[clr],  8(%0)\n\t"
27
        :: "r" (addr), [clr] "y" (dst_color));
28
        addr += 16;
29
        width -= 4;
30
     }
31
     if (width >= 2)
32
     {
33
        __asm__ __volatile__ (
34
        "movq %[clr],  (%0)\n\t"
35
        :: "r" (addr), [clr] "y" (dst_color));
36
        addr += 8;
37
        width -= 2;
38
     }
39
     if ( width )
40
        __asm__ __volatile__ (
41
        "movd %[clr],  (%0)\n\t"
42
        :: "r" (addr), [clr] "y" (dst_color));
43
44
 
45
}
46
47
 
48
{
49
     __m64 color;
50
51
 
52
     color = _mm_unpacklo_pi32(color, color);
53
54
 
55
     {
56
        char *tmp_dst =dst_addr;
57
        int width = w;
58
        dst_addr += pitch;
59
60
 
61
        {
62
           __asm__ __volatile__
63
           ("movq %[clr],   (%0)\n\t"
64
            "movq %[clr],  8(%0)\n\t"
65
            "movq %[clr], 16(%0)\n\t"
66
            "movq %[clr], 24(%0)\n\t"
67
            :: "r" (tmp_dst), [clr] "y" (color));
68
           tmp_dst += 32;
69
           width -= 8;
70
        };
71
        if(width >= 4)
72
        {
73
           __asm__ __volatile__
74
           ("movq %[clr],  (%0)\n\t"
75
            "movq %[clr], 8(%0)\n\t"
76
            :: "r" (tmp_dst), [clr] "y" (color));
77
           tmp_dst += 16;
78
           width -= 4;
79
        };
80
81
 
82
        {
83
           __asm__ __volatile__
84
           ("movq %[clr],  (%0)\n\t"
85
            :: "r" (tmp_dst), [clr] "y" (color));
86
           tmp_dst += 8;
87
           width -= 2;
88
        };
89
        if(width)
90
           __asm__ __volatile__
91
           ("movd %[clr], (%0)\n\t"
92
            :: "r" (tmp_dst), [clr] "y" (color));
93
     };
94
     _mm_empty();
95
};
96
97
 
98
{
99
     if( (srv_hw2d != 0) &&
100
         ( ((int)pixmap == -1) ||
101
           ( (pixmap->flags & PX_MEM_MASK)==PX_MEM_LOCAL) ) )
102
     {
103
       ioctl_t io;
104
105
 
106
          pixmap = (pixmap_t*)pixmap->handle;
107
108
 
109
       io.io_code  = PX_CLEAR;
110
       io.input    = &pixmap;
111
       io.inp_size = 2;
112
       io.output   = NULL;
113
       io.out_size = 0;
114
115
 
116
     }
117
118
 
119
120
 
121
            pixmap->width, pixmap->height, color);
122
     return ERR_OK;
123
};
124
125
 
126
{
127
128
 
129
130
 
131
         ( (pixmap == (void*)-1) ||
132
           ( (pixmap->flags & PX_MEM_MASK)==PX_MEM_LOCAL) ) )
133
     {
134
       ioctl_t io;
135
136
 
137
          pixmap = (pixmap_t*)pixmap->handle;
138
139
 
140
       io.io_code  = PX_LINE;
141
       io.input    = &pixmap;
142
       io.inp_size = 6;
143
       io.output   = NULL;
144
       io.out_size = 0;
145
146
 
147
     }
148
149
 
150
151
 
152
     clip.ymin = 0;
153
     clip.xmax = pixmap->width-1;
154
     clip.ymax = pixmap->height-1;
155
156
 
157
     {
158
        int dx, dy;
159
        int sx, sy;
160
        int e, e1, e2, e3;
161
162
 
163
164
 
165
        dy = y1 - y0;
166
167
 
168
        {
169
           if( dy == 0 )
170
           {
171
              if (dx < 0)
172
              {
173
                 dx = -dx;
174
                 x0 =  x1;
175
              };
176
177
 
178
              HLine(addr, dx, color);
179
180
 
181
           };
182
           if( dx == 0 )
183
           {
184
              if (dy < 0)
185
              {
186
                 dy = -dy;
187
                 y0 =  y1;
188
              };
189
              addr = &((char*)(pixmap->mapped))[pixmap->pitch*y0 + x0*4];
190
191
 
192
              {
193
                 *(color_t*)addr = color;
194
                 addr += pixmap->pitch;
195
              }
196
              return ERR_OK;
197
           }
198
199
 
200
           if ( dx < 0 )
201
           {
202
              dx = -dx;
203
              sx = -sx;
204
           }
205
           sy = pixmap->pitch;
206
           if ( dy < 0 )
207
           {
208
              dy = -dy;
209
              sy = -sy;
210
           };
211
212
 
213
214
 
215
           {
216
              e1 = dy << 1;
217
              e2 = e1 - (dx << 1);
218
              e  = e1 - dx;
219
220
 
221
              e  = e - e1;
222
223
 
224
 
225
              {
226
                 *(color_t*)addr = color;
227
                 addr += sx;
228
                 e += e1;
229
                 if (e >= 0)
230
                 {
231
                    addr += sy;
232
                    e += e3;
233
                 }
234
              }
235
           }
236
           else
237
           {
238
              e1 = dx << 1;
239
              e2 = e1 - (dy << 1);
240
              e  = e1 - dy;
241
              e3 = e2 - e1;
242
              e  = e - e1;
243
244
 
245
              {
246
                 *(color_t*)addr = color;
247
                 addr += sy;
248
                 e += e1;
249
                 if (e >= 0)
250
                 {
251
                    addr += sx;
252
                    e += e3;
253
                 }
254
              }
255
           }
256
        }    /*  ( dx || dy ) */
257
     }
258
     return ERR_OK;
259
}
260
261
 
262
               int width, int height,
263
               color_t dst_color, color_t border)
264
{
265
266
 
267
        return ERR_PARAM;
268
269
 
270
     "destinastion is primary screen or local videomemory"
271
*/
272
273
 
274
         ( (pixmap == (void*)-1) ||
275
           ( (pixmap->flags & PX_MEM_MASK)==PX_MEM_LOCAL) ) )
276
     {
277
       ioctl_t io;
278
279
 
280
          pixmap = (pixmap_t*)pixmap->handle;
281
282
 
283
       io.io_code  = PX_DRAW_RECT;
284
       io.input    = &pixmap;
285
       io.inp_size = 7;
286
       io.output   = NULL;
287
       io.out_size = 0;
288
289
 
290
     }
291
     else
292
/*     no acceleration or destination in system memory  */
293
     {
294
        clip_t clip;
295
        int x0, y0, x1, y1, xend, yend;
296
297
 
298
299
 
300
        y0 = yorg;
301
302
 
303
        yend = y1 = y0 + height - 1;
304
305
 
306
        clip.ymin = 0;
307
        clip.xmax = pixmap->width-1;
308
        clip.ymax = pixmap->height-1;
309
310
 
311
        {
312
           int w, h;
313
314
 
315
316
 
317
           h = y1 - y0 + 1;
318
319
 
320
               ((border & 0xFF000000)==0))
321
           {
322
              dst_addr  = &((char*)(pixmap->mapped))[pixmap->pitch*y0 + x0*4];
323
              pxDraw(dst_addr, pixmap->pitch, w, h, dst_color);
324
           }
325
           else
326
           {
327
              if( y0 == yorg)
328
              {
329
                 dst_addr  = &((char*)(pixmap->mapped))[pixmap->pitch*y0 + x0*4];
330
                 HLine(dst_addr, w, border);
331
                 y0++;
332
                 h--;
333
              }
334
              if( y1 == yend )
335
              {
336
                 dst_addr  = &((char*)(pixmap->mapped))[pixmap->pitch*y1 + x0*4];
337
                 HLine(dst_addr, w, border);
338
                 h--;
339
              }
340
              if( (h > 0) && (x0 == xorg))
341
              {
342
                 int dy = h;
343
344
 
345
346
 
347
                 {
348
                    *(color_t*)dst_addr = border;
349
                    dst_addr += pixmap->pitch;
350
                 }
351
                 x0++;
352
                 w--;
353
              }
354
              if( (h > 0) && (x1 == xend))
355
              {
356
                 int dy = h;
357
358
 
359
360
 
361
                 {
362
                    *(color_t*)dst_addr = border;
363
                    dst_addr += pixmap->pitch;
364
                 }
365
                 w--;
366
              }
367
              if( (w > 0) && (h > 0) )
368
              {
369
                 dst_addr  = &((char*)(pixmap->mapped))[pixmap->pitch*y0 + x0*4];
370
                 pxDraw(dst_addr, pixmap->pitch, w, h, dst_color);
371
              }
372
           }
373
        };
374
     };
375
     return ERR_OK;
376
};
377
378
 
379
               int width, int height,
380
               brush_t *dst_brush, color_t border)
381
{
382
     if( ( width <= 0 ) || ( height<=0 ) )
383
        return ERR_PARAM;
384
385
 
386
     "destinastion is primary screen or local videomemory"
387
*/
388
389
 
390
         ( (pixmap == (void*)-1) ||
391
           ( (pixmap->flags & PX_MEM_MASK)==PX_MEM_LOCAL) ) )
392
     {
393
        fill_t fill;
394
        ioctl_t io;
395
396
 
397
        fill.x = xorg;
398
        fill.y = yorg;
399
        fill.w = width;
400
        fill.h = height;
401
        fill.bkcolor = dst_brush->bkcolor;
402
        fill.fcolor  = dst_brush->fcolor;
403
        fill.bmp0 = dst_brush->bmp[0];
404
        fill.bmp1 = dst_brush->bmp[1];
405
        fill.border = border;
406
407
 
408
        io.io_code  = PX_FILL_RECT;
409
        io.input    = &fill;
410
        io.inp_size = 10;
411
        io.output   = NULL;
412
        io.out_size = 0;
413
414
 
415
     }
416
     else
417
/*      no acceleration or destination in system memory  */
418
     {
419
        clip_t clip;
420
        int x0, y0, x1, y1, xend, yend;
421
422
 
423
424
 
425
        y0 = yorg;
426
        x1 = xend = x0 + width - 1;
427
        y1 = yend = y0 + height - 1;
428
429
 
430
        clip.ymin = 0;
431
        clip.xmax = pixmap->width-1;
432
        clip.ymax = pixmap->height-1;
433
434
 
435
        {
436
           int w, h, bh, bm_y;
437
438
 
439
           char *dst_addr;
440
441
 
442
           clr_ff = _mm_cvtsi32_si64(dst_brush->fcolor);
443
444
 
445
           clr_ff = _mm_unpacklo_pi32(clr_ff, clr_ff);
446
447
 
448
           clr_fb = _mm_unpacklo_pi32(clr_bb, clr_ff);
449
450
 
451
           bh = h = y1 -y0 + 1;
452
453
 
454
455
 
456
457
 
458
           {
459
              u8_t mask = dst_brush->bits[bm_y];
460
461
 
462
              int width = w;
463
              dst_addr += pixmap->pitch;
464
              bm_y = (bm_y+1) & 7;
465
466
 
467
              {
468
                 __asm__ __volatile__
469
                 ("rolb $2, %0 \n\t"
470
                  :"+g" (mask):"g"(mask)
471
                  :"cc");
472
473
 
474
                 {
475
                    case 0:
476
                       __asm__ __volatile__
477
                       ("movq %[clr], (%0)\n\t" :: "r" (tmp_dst), [clr] "y" (clr_bb));
478
                       break;
479
480
 
481
                       __asm__ __volatile__
482
                       ("movq %[clr], (%0)\n\t" :: "r" (tmp_dst), [clr] "y" (clr_fb));
483
                       break;
484
485
 
486
                       __asm__ __volatile__
487
                       ("movq %[clr], (%0)\n\t" :: "r" (tmp_dst), [clr] "y" (clr_bf));
488
                       break;
489
490
 
491
                       __asm__ __volatile__
492
                       ("movq %[clr], (%0)\n\t" :: "r" (tmp_dst), [clr] "y" (clr_ff));
493
                       break;
494
                 }
495
                 width   -=2;
496
                 tmp_dst +=8;
497
              }
498
              if( width )
499
                 if( mask & 1 )
500
                    __asm__ __volatile__
501
                    ("movd %[clr], (%0)\n\t" :: "r" (tmp_dst), [clr] "y" (clr_ff));
502
                 else
503
                    __asm__ __volatile__
504
                    ("movd %[clr], (%0)\n\t" :: "r" (tmp_dst), [clr] "y" (clr_bb));
505
           };
506
507
 
508
           {
509
              if( y0 == yorg)
510
              {
511
                 dst_addr  = &((char*)(pixmap->mapped))[pixmap->pitch*y0 + x0*4];
512
                 HLine(dst_addr, w, border);
513
                 y0++;
514
                 bh--;
515
              }
516
              if( y1 == yend )
517
              {
518
                 dst_addr  = &((char*)(pixmap->mapped))[pixmap->pitch*y1 + x0*4];
519
                 HLine(dst_addr, w, border);
520
                 bh--;
521
              }
522
              if( (bh > 0) && (x0 == xorg))
523
              {
524
                 int dy = bh;
525
526
 
527
528
 
529
                 {
530
                    *(color_t*)dst_addr = border;
531
                    dst_addr += pixmap->pitch;
532
                 }
533
              }
534
              if( (bh > 0) && (x1 == xend))
535
              {
536
                 int dy = bh;
537
538
 
539
540
 
541
                 {
542
                    *(color_t*)dst_addr = border;
543
                    dst_addr += pixmap->pitch;
544
                 }
545
              }
546
           };
547
548
 
549
        };
550
     };
551
     return ERR_OK;
552
};
553
554
 
555
 
556
         pixmap_t *src_pixmap, int src_x, int src_y,
557
         int width, int height)
558
{
559
560
 
1002 serge 561
882 serge 562
 
1002 serge 563
        return ERR_PARAM;
882 serge 564
565
 
1002 serge 566
    "destinastion is primary screen or local videomemory"
567
*/
568
    if( (srv_hw2d != 0) &&
569
        ( (dst_pixmap == (void*)-1) ||
570
           ( (dst_pixmap->flags & PX_MEM_MASK)==PX_MEM_LOCAL) ) /* &&
571
         ( (src_pixmap == (void*)-1) ||
572
           ( (src_pixmap->flags & PX_MEM_MASK)==PX_MEM_LOCAL) ) */ )
573
    {
574
        ioctl_t io;
575
        pxblit_t *blit = (pxblit_t*)&dst_pixmap;
576
577
 
578
            blit->dst_pixmap = (pixmap_t*)dst_pixmap->handle;
579
580
 
581
            (src_pixmap->flags & PX_MEM_MASK) != PX_MEM_SYSTEM)
582
            blit->src_pixmap = (pixmap_t*)src_pixmap->handle;
583
584
 
585
        io.io_code  = PX_BLIT;
586
        io.input    = blit;
587
        io.inp_size = 8;
588
        io.output   = NULL;
589
        io.out_size = 0;
590
591
 
592
    }
593
594
 
595
    src_pixmap = (src_pixmap == (void*)-1) ? &scrn_pixmap : src_pixmap ;
596
597
 
598
    src_clip.ymin = 0;
599
    src_clip.xmax = src_pixmap->width-1;
600
    src_clip.ymax = src_pixmap->height-1;
601
602
 
603
    dst_clip.ymin = 0;
604
    dst_clip.xmax = dst_pixmap->width-1;
605
    dst_clip.ymax = dst_pixmap->height-1;
606
607
 
608
                   &src_clip, &src_x, &src_y,
609
                   &width, &height) )
610
    {
611
        color_t *src_addr = &((color_t*)(src_pixmap->mapped))[src_pixmap->pitch*src_y/4+src_x];
612
        color_t *dst_addr = &((color_t*)(dst_pixmap->mapped))[dst_pixmap->pitch*dst_y/4+dst_x];
613
614
 
615
        {
616
            int w = width;
617
            color_t *tmp_src = src_addr;
618
            color_t *tmp_dst = dst_addr;
619
620
 
621
            dst_addr += dst_pixmap->pitch/4;
622
623
 
624
            {
625
                __asm__ __volatile__ (
626
                "movq     (%0),   %%mm0\n"
627
                "movq    8(%0),   %%mm1\n"
628
                "movq   16(%0),   %%mm2\n"
629
                "movq   24(%0),   %%mm3\n"
630
                "movq   %%mm0,    (%1)\n"
631
                "movq   %%mm1,   8(%1)\n"
632
                "movq   %%mm2,  16(%1)\n"
633
                "movq   %%mm3,  24(%1)\n"
634
                :: "r" (tmp_src), "r" (tmp_dst)
635
                : "memory", "%mm0", "%mm1", "%mm2", "%mm3");
636
                w -= 8;
637
                tmp_src += 8;
638
                tmp_dst += 8;
639
            };
640
            if( w >= 4 )
641
            {
642
                __asm__ __volatile__ (
643
                "movq     (%0),   %%mm0\n"
644
                "movq    8(%0),   %%mm1\n"
645
                "movq   %%mm0,    (%1)\n"
646
                "movq   %%mm1,   8(%1)\n"
647
                :: "r" (tmp_src), "r" (tmp_dst)
648
                : "memory", "%mm0", "%mm1");
649
                w -= 4;
650
                tmp_src += 4;
651
                tmp_dst += 4;
652
            };
653
            if( w >= 2 )
654
            {
655
                __asm__ __volatile__ (
656
                "movq     (%0),   %%mm0\n"
657
                "movq   %%mm0,    (%1)\n"
658
                :: "r" (tmp_src), "r" (tmp_dst)
659
                : "memory", "%mm0");
660
                w -= 2;
661
                tmp_src += 2;
662
                tmp_dst += 2;
663
            };
664
            if( w )
665
                *tmp_dst = *tmp_src;
666
        };
667
    };
668
    return ERR_OK;
669
};
670
671
 
672
         pixmap_t *src_pixmap, int src_x, int src_y,
673
         int width, int height, color_t key)
674
{
675
     clip_t src_clip, dst_clip;
676
677
 
882 serge 678
     "destinastion is primary screen or local videomemory"  and
679
     "source is primary screen or local videomemory"
680
*/
681
1002 serge 682
 
882 serge 683
         ( (dst_pixmap == (void*)-1) ||
684
           ( (dst_pixmap->flags & PX_MEM_MASK)==PX_MEM_LOCAL) )  &&
685
         ( (src_pixmap == (void*)-1) ||
686
           ( (src_pixmap->flags & PX_MEM_MASK)==PX_MEM_LOCAL) ) )
687
     {
688
        ioctl_t io;
689
        pxblit_t *blit = (pxblit_t*)&dst_pixmap;
690
691
 
692
           blit->dst_pixmap = (pixmap_t*)dst_pixmap->handle;
1002 serge 693
882 serge 694
 
695
           blit->src_pixmap = (pixmap_t*)src_pixmap->handle;
696
697
 
698
        io.io_code  = PX_BLIT_TRANSPARENT;
1002 serge 699
        io.input    = blit;
882 serge 700
        io.inp_size = 9;
1002 serge 701
        io.output   = NULL;
882 serge 702
        io.out_size = 0;
703
704
 
705
     };
1002 serge 706
882 serge 707
 
708
     src_pixmap = (src_pixmap == (void*)-1) ? &scrn_pixmap : src_pixmap ;
709
710
 
711
     src_clip.ymin = 0;
712
     src_clip.xmax = src_pixmap->width-1;
713
     src_clip.ymax = src_pixmap->height-1;
714
715
 
716
     dst_clip.ymin = 0;
717
     dst_clip.xmax = dst_pixmap->width-1;
718
     dst_clip.ymax = dst_pixmap->height-1;
719
720
 
1002 serge 721
 
882 serge 722
                    &src_clip, &src_x, &src_y,
723
                    &width, &height) )
724
     {
725
        __m64 clr_key;
1002 serge 726
727
 
728
 
882 serge 729
        color_t *dst_addr = &((color_t*)(dst_pixmap->mapped))[dst_pixmap->pitch*dst_y/4+dst_x];
730
731
 
1002 serge 732
        clr_key = _mm_unpacklo_pi32(clr_key, clr_key);
733
734
 
882 serge 735
        {
736
           int w = width;
737
           color_t *tmp_src = src_addr;
738
           color_t *tmp_dst = dst_addr;
739
740
 
741
           dst_addr += dst_pixmap->pitch/4;
742
743
 
1002 serge 744
           {
882 serge 745
              __asm__ __volatile__ (
746
              "movq    %[clr_key], %%mm0      \n\t"
1002 serge 747
              "pcmpeqd %[src_clr], %%mm0      \n\t"
748
              "pand    %%mm0,      %[dst_clr] \n\t"
749
              "pandn   %[src_clr], %%mm0      \n\t"
750
              "por     %%mm0,      %[dst_clr] \n\t"
751
              "movq    %[dst_clr], (%0)"
752
              :: "r" (tmp_dst),
753
              [src_clr] "y" (*(__m64*)tmp_src),
754
              [dst_clr] "y" (*(__m64*)tmp_dst),
755
              [clr_key] "y" (clr_key)
756
              :"memory","mm0");
757
758
 
882 serge 759
              tmp_src += 2;
760
              tmp_dst += 2;
761
           };
762
           if( w && (*tmp_src != key) )
1002 serge 763
              *tmp_dst = *tmp_src;
882 serge 764
        };
765
     };
766
     return ERR_OK;
767
}
1002 serge 768
882 serge 769
 
1002 serge 770
771
 
772
              pixmap_t *src_pixmap, int src_x, int src_y,
773
              int width, int height, u32_t alpha)
774
{
882 serge 775
     clip_t src_clip, dst_clip;
776
777
 
778
         ( (dst_pixmap == (void*)-1) ||
779
           ( (dst_pixmap->flags & PX_MEM_MASK)==PX_MEM_LOCAL) )  &&
780
         ( (src_pixmap == (void*)-1) ||
781
           ( (src_pixmap->flags & PX_MEM_MASK)==PX_MEM_LOCAL) ) )
782
     {
783
        ioctl_t io;
784
        pxblit_t *blit = (pxblit_t*)&dst_pixmap;
785
786
 
787
           blit->dst_pixmap = (pixmap_t*)dst_pixmap->handle;
788
789
 
790
           blit->src_pixmap = (pixmap_t*)src_pixmap->handle;
791
792
 
793
        io.io_code  = PX_BLIT_ALPHA;
1002 serge 794
        io.input    = blit;
882 serge 795
        io.inp_size = 9;
796
        io.output   = NULL;
797
        io.out_size = 0;
798
799
 
800
     };
801
802
 
1002 serge 803
     src_pixmap = (src_pixmap == (void*)-1) ? &scrn_pixmap : src_pixmap ;
804
805
 
882 serge 806
     src_clip.ymin = 0;
807
     src_clip.xmax = src_pixmap->width-1;
808
     src_clip.ymax = src_pixmap->height-1;
809
810
 
811
     dst_clip.ymin = 0;
812
     dst_clip.xmax = dst_pixmap->width-1;
813
     dst_clip.ymax = dst_pixmap->height-1;
814
815
 
816
 
817
                    &src_clip, &src_x, &src_y,
818
                    &width, &height) )
819
     {
820
        __m64 m_alpha;
1002 serge 821
        __m64 m_one_alpha;
822
882 serge 823
 
824
        color_t *dst_addr = &((color_t*)(dst_pixmap->mapped))[dst_pixmap->pitch*dst_y/4+dst_x];
825
826
 
1002 serge 827
        m_alpha = _mm_unpacklo_pi32(m_alpha, m_alpha);
828
        m_one_alpha = _mm_subs_pu16((__m64)0x00FF00FF00FF00FFULL, m_alpha);
829
882 serge 830
 
831
        {
832
           int w = width;
833
           color_t *tmp_src = src_addr;
834
           color_t *tmp_dst = dst_addr;
835
836
 
837
           dst_addr += dst_pixmap->pitch/4;
838
839
 
1002 serge 840
           {
882 serge 841
              __asm__ __volatile__ (
842
              "movd (%0), %%mm0               \n\t"
1002 serge 843
              "pxor    %%mm1, %%mm1           \n\t"
844
              "punpcklbw  %%mm1, %%mm0        \n\t"
845
              "pmullw  %[clr_key], %%mm0       \n\t"
846
       //       "paddw   %[m_0080], %%mm0       \n\t"
847
882 serge 848
 
1002 serge 849
              "punpcklbw  %%mm1, %%mm2        \n\t"
850
              "pmullw  %[m_one_alpha], %%mm2  \n\t"
851
       //       "paddw   %[m_0080], %%mm2       \n\t"
852
853
 
854
              "psrlw   $8, %%mm0              \n\t"
855
              "packuswb %%mm0, %%mm0          \n\t"
856
              "movd    %%mm0, (%1)"
857
              :: "r" (tmp_src),
858
                 "r" (tmp_dst),
859
              [clr_key] "y" (m_alpha),
860
              [m_one_alpha] "y" (m_one_alpha)
861
              :"memory","mm0", "mm1", "mm2");
862
863
 
864
              tmp_dst++;
865
           };
882 serge 866
//           if( w && (*tmp_src != alpha) )
1002 serge 867
//              *tmp_dst = *tmp_src;
868
        };
882 serge 869
     };
870
     return ERR_OK;
871
}
872