Browse code

Make the function listing slightly transparent (as intended)

Dario Rodriguez authored on 05/03/2022 19:08:23
Showing 3 changed files
... ...
@@ -275,6 +275,37 @@ reui_fillrounded(reui_t *ui, int x, int y, int w, int h, const char *rgba)
275 275
         return(0);
276 276
 }
277 277
 
278
+int
279
+reui_fillblended(reui_t *ui, int x, int y, int w, int h, const char *rgba)
280
+{
281
+        SDL_Surface *bgsurface;
282
+        SDL_Texture *tex;
283
+        SDL_Rect dstrect;
284
+        Uint32 color;
285
+        if(ui==NULL || rgba==NULL)
286
+                return(-1);
287
+        if((bgsurface=SDL_CreateRGBSurface(0
288
+          ,1
289
+          ,1
290
+          ,32, ui->rmask, ui->gmask, ui->bmask, ui->amask))==NULL) {
291
+                return(-1);
292
+        }
293
+        color=CHARRGBA2UINT(rgba);
294
+        RECTFILL(dstrect,0,0,1,1);
295
+        SDL_FillRect(bgsurface,&dstrect,color);
296
+        if((tex=SDL_CreateTextureFromSurface(ui->renderer,bgsurface))==NULL) {
297
+                SDL_FreeSurface(bgsurface),bgsurface=NULL;
298
+                return(-1);
299
+        }
300
+        RECTFILL(dstrect,x,y,w,h);
301
+        SDL_RenderCopy(ui->renderer,tex,NULL,&dstrect);
302
+        ui->rendererdirty=1;
303
+        SDL_FreeSurface(bgsurface),bgsurface=NULL;
304
+        SDL_DestroyTexture(tex),tex=NULL;
305
+        return(0);
306
+}
307
+
308
+
278 309
 
279 310
 int
280 311
 reui_scr2renderer(reui_t *ui, int x, int y, int w, int h)
... ...
@@ -493,7 +524,6 @@ reui_balloon(reui_t *ui, char direction, int x, int y, const char *rgbafg, const
493 524
         SDL_FreeSurface(bgsurface),bgsurface=NULL;
494 525
         SDL_DestroyTexture(tex),tex=NULL;
495 526
         return(0);
496
-
497 527
 }
498 528
 
499 529
 
... ...
@@ -42,6 +42,7 @@ int reui_resize(reui_t *ui, int w, int h);
42 42
 int reui_setfontheight(reui_t *ui, int fontheight);
43 43
 int reui_fill(reui_t *ui, int x, int y, int w, int h, const char *rgba);
44 44
 int reui_fillrounded(reui_t *ui, int x, int y, int w, int h, const char *rgba);
45
+int reui_fillblended(reui_t *ui, int x, int y, int w, int h, const char *rgba);
45 46
 int reui_scr2renderer(reui_t *ui, int x, int y, int w, int h);
46 47
 int reui_present(reui_t *ui);
47 48
 
... ...
@@ -2468,16 +2468,16 @@ re_drawcontents(re_t *re, printout_t *printout)
2468 2468
                 int total,i,ypos;
2469 2469
                 char linebuf[1024];
2470 2470
                 char *fg;
2471
-                reui_fill(ui,x0,y0,w,re->h-y0,"\x44\x33\x22\x7f");
2471
+                reui_fillblended(ui,x0-linenowidth,y0,w,re->h,"\x44\x33\x22\xef");
2472 2472
                 for(total=redata_line_total(re->funclisting),i=re->originlinefunclisting,ypos=y0;i<total && ypos<re->h;i++,ypos+=(ui->fontheight/((linebuf[0]=='\0')?2:1))) {
2473 2473
                         fg="\xff\xff\xff\xff";
2474 2474
                         if(i==re->curlinefunclisting) {
2475
-                                reui_fill(ui,x0+ui->fontwidth*3,ypos,w-ui->fontwidth*6,ui->fontheight,"\xdf\xdf\xdf\xff");
2475
+                                reui_fill(ui,x0-linenowidth+ui->fontwidth*3,ypos,w-ui->fontwidth*6,ui->fontheight,"\xdf\xdf\xdf\xff");
2476 2476
                                 fg="\x00\x00\x00\xff";
2477 2477
                         }
2478 2478
                         if(redata_line_getstartstr(re->funclisting,i,linebuf,sizeof(linebuf))!=0)
2479 2479
                                 break;
2480
-                        reui_write(ui,x0+ui->fontwidth*3,ypos,fg,linebuf,strlen(linebuf));
2480
+                        reui_write(ui,x0-linenowidth+ui->fontwidth*3,ypos,fg,linebuf,strlen(linebuf));
2481 2481
                 }
2482 2482
         }
2483 2483
         /* all done */