summaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/compositor.c61
1 files changed, 33 insertions, 28 deletions
diff --git a/video/compositor.c b/video/compositor.c
index 3751c05..645900e 100644
--- a/video/compositor.c
+++ b/video/compositor.c
@@ -349,43 +349,48 @@ double sqroot(double n){
void compositor_set_background(char *ppm_raw_filename)
{
-// uint64_t t=timer_get_ms()/333;
- /*
- klog("loading bg...");
- fd bg=mount_file_open(ppm_raw_filename);
-
- uint32_t i=0;
+ // TODO: think about funny things to do with timer and update
+ // some generated / or modified bg regularly //
+ // uint64_t t=timer_get_ms()/333; //
- for(int y=0;y<vesa_width;y++)
+ if(ppm_raw_filename!=0)
{
- for(int x=0;x<vesa_height;x++)
+ klog("loading bg...");
+ fd bg=mount_file_open(ppm_raw_filename);
+
+ uint32_t i=0;
+
+ for(int y=0;y<vesa_width;y++)
{
- bgimage[i]=(fd_read(&bg)<<16)+(fd_read(&bg)<<8)+fd_read(&bg);
- backbuffer[i]=bgimage[i];
- i++;
+ for(int x=0;x<vesa_height;x++)
+ {
+ bgimage[i]=(fd_read(&bg)<<16)+(fd_read(&bg)<<8)+fd_read(&bg);
+ backbuffer[i]=bgimage[i];
+ i++;
+ }
}
- }
-
- klog("finished");
- */
- int center_x=vesa_width/2;
- int center_y=vesa_height/2;
+ klog("finished");
+ }
+ else
+ {
+ int center_x=vesa_width/2;
+ int center_y=vesa_height/2;
- int max_dist = center_x*center_x+center_y*center_y;
+ int max_dist = center_x*center_x+center_y*center_y;
- for(int x=0;x<vesa_width;x++)
- {
- for(int y=0;y<vesa_height;y++)
+ for(int x=0;x<vesa_width;x++)
{
- int diffx=center_x-x;
- int diffy=center_y-y;
- int dist=diffx*diffx+diffy*diffy;
- int val = 0xff*dist/max_dist;
+ for(int y=0;y<vesa_height;y++)
+ {
+ int diffx=center_x-x;
+ int diffy=center_y-y;
+ int dist=diffx*diffx+diffy*diffy;
+ int val = 0xff*dist/max_dist;
- bgimage[x+y*vesa_width]=val;
- //backbuffer[x+y*vesa_width]=valr<<16;
+ bgimage[x+y*vesa_width]=val;
+ //backbuffer[x+y*vesa_width]=valr<<16;
+ }
}
}
-
}