Two improvements from upstream..

- Use fast path for RGB 565 -> 32-bit XRGB 8888
- Use _NET_WM_ICON if possible for X11's SDL_WM_SetIcon() implementation

OK?


Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl/Makefile,v
retrieving revision 1.94
diff -u -p -r1.94 Makefile
--- Makefile    15 Dec 2013 01:57:55 -0000      1.94
+++ Makefile    15 Dec 2013 03:05:29 -0000
@@ -5,7 +5,7 @@ COMMENT=        cross-platform multimedia libra
 VERSION=       1.2.15
 DISTNAME=      SDL-${VERSION}
 PKGNAME=       ${DISTNAME:L}
-REVISION=      4
+REVISION=      5
 CATEGORIES=    devel
 MASTER_SITES=  ${HOMEPAGE}release/
 
Index: patches/patch-src_video_SDL_blit_N_c
===================================================================
RCS file: /cvs/ports/devel/sdl/patches/patch-src_video_SDL_blit_N_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_video_SDL_blit_N_c
--- patches/patch-src_video_SDL_blit_N_c        2 Mar 2012 09:10:38 -0000       
1.1
+++ patches/patch-src_video_SDL_blit_N_c        15 Dec 2013 03:05:29 -0000
@@ -1,9 +1,10 @@
 $OpenBSD: patch-src_video_SDL_blit_N_c,v 1.1 2012/03/02 09:10:38 dcoppa Exp $
 
-Fixed bug 1424 - Handling of alpha channel in Altivec accelerated blit 
functions
+- Fixed bug 1424 - Handling of alpha channel in Altivec accelerated blit 
functions
+- Use fast path for RGB 565 -> 32-bit XRGB 8888
 
