comparison libvo/vo_x11.c @ 18746:497ebe3ecc2b

Software Scaler headers usage cleanup
author lucabe
date Sun, 18 Jun 2006 10:59:23 +0000
parents 30d7ddf08889
children 8579acff875e
comparison
equal deleted inserted replaced
18745:19cd9e0f8ac4 18746:497ebe3ecc2b
37 37
38 #include "fastmemcpy.h" 38 #include "fastmemcpy.h"
39 #include "sub.h" 39 #include "sub.h"
40 40
41 #include "postproc/swscale.h" 41 #include "postproc/swscale.h"
42 #include "postproc/swscale_internal.h" //FIXME
43 #include "postproc/rgb2rgb.h"
44 #include "libmpcodecs/vf_scale.h" 42 #include "libmpcodecs/vf_scale.h"
43 #define MODE_RGB 0x1
44 #define MODE_BGR 0x2
45 45
46 #include "mp_msg.h" 46 #include "mp_msg.h"
47 #include "help_mp.h" 47 #include "help_mp.h"
48 48
49 #ifdef HAVE_NEW_GUI 49 #ifdef HAVE_NEW_GUI
142 unsigned char *src, unsigned char *srca, 142 unsigned char *src, unsigned char *srca,
143 int stride) 143 int stride)
144 { 144 {
145 } 145 }
146 146
147 static SwsContext *swsContext = NULL; 147 static struct SwsContext *swsContext = NULL;
148 static int dst_width;
148 extern int sws_flags; 149 extern int sws_flags;
149 150
150 static XVisualInfo vinfo; 151 static XVisualInfo vinfo;
151 152
152 static void getMyXImage(void) 153 static void getMyXImage(void)
507 sws_getContextFromCmdLine(width, height, in_format, width, height, 508 sws_getContextFromCmdLine(width, height, in_format, width, height,
508 out_format); 509 out_format);
509 if (!swsContext) 510 if (!swsContext)
510 return -1; 511 return -1;
511 512
513 dst_width = width;
512 //printf( "X11 bpp: %d color mask: R:%lX G:%lX B:%lX\n",bpp,myximage->red_mask,myximage->green_mask,myximage->blue_mask ); 514 //printf( "X11 bpp: %d color mask: R:%lX G:%lX B:%lX\n",bpp,myximage->red_mask,myximage->green_mask,myximage->blue_mask );
513 515
514 // If we have blue in the lowest bit then obviously RGB 516 // If we have blue in the lowest bit then obviously RGB
515 mode = ((myximage->blue_mask & 0x01) != 0) ? MODE_RGB : MODE_BGR; 517 mode = ((myximage->blue_mask & 0x01) != 0) ? MODE_RGB : MODE_BGR;
516 #ifdef WORDS_BIGENDIAN 518 #ifdef WORDS_BIGENDIAN
551 #ifdef HAVE_SHM 553 #ifdef HAVE_SHM
552 if (Shmem_Flag) 554 if (Shmem_Flag)
553 { 555 {
554 XShmPutImage(mDisplay, vo_window, vo_gc, myximage, 556 XShmPutImage(mDisplay, vo_window, vo_gc, myximage,
555 0, 0, 557 0, 0,
556 (vo_dwidth - swsContext->dstW) / 2, 558 (vo_dwidth - dst_width) / 2,
557 (vo_dheight - myximage->height) / 2, swsContext->dstW, 559 (vo_dheight - myximage->height) / 2, dst_width,
558 myximage->height, True); 560 myximage->height, True);
559 } else 561 } else
560 #endif 562 #endif
561 { 563 {
562 XPutImage(mDisplay, vo_window, vo_gc, myximage, 564 XPutImage(mDisplay, vo_window, vo_gc, myximage,
563 0, 0, 565 0, 0,
564 (vo_dwidth - swsContext->dstW) / 2, 566 (vo_dwidth - dst_width) / 2,
565 (vo_dheight - myximage->height) / 2, swsContext->dstW, 567 (vo_dheight - myximage->height) / 2, dst_width,
566 myximage->height); 568 myximage->height);
567 } 569 }
568 } 570 }
569 571
570 static void draw_osd(void) 572 static void draw_osd(void)
588 || old_vo_dheight != vo_dheight) /*&& y==0 */ && zoomFlag) 590 || old_vo_dheight != vo_dheight) /*&& y==0 */ && zoomFlag)
589 { 591 {
590 int newW = vo_dwidth; 592 int newW = vo_dwidth;
591 int newH = vo_dheight; 593 int newH = vo_dheight;
592 int newAspect = (newW * (1 << 16) + (newH >> 1)) / newH; 594 int newAspect = (newW * (1 << 16) + (newH >> 1)) / newH;
593 SwsContext *oldContext = swsContext; 595 struct SwsContext *oldContext = swsContext;
594 596
595 if (newAspect > aspect) 597 if (newAspect > aspect)
596 newW = (newH * aspect + (1 << 15)) >> 16; 598 newW = (newH * aspect + (1 << 15)) >> 16;
597 else 599 else
598 newH = ((newW << 16) + (aspect >> 1)) / aspect; 600 newH = ((newW << 16) + (aspect >> 1)) / aspect;
615 sws_freeContext(oldContext); 617 sws_freeContext(oldContext);
616 } else 618 } else
617 { 619 {
618 swsContext = oldContext; 620 swsContext = oldContext;
619 } 621 }
622 dst_width = newW;
620 } 623 }
621 dstStride[1] = dstStride[2] = 0; 624 dstStride[1] = dstStride[2] = 0;
622 dst[1] = dst[2] = NULL; 625 dst[1] = dst[2] = NULL;
623 626
624 if (Flip_Flag) 627 if (Flip_Flag)