summaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-09-11 20:48:13 +0000
committerrodri <rgl@antares-labs.eu>2024-09-11 20:48:13 +0000
commit09ffa3cfc72a10e82c5c68f4010d1c518f0c3328 (patch)
treebe398761d4f406071417a0b021803d494aa90c11 /render.c
parent8806aad87f7be2d2e82c7db2b9f0978246e5a747 (diff)
downloadlibgraphics-09ffa3cfc72a10e82c5c68f4010d1c518f0c3328.tar.gz
libgraphics-09ffa3cfc72a10e82c5c68f4010d1c518f0c3328.tar.bz2
libgraphics-09ffa3cfc72a10e82c5c68f4010d1c518f0c3328.zip
change the raster format to RGBA32. draw to any image format. clean up.
got rid of the bullshit dance between XRGB32 and RGBA32, now all rasters are RGBA32 and premultiply alpha before loading up an image and drawing over the destination. this lets the user compose their own scenes with correct transparency. no more mediocre clearcolor. as a consequence drawing got slower, but if i get the turbo drawing pool working properly that should go away. textures also take alpha pre-multiplied channels into account, dividing them when sampling, so loading transparent textures will show the correct colors.
Diffstat (limited to 'render.c')
-rw-r--r--render.c26
1 files changed, 0 insertions, 26 deletions
diff --git a/render.c b/render.c
index c86c3d8..9495f30 100644
--- a/render.c
+++ b/render.c
@@ -11,8 +11,6 @@
Rectangle UR = {0,0,1,1};
//Procpool *turbodrawingpool;
-static ulong col2ul(Color);
-
static Vertexattr *
sparams_getuniform(Shaderparams *sp, char *id)
{
@@ -59,30 +57,6 @@ sparams_toraster(Shaderparams *sp, char *rname, void *v)
}
}
-static ulong
-col2ul(Color c)
-{
- uchar cbuf[4];
-
- cbuf[0] = fclamp(c.b, 0, 1)*0xFF;
- cbuf[1] = fclamp(c.g, 0, 1)*0xFF;
- cbuf[2] = fclamp(c.r, 0, 1)*0xFF;
- cbuf[3] = fclamp(c.a, 0, 1)*0xFF;
- return cbuf[3]<<24 | cbuf[2]<<16 | cbuf[1]<<8 | cbuf[0];
-}
-
-static Color
-ul2col(ulong l)
-{
- Color c;
-
- c.b = (l & 0xff)/255.0;
- c.g = (l>>8 & 0xff)/255.0;
- c.r = (l>>16 & 0xff)/255.0;
- c.a = (l>>24 & 0xff)/255.0;
- return c;
-}
-
static void
pixel(Raster *fb, Point p, Color c, int blend)
{