---- src/video/SDL_blit_N.c.orig        Wed Feb 22 19:36:49 2012
-+++ src/video/SDL_blit_N.c     Wed Feb 22 19:38:46 2012
+--- src/video/SDL_blit_N.c.orig        Thu Jan 19 01:30:06 2012
++++ src/video/SDL_blit_N.c     Thu Oct 25 21:57:48 2012
 @@ -689,6 +689,8 @@ static void ConvertAltivec32to32_noprefetch(SDL_BlitIn
          while ((UNALIGNED_PTR(dst)) && (width)) {
              bits = *(src++);
@@ -40,3 +41,21 @@ Fixed bug 1424 - Handling of alpha chann
              *(dst++) = MAKE8888(dstfmt, r, g, b, a);
              extrawidth--;
          }
+@@ -2299,13 +2307,13 @@ static const struct blit_table normal_blit_2[] = {
+       2, NULL, Blit_RGB555_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
+ #endif
+     { 0x0000F800,0x000007E0,0x0000001F, 4, 0x00FF0000,0x0000FF00,0x000000FF,
+-      0, NULL, Blit_RGB565_ARGB8888, SET_ALPHA },
++      0, NULL, Blit_RGB565_ARGB8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
+     { 0x0000F800,0x000007E0,0x0000001F, 4, 0x000000FF,0x0000FF00,0x00FF0000,
+-      0, NULL, Blit_RGB565_ABGR8888, SET_ALPHA },
++      0, NULL, Blit_RGB565_ABGR8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
+     { 0x0000F800,0x000007E0,0x0000001F, 4, 0xFF000000,0x00FF0000,0x0000FF00,
+-      0, NULL, Blit_RGB565_RGBA8888, SET_ALPHA },
++      0, NULL, Blit_RGB565_RGBA8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
+     { 0x0000F800,0x000007E0,0x0000001F, 4, 0x0000FF00,0x00FF0000,0xFF000000,
+-      0, NULL, Blit_RGB565_BGRA8888, SET_ALPHA },
++      0, NULL, Blit_RGB565_BGRA8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
+ 
+     /* Default for 16-bit RGB source, used if no other blitter matches */
+     { 0,0,0, 0, 0,0,0, 0, NULL, BlitNtoN, 0 }
Index: patches/patch-src_video_x11_SDL_x11wm_c
===================================================================
RCS file: patches/patch-src_video_x11_SDL_x11wm_c
diff -N patches/patch-src_video_x11_SDL_x11wm_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_video_x11_SDL_x11wm_c     15 Dec 2013 03:05:29 -0000
@@ -0,0 +1,96 @@
+$OpenBSD$
+
+Use _NET_WM_ICON if possible for X11's SDL_WM_SetIcon() implementation.
+
+--- src/video/x11/SDL_x11wm.c.orig     Thu Oct 25 21:58:52 2012
++++ src/video/x11/SDL_x11wm.c  Thu Oct 25 22:01:06 2012
+@@ -43,6 +43,7 @@ static Uint8 reverse_byte(Uint8 x)
+ 
+ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
+ {
++      Atom _NET_WM_ICON = XInternAtom(SDL_Display, "_NET_WM_ICON", False);
+       SDL_Surface *sicon;
+       XWMHints *wmhints;
+       XImage *icon_image;
+@@ -59,6 +60,81 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask
+       int masksize;
+ 
+       SDL_Lock_EventThread();
++
++      if (_NET_WM_ICON) {   /* better interface for modern systems. */
++              SDL_PixelFormat format;
++              SDL_Surface *surface;
++              int propsize;
++              long *propdata;
++
++              /* Convert the icon to ARGB for modern window managers */
++              SDL_memset(&format, 0, sizeof (format));
++              format.BitsPerPixel = 32;
++              format.BytesPerPixel = 4;
++              #if SDL_BYTEORDER == SDL_BIG_ENDIAN
++              format.Rshift = 8;
++              format.Gshift = 16;
++              format.Bshift = 24;
++              format.Ashift = 0;
++              #else
++              format.Rshift = 16;
++              format.Gshift = 8;
++              format.Bshift = 0;
++              format.Ashift = 24;
++              #endif
++              format.Rmask = 0xFF << format.Rshift;
++              format.Gmask = 0xFF << format.Gshift;
++              format.Bmask = 0xFF << format.Bshift;
++              format.Amask = 0xFF << format.Ashift;
++              format.alpha = SDL_ALPHA_OPAQUE;
++
++              surface = SDL_ConvertSurface(icon, &format, 0);
++              if (!surface) {
++                      return;
++              }
++
++              /* Set the _NET_WM_ICON property */
++              propsize = 2 + (icon->w * icon->h);
++              propdata = SDL_malloc(propsize * sizeof(long));
++              if (propdata) {
++                      const Uint32 alpha = format.Amask;
++                      int x, y;
++                      Uint32 *src;
++                      long *dst;
++
++                      propdata[0] = icon->w;
++                      propdata[1] = icon->h;
++                      dst = &propdata[2];
++
++                      size_t maskidx = 0;
++                      for (y = 0; y < icon->h; ++y) {
++                              src = (Uint32*)((Uint8*)surface->pixels + y * 
surface->pitch);
++                              for (x = 0; x < icon->w; ++x) {
++                                      const Uint32 pixel = *(src++);
++                                      if (mask[maskidx / 8] & (1<<(7-(maskidx 
% 8)))) {
++                                              *dst++ = pixel | alpha;
++                                      } else {
++                                              *dst++ = pixel & ~alpha;
++                                      }
++                                      maskidx++;
++                              }
++                      }
++
++                      XChangeProperty(SDL_Display, WMwindow, _NET_WM_ICON, 
XA_CARDINAL,
++                                      32, PropModeReplace, (unsigned char *) 
propdata,
++                                      propsize);
++              }
++
++              SDL_FreeSurface(surface);
++              SDL_free(propdata);
++
++              XFlush(SDL_Display);
++              SDL_Unlock_EventThread();
++
++              return;
++      }
++
++      /* Do it the old way... */
+ 
+       /* The icon must use the default visual, depth and colormap of the
+          screen, so it might need a conversion */

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to