Ich nochmal.
Das minimal an Ingrids Diff angepasste Diff funktioniert so wie ich das mit dem Parameter meinte.
Code: Alles auswählen
diff -Naur old/framebuffer.cpp new/framebuffer.cpp
--- old/framebuffer.cpp 2008-02-28 16:58:10.000000000 +0100
+++ new/framebuffer.cpp 2008-02-28 16:29:31.000000000 +0100
@@ -619,9 +619,13 @@
*pos = col;
}
-void CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, const int radius)
+void CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, const int radius, const int corners)
{
int F,R=radius,sx,sy,dxx=dx,dyy=dy,rx,ry,wx,wy;
+ int corner1 = corners & 1; // upper left
+ int corner2 = (corners>>1) & 1; // upper right
+ int corner3 = (corners>>2) & 1; // lower right
+ int corner4 = (corners>>3) & 1; // lower left
if (!getActive())
return;
@@ -683,25 +687,27 @@
wx=rx<<1;
wy=ry<<1;
#ifdef FB_USE_PALETTE
- memset(pos0+rx, col, dxx-wx);
- memset(pos1+rx, col, dxx-wx);
- memset(pos2+ry, col, dxx-wy);
- memset(pos3+ry, col, dxx-wy);
+ memset(pos0+(rx*corner4), col, dxx-(wx*corner3)-(rx*(1-corner3))+(rx*(1-corner4)));
+ memset(pos1+(rx*corner1), col, dxx-(wx*corner2)-(rx*(1-corner2))+(rx*(1-corner1)));
+ memset(pos2+(ry*corner1), col, dxx-(wy*corner2)-(ry*(1-corner2))+(ry*(1-corner1)));
+ memset(pos3+(ry*corner4), col, dxx-(wy*corner3)-(ry*(1-corner3))+(ry*(1-corner4)));
#else
- dest0=(fb_pixel_t *)(pos0+rx);
- dest1=(fb_pixel_t *)(pos1+rx);
- for (int i=0; i<(dxx-wx); i++)
- {
+ dest0=(fb_pixel_t *)(pos0+(rx*corner4));
+ for (int i=0; i<(dxx-(wx*corner3)-(rx*(1-corner3))+(rx*(1-corner4))); i++)
*(dest0++)=col;
+
+ dest1=(fb_pixel_t *)(pos1+(rx*corner1));
+ for (int i=0; i<(dxx-(wx*corner2)-(rx*(1-corner2))+(rx*(1-corner1))); i++)
*(dest1++)=col;
- }
- dest0=(fb_pixel_t *)(pos2+ry);
- dest1=(fb_pixel_t *)(pos3+ry);
- for (int i=0; i<(dxx-wy); i++)
- {
+
+ dest0=(fb_pixel_t *)(pos2+(ry*corner1));
+ for (int i=0; i<(dxx-(wy*corner2)-(ry*(1-corner2))+(ry*(1-corner1))); i++)
*(dest0++)=col;
+
+ dest1=(fb_pixel_t *)(pos3+(ry*corner4));
+ for (int i=0; i<(dxx-(wy*corner3)-(ry*(1-corner3))+(ry*(1-corner4))); i++)
*(dest1++)=col;
- }
+
#endif
sx++;
pos2-=stride;
diff -Naur old/framebuffer.h new/framebuffer.h
--- old/framebuffer.h 2008-02-28 16:58:10.000000000 +0100
+++ new/framebuffer.h 2008-02-28 17:04:51.000000000 +0100
@@ -41,6 +41,15 @@
#define fb_pixel_t uint16_t
#endif
+#define CORNER_TOP_LEFT 0x1
+#define CORNER_TOP_RIGHT 0x2
+#define CORNER_TOP 0x3
+#define CORNER_BOTTOM_RIGHT 0x4
+#define CORNER_RIGHT 0x6
+#define CORNER_BOTTOM_LEFT 0x8
+#define CORNER_LEFT 0x9
+#define CORNER_BOTTOM 0xC
+
typedef struct fb_var_screeninfo t_fb_var_screeninfo;
/** Ausfuehrung als Singleton */
@@ -131,7 +140,7 @@
};
void paintPixel(int x, int y, const fb_pixel_t col);
- void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, const int radius = 0);
+ void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, const int radius = 0, const int corners = 0xf);
inline void paintBox(int xa, int ya, int xb, int yb, const fb_pixel_t col) { paintBoxRel(xa, ya, xb - xa, yb - ya, col); }
void paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col);
CORNER_NONE und CORNER_ALL werden so nicht gebraucht, da man einfach den letzten Wert für CORNER_ALL oder beide für CORNER_NONE weglassen muss.