This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
       via  98ac76b77878b7cf3f00720a8a557d7c82c1c8ba (commit)
       via  d40fdae1edee89208cfba1f9e51d289ea76dda88 (commit)
      from  1265873fa310aa42d42fdfad1483c5f66d304825 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/98ac76b77878b7cf3f00720a8a557d7c82c1c8ba

commit 98ac76b77878b7cf3f00720a8a557d7c82c1c8ba
Author: Carlos R. Mafra <crma...@gmail.com>
Date:   Wed May 21 10:31:53 2014 +0100

    fix

diff --git a/wrlib/flip.c b/wrlib/flip.c
index e0aeb5c8..6801783c 100644
--- a/wrlib/flip.c
+++ b/wrlib/flip.c
@@ -39,9 +39,8 @@ RImage *RVerticalFlipImage(RImage *image)
        nheight = image->height;
 
        img = RCreateImage(nwidth, nheight, True);
-       if (!img) {
+       if (!img)
                return NULL;
-       }
 
        if (bpp == 3) {
                        unsigned char *optr, *nptr;
@@ -94,9 +93,8 @@ RImage *RHorizontalFlipImage(RImage *image)
        nheight = image->height;
 
        img = RCreateImage(nwidth, nheight, True);
-       if (!img) {
+       if (!img)
                return NULL;
-       }
 
        if (bpp == 3) {
                        unsigned char *optr, *nptr;

http://repo.or.cz/w/wmaker-crm.git/commit/d40fdae1edee89208cfba1f9e51d289ea76dda88

commit d40fdae1edee89208cfba1f9e51d289ea76dda88
Author: David Maciejak <david.macie...@gmail.com>
Date:   Wed May 21 11:59:48 2014 +0700

    wrlib: add image flip functions
    
    This patch adds RVerticalFlipImage and RHorizontalFlipImage functions.

diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am
index 3f229c53..489b4a4e 100644
--- a/wrlib/Makefile.am
+++ b/wrlib/Makefile.am
@@ -34,6 +34,7 @@ libwraster_la_SOURCES =               misc.c                  
scale.c                 rotate.c        +       flip.c                  
convolve.c              save_xpm.c              xutil.c         diff --git 
a/wrlib/flip.c b/wrlib/flip.c
new file mode 100644
index 00000000..e0aeb5c8
--- /dev/null
+++ b/wrlib/flip.c
@@ -0,0 +1,135 @@
+/* flip.c - image flip
+ *
+ * Raster graphics library
+ *
+ * Copyright (c) 2014 Window Maker Team
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *  MA 02110-1301, USA.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <X11/Xlib.h>
+#include "wraster.h"
+
+RImage *RVerticalFlipImage(RImage *image)
+{
+       RImage *img;
+       int nwidth, nheight;
+       int x, y;
+       int bpp = image->format == RRGBAFormat ? 4 : 3;
+
+       nwidth = image->width;
+       nheight = image->height;
+
+       img = RCreateImage(nwidth, nheight, True);
+       if (!img) {
+               return NULL;
+       }
+
+       if (bpp == 3) {
+                       unsigned char *optr, *nptr;
+
+                       optr = image->data;
+                       nptr = img->data + 4 * (nwidth * nheight - nwidth - 1);
+
+                       for (y = 0; y < nheight; y++) {
+                               for (x = 0; x < nwidth; x++) {
+                                       nptr[0] = optr[0];
+                                       nptr[1] = optr[1];
+                                       nptr[2] = optr[2];
+                                       nptr[3] = 255;
+
+                                       optr += 3;
+                                       nptr += 4;
+                               }
+                               nptr -= nwidth*8;
+                       }
+               } else {
+                       unsigned char *optr, *nptr;
+
+                       optr = image->data;
+                       nptr = img->data + 4 * (nwidth * nheight - nwidth - 1);
+
+                       for (y = 0; y < nheight; y++) {
+                               for (x = 0; x < nwidth; x++) {
+                                       nptr[0] = optr[0];
+                                       nptr[1] = optr[1];
+                                       nptr[2] = optr[2];
+                                       nptr[3] = optr[3];
+
+                                       optr += 4;
+                                       nptr += 4;
+                               }
+                               nptr -= nwidth*8;
+                       }
+               }
+       return img;
+}
+
+RImage *RHorizontalFlipImage(RImage *image)
+{
+       RImage *img;
+       int nwidth, nheight;
+       int x, y;
+       int bpp = image->format == RRGBAFormat ? 4 : 3;
+
+       nwidth = image->width;
+       nheight = image->height;
+
+       img = RCreateImage(nwidth, nheight, True);
+       if (!img) {
+               return NULL;
+       }
+
+       if (bpp == 3) {
+                       unsigned char *optr, *nptr;
+
+                       nptr = img->data + nwidth * nheight * 4 - 4;
+                       for (y = nheight; y; y--) {
+                               for (x = 0; x < nwidth; x++) {
+                                       optr = image->data + (y*nwidth + x) * 3;
+
+                                       nptr[0] = optr[0];
+                                       nptr[1] = optr[1];
+                                       nptr[2] = optr[2];
+                                       nptr[3] = 255;
+
+                                       nptr -= 4;
+                               }
+                       }
+               } else {
+                       unsigned char *optr, *nptr;
+
+                       nptr = img->data + nwidth * nheight * 4 - 4;
+                       for (y = nheight; y; y--) {
+                               for (x = 0; x < nwidth; x++) {
+                                       optr = image->data + (y*nwidth + x) * 4;
+
+                                       nptr[0] = optr[0];
+                                       nptr[1] = optr[1];
+                                       nptr[2] = optr[2];
+                                       nptr[3] = optr[3];
+
+                                       nptr -= 4;
+                               }
+                       }
+               }
+       return img;
+}
diff --git a/wrlib/libwraster.map b/wrlib/libwraster.map
index 062dcd95..cf364014 100644
--- a/wrlib/libwraster.map
+++ b/wrlib/libwraster.map
@@ -72,6 +72,8 @@ LIBWRASTER3
     RRetainImage;
     RRGBtoHSV;
     RRotateImage;
+    RVerticalFlipImage;
+    RHorizontalFlipImage;
     RSaveImage;
     RScaleImage;
     RShutdown;
diff --git a/wrlib/wraster.h b/wrlib/wraster.h
index 20038690..45cbcc6b 100644
--- a/wrlib/wraster.h
+++ b/wrlib/wraster.h
@@ -371,6 +371,9 @@ RImage *RSmoothScaleImage(RImage *src, unsigned new_width,
 
 RImage *RRotateImage(RImage *image, float angle);
 
+RImage *RVerticalFlipImage(RImage *image);
+
+RImage *RHorizontalFlipImage(RImage *image);
 
 RImage *RMakeTiledImage(RImage *tile, unsigned width, unsigned height);
 

-----------------------------------------------------------------------

Summary of changes:
 wrlib/Makefile.am    |    1 +
 wrlib/flip.c         |  133 ++++++++++++++++++++++++++++++++++++++++++++++++++
 wrlib/libwraster.map |    2 +
 wrlib/wraster.h      |    3 +
 4 files changed, 139 insertions(+), 0 deletions(-)
 create mode 100644 wrlib/flip.c


repo.or.cz automatic notification. Contact project admin crma...@gmail.com
if you want to unsubscribe, or site admin ad...@repo.or.cz if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to