]> Dogcows Code - chaz/openbox/commitdiff
a "osx" gradient, it is like horizontal but mirrors in the center
authorMikael Magnusson <mikachu@comhem.se>
Tue, 1 Aug 2006 20:34:35 +0000 (20:34 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Tue, 1 Aug 2006 20:34:35 +0000 (20:34 +0000)
render/gradient.c
render/render.h
render/theme.c

index 9f245743b1bfceefbcece5c68e7be26bc7d92566..7b26e54c820df1515042cfea5174087f5b1d0d3f 100644 (file)
@@ -27,6 +27,7 @@ static void gradient_solid(RrAppearance *l, gint w, gint h);
 static void gradient_split(RrAppearance *a, gint w, gint h);
 static void gradient_vertical(RrSurface *sf, gint w, gint h);
 static void gradient_horizontal(RrSurface *sf, gint w, gint h);
+static void gradient_osx(RrSurface *sf, gint w, gint h);
 static void gradient_diagonal(RrSurface *sf, gint w, gint h);
 static void gradient_crossdiagonal(RrSurface *sf, gint w, gint h);
 static void gradient_pyramid(RrSurface *sf, gint inw, gint inh);
@@ -51,6 +52,9 @@ void RrRender(RrAppearance *a, gint w, gint h)
     case RR_SURFACE_HORIZONTAL:
         gradient_horizontal(&a->surface, w, h);
         break;
+    case RR_SURFACE_OSX:
+        gradient_osx(&a->surface, w, h);
+        break;
     case RR_SURFACE_DIAGONAL:
         gradient_diagonal(&a->surface, w, h);
         break;
@@ -449,6 +453,43 @@ static void gradient_horizontal(RrSurface *sf, gint w, gint h)
         *(data + y * w) = current;
 }
 
+static void gradient_osx(RrSurface *sf, gint w, gint h)
+{
+    gint x, y;
+    RrPixel32 *data = sf->pixel_data, *datav;
+    RrPixel32 current;
+
+    VARS(x);
+    SETUP(x, sf->primary, sf->secondary, w/2);
+
+    for (x = w - 1; x > w/2-1; --x) {  /* 0 -> w-1 */
+        current = COLOR(x);
+        datav = data;
+        for (y = h - 1; y >= 0; --y) {  /* 0 -> h */
+            *datav = current;
+            datav += w;
+        }
+        ++data;
+
+        NEXT(x);
+    }
+    SETUP(x, sf->secondary, sf->primary, w/2);
+    for (x = w/2 - 1; x > 0; --x) {  /* 0 -> w-1 */
+        current = COLOR(x);
+        datav = data;
+        for (y = h - 1; y >= 0; --y) {  /* 0 -> h */
+            *datav = current;
+            datav += w;
+        }
+        ++data;
+
+        NEXT(x);
+    }
+    current = COLOR(x);
+    for (y = h - 1; y >= 0; --y)  /* 0 -> h */
+        *(data + y * w) = current;
+}
+
 static void gradient_vertical(RrSurface *sf, gint w, gint h)
 {
     gint x, y;
index 195631379ec99e8e67de5a37529978917f02825f..22a9bac7061c763db3139cdd714f1f9a4daf0974 100644 (file)
@@ -66,7 +66,8 @@ typedef enum {
     RR_SURFACE_VERTICAL,
     RR_SURFACE_DIAGONAL,
     RR_SURFACE_CROSS_DIAGONAL,
-    RR_SURFACE_PYRAMID
+    RR_SURFACE_PYRAMID,
+    RR_SURFACE_OSX
 } RrSurfaceColorType;
 
 typedef enum {
index e89e4dc903bf68dffa486a435a04e79187da0da8..0185469cafc8766819c88620440dc958f92f399c 100644 (file)
@@ -1196,6 +1196,8 @@ static void parse_appearance(gchar *tex, RrSurfaceColorType *grad,
                 *grad = RR_SURFACE_CROSS_DIAGONAL;
             else if (strstr(tex, "pyramid") != NULL)
                 *grad = RR_SURFACE_PYRAMID;
+            else if (strstr(tex, "osx") != NULL)
+                *grad = RR_SURFACE_OSX;
             else if (strstr(tex, "horizontal") != NULL)
                 *grad = RR_SURFACE_HORIZONTAL;
             else if (strstr(tex, "vertical") != NULL)
This page took 0.027073 seconds and 4 git commands to generate.