Browse Source

Fixed bug while loading background images in jay (#811)

* Fixed bug while loading background images in jay


Signed-off-by: fuchicar <rafita.fernandez@gmail.com>

* Fixed backgroud image bug in resize()


Signed-off-by: fuchicar <rafita.fernandez@gmail.com>
Rafa 1 year ago
parent
commit
a98b82b6de
4 changed files with 8 additions and 3 deletions
  1. 2 0
      .gitignore
  2. 4 1
      sys/src/cmd/jay/data.c
  3. 2 2
      sys/src/cmd/jay/jay.c
  4. BIN
      usr/harvey/lib/background.img

+ 2 - 0
.gitignore

@@ -76,3 +76,5 @@ cron/lock
 /util/bldy
 util/third_party/src
 /home
+
+**/*.h.gch

+ 4 - 1
sys/src/cmd/jay/data.c

@@ -261,8 +261,11 @@ setbackimg(){
 	}
 	int fd = open(jayconfig->backgroundimgpath, OREAD);
 	if (fd > 0){
-		background = readimage(display, fd, 0);
+		background = allocimage(display, screen->r, RGB24, 1, jayconfig->backgroundColor);
+		Image *i = readimage(display, fd, 0);
+		draw(background, screen->r, i, nil, ZP);
 		close(fd);
+		freeimage(i);
 		return 1;
 	}
 	return 0;

+ 2 - 2
sys/src/cmd/jay/jay.c

@@ -195,7 +195,7 @@ threadmain(int argc, char *argv[])
 	wscreen = allocscreen(screen, background, 0);
 	if(wscreen == nil)
 		error("can't allocate screen");
-	draw(view, viewr, background, nil, ZP);
+	draw(view, viewr, background, nil, viewr.min);
 	flushimage(display, 1);
 
 	exitchan = chancreate(sizeof(int), 0);
@@ -686,7 +686,7 @@ resized(void)
 	wscreen = allocscreen(screen, background, 0);
 	if(wscreen == nil)
 		error("can't re-allocate screen");
-	draw(view, view->r, background, nil, ZP);
+	draw(view, view->r, background, nil, view->r.min);
 	redrawpanel();
 	o = subpt(viewr.max, viewr.min);
 	n = subpt(view->clipr.max, view->clipr.min);

BIN
usr/harvey/lib/background.img