[maemo-commits] [maemo-commits] r17612 - in projects/haf/trunk/clutter: clutter/cogl/common clutter/eglx debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Mar 9 14:01:44 EET 2009
Author: gw
Date: 2009-03-09 14:01:37 +0200 (Mon, 09 Mar 2009)
New Revision: 17612

Modified:
   projects/haf/trunk/clutter/clutter/cogl/common/pvr-texture.c
   projects/haf/trunk/clutter/clutter/cogl/common/pvr-texture.h
   projects/haf/trunk/clutter/clutter/eglx/clutter-stage-egl.c
   projects/haf/trunk/clutter/debian/changelog
Log:
  * Moved Jan Arne's additions in PVRTC to clutter
  * Made clutter create a black window by default, NB#104157


Modified: projects/haf/trunk/clutter/clutter/cogl/common/pvr-texture.c
===================================================================
--- projects/haf/trunk/clutter/clutter/cogl/common/pvr-texture.c	2009-03-09 11:05:05 UTC (rev 17611)
+++ projects/haf/trunk/clutter/clutter/cogl/common/pvr-texture.c	2009-03-09 12:01:37 UTC (rev 17612)
@@ -26,6 +26,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
+#include <unistd.h>
 
 #if USE_GL
 /* These are defined in GLES2/gl2ext + gl2extimg, but we want them available
@@ -142,6 +144,118 @@
     return TRUE;
 }
 
+gboolean
+pvr_texture_save_pvrtc4_atomically (const gchar   *filename,
+                                    const guchar  *data,
+                                    guint          data_size,
+                                    gint           width,
+                                    gint           height,
+                                    GError       **error)
+{
+  gchar *tmpl;
+  gint fd;
+  PVR_TEXTURE_HEADER head;
+
+  /* Head */
+  head.dwHeaderSize = sizeof(PVR_TEXTURE_HEADER);     /* size of the structure */
+  head.dwHeight = height;         /* height of surface to be created */
+  head.dwWidth = width;          /* width of input surface */
+  head.dwMipMapCount = 0;    /* number of MIP-map levels requested */
+  head.dwpfFlags = MGLPT_PVRTC4 | PVR_FLAG_TWIDDLED | PVR_FLAG_ALPHA;        /* pixel format flags */
+  head.dwDataSize = data_size;       /* Size of the compress data */
+  head.dwBitCount = 4;       /* number of bits per pixel */
+  head.dwRBitMask = 0;       /* mask for red bit */
+  head.dwGBitMask = 0;       /* mask for green bits */
+  head.dwBBitMask = 0;       /* mask for blue bits */
+  head.dwAlphaBitMask = 1;   /* mask for alpha channel */
+  head.dwPVR = 'P' | 'V'<<8 | 'R'<<16 | '!'<<24; /* should be 'P' 'V' 'R' '!' */
+  head.dwNumSurfs = 1;       /* number of slices for volume textures or skyboxes */
+
+  tmpl = g_strdup_printf ("%sXXXXXX", filename);
+  fd = mkstemp (tmpl);
+  if (fd == -1)
+    {
+      GFileError code = g_file_error_from_errno (errno);
+
+      g_set_error (error,
+                   G_FILE_ERROR,
+                   code,
+                   "Could not open template file for %s",
+                   filename);
+      g_free (tmpl);
+      return FALSE;
+    }
+
+  if (write(fd, &head, sizeof(PVR_TEXTURE_HEADER)) == -1)
+    {
+      GFileError code = g_file_error_from_errno (errno);
+
+      g_set_error (error,
+                   G_FILE_ERROR,
+                   code,
+                   "Could not write header to %s",
+                   tmpl);
+      g_free (tmpl);
+      return FALSE;
+    }
+
+  if (write(fd, data, data_size) == -1)
+    {
+      GFileError code = g_file_error_from_errno (errno);
+
+      g_set_error (error,
+                   G_FILE_ERROR,
+                   code,
+                   "Could not write header to %s",
+                   tmpl);
+      g_free (tmpl);
+      return FALSE;
+    }
+
+  if (fdatasync (fd) == -1)
+    {
+      GFileError code = g_file_error_from_errno (errno);
+
+      g_set_error (error,
+                   G_FILE_ERROR,
+                   code,
+                   "Could not sync %s",
+                   tmpl);
+      g_free (tmpl);
+      return FALSE;
+    }
+
+  if (close (fd) == -1)
+    {
+      GFileError code = g_file_error_from_errno (errno);
+
+      g_set_error (error,
+                   G_FILE_ERROR,
+                   code,
+                   "Could not close %s",
+                   tmpl);
+      g_free (tmpl);
+      return FALSE;
+    }
+
+  if (rename (tmpl, filename) == -1)
+    {
+      GFileError code = g_file_error_from_errno (errno);
+
+      g_set_error (error,
+                   G_FILE_ERROR,
+                   code,
+                   "Could not rename %s to %s",
+                   tmpl,
+                   filename);
+      g_free (tmpl);
+      return FALSE;
+    }
+
+  g_free (tmpl);
+  return TRUE;
+}
+
 #define SETMIN(result, col) { \
         if ((result).red   > (col).red)   (result).red   = (col).red; \
         if ((result).green > (col).green) (result).green = (col).green; \

