]> git.webhop.me Git - shellexec.git/commitdiff
- shellexec: enlarge "icon"
authorsvenhoefer <svenhoefer@svenhoefer.com>
Mon, 19 Sep 2016 16:37:09 +0000 (18:37 +0200)
committersvenhoefer <svenhoefer@svenhoefer.com>
Mon, 19 Sep 2016 16:37:09 +0000 (18:37 +0200)
gfx.c
gfx.h

diff --git a/gfx.c b/gfx.c
index 5d881db0555c3a8be72131f825af0b0e90e79329..caf0803bd1bfdfa76a508424131cc39daec38afc 100644 (file)
--- a/gfx.c
+++ b/gfx.c
@@ -1,22 +1,33 @@
+#include <math.h>
+
 #include "shellexec.h"
 #include "gfx.h"
 
 char circle[] =
 {
-       0,2,2,2,2,2,2,2,2,2,2,0,
-       2,1,1,1,1,1,1,1,1,1,1,2,
-       2,1,1,1,1,1,1,1,1,1,1,2,
-       2,1,1,1,1,1,1,1,1,1,1,2,
-       2,1,1,1,1,1,1,1,1,1,1,2,
-       2,1,1,1,1,1,1,1,1,1,1,2,
-       2,1,1,1,1,1,1,1,1,1,1,2,
-       2,1,1,1,1,1,1,1,1,1,1,2,
-       2,1,1,1,1,1,1,1,1,1,1,2,
-       2,1,1,1,1,1,1,1,1,1,1,2,
-       2,1,1,1,1,1,1,1,1,1,1,2,
-       0,2,2,2,2,2,2,2,2,2,2,0
+       0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0,
+       0,2,1,1,1,1,1,1,1,1,1,1,1,1,2,0,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
+       0,2,1,1,1,1,1,1,1,1,1,1,1,1,2,0,
+       0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0
 };
 
+size_t GetCircleHeight()
+{
+       return sqrt(sizeof(circle));
+}
+
 //typedef struct { unsigned char width_lo; unsigned char width_hi; unsigned char height_lo; unsigned char height_hi;   unsigned char transp; } IconHeader;
 
 void RenderBox(int sx, int sy, int ex, int ey, int rad, int col)
@@ -123,9 +134,10 @@ void RenderCircle(int sx, int sy, char col)
        uint32_t pix = bgra[col];
        uint32_t *p = lbb + startx + sx;
        int s = stride * (starty + sy);
+       int h = GetCircleHeight();
 
-       for(y = 0; y < 12 * 12; y += 12, s += stride)
-               for(x = 0; x < 12; x++)
+       for(y = 0; y < h * h; y += h, s += stride)
+               for(x = 0; x < h; x++)
                        switch(circle[x + y]) {
                                case 1: *(p + x + s) = pix; break;
                                case 2: *(p + x + s) = 0xFFFFFFFF; break;
diff --git a/gfx.h b/gfx.h
index 7005ba479745ceb71fc65626d5f0f1c64f615d60..35539bc050a4127a71e548453568863334a7a947 100644 (file)
--- a/gfx.h
+++ b/gfx.h
@@ -3,6 +3,7 @@
 
 void RenderBox(int sx, int sy, int ex, int ey, int mode, int color);
 void RenderCircle(int sx, int sy, char type);
+size_t GetCircleHeight();
 //void PaintIcon(char *filename, int x, int y, unsigned char offset);
 
 #endif