Modified: projects/haf/trunk/clutter/clutter/cogl/common/pvr-texture.h
===================================================================
--- projects/haf/trunk/clutter/clutter/cogl/common/pvr-texture.h	2009-03-09 11:05:05 UTC (rev 17611)
+++ projects/haf/trunk/clutter/clutter/cogl/common/pvr-texture.h	2009-03-09 12:01:37 UTC (rev 17612)
@@ -67,4 +67,10 @@
                 gint width,
                 gint height);
 
+gboolean pvr_texture_save_pvrtc4_atomically (const gchar   *filename,
+                                             const guchar  *data,
+                                             guint          data_size,
+                                             gint           width,
+                                             gint           height,
+                                             GError       **error);
 #endif /*PVRTEXTURE_H_*/

Modified: projects/haf/trunk/clutter/clutter/eglx/clutter-stage-egl.c
===================================================================
--- projects/haf/trunk/clutter/clutter/eglx/clutter-stage-egl.c	2009-03-09 11:05:05 UTC (rev 17611)
+++ projects/haf/trunk/clutter/clutter/eglx/clutter-stage-egl.c	2009-03-09 12:01:37 UTC (rev 17612)
@@ -96,7 +96,10 @@
       EGLConfig *all_configs;
 
       EGLint cfg_attribs[16] = {
-        EGL_BUFFER_SIZE,    16,
+        EGL_BUFFER_SIZE,  16,
+        /*EGL_RED_SIZE,    8,
+        EGL_GREEN_SIZE,    8,
+        EGL_BLUE_SIZE,    8,*/
         EGL_STENCIL_SIZE,   0, /* Skip stencil as we can use Scissoring to
                                   be faster */
 
@@ -209,7 +212,7 @@
                                stage_x11->xwin_width,
                                stage_x11->xwin_height,
                                0, 0,
-                               WhitePixel (stage_x11->xdpy,
+                               BlackPixel (stage_x11->xdpy,
                                            stage_x11->xscreen));
 
       /*

Modified: projects/haf/trunk/clutter/debian/changelog
===================================================================
--- projects/haf/trunk/clutter/debian/changelog	2009-03-09 11:05:05 UTC (rev 17611)
+++ projects/haf/trunk/clutter/debian/changelog	2009-03-09 12:01:37 UTC (rev 17612)
@@ -12,6 +12,8 @@
   * added small speedup to PVRTC
   * Modified timeline priority to ensure that animation happens before redraws
   * Fixed possible double-free in cogl_texture_set_region
+  * Moved Jan Arne's additions in PVRTC to clutter
+  * Made clutter create a black window by default, NB#104157
 
  -- Gordon Williams <gordon.williams at collabora.co.uk>  Mon,  2 Mar 2009 09:37:27 +0200
 


More information about the maemo-commits mailing list