> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 19:51:16 up 7 days, 19:51,  1 user,  load average: 0.13, 0.21, 0.18
This commit is contained in:
tracer-ics2023
2024-09-25 19:51:16 +08:00
committed by zzy
parent b9e0203de0
commit 60d5332033
5 changed files with 22 additions and 4 deletions

View File

@ -26,7 +26,7 @@ void init_proc() {
// load program here
void naive_uload(PCB *pcb, const char *filename);
naive_uload(NULL, "/bin/bmp-test");
naive_uload(NULL, "/bin/nslider");
}

View File

@ -47,7 +47,7 @@ ARCHIVE = $(WORK_DIR)/build/$(NAME)-$(ISA).a
### Add default libraries for ISA != native
ifneq ($(ISA), native)
LIBS += libc libos libndl libbmp
LIBS += libc libos libndl libbmp libminiSDL
CFLAGS += -U_FORTIFY_SOURCE # fix compile error in Newlib on ubuntu
else
WL = -Wl,
@ -166,7 +166,7 @@ $(CLEAN_ALL):
.PHONY: clean-all $(CLEAN_ALL)
### Build fsimg and ramdisk for Nanos-lite
APPS =
APPS = nslider
TESTS = dummy hello file-test timer-test event-test bmp-test
fsimg: $(addprefix apps/, $(APPS)) $(addprefix tests/, $(TESTS))

View File

@ -1,5 +1,6 @@
#!/bin/bash
# sudo vim /etc/ImageMagick-6/policy.xml
convert slides.pdf \
-sharpen "0x1.0" \
-type truecolor -resize 400x300\! slides.bmp

View File

@ -12,7 +12,7 @@
// gg - first page
// number of slides
const int N = 10;
const int N = 42;
// slides path pattern (starts from 0)
const char *path = "/share/slides/slides-%d.bmp";

View File

@ -7,12 +7,29 @@
void SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) {
assert(dst && src);
assert(dst->format->BitsPerPixel == src->format->BitsPerPixel);
SDL_Rect rect = {
.w = srcrect == NULL ? src->w : srcrect->w,
.h = srcrect == NULL ? src->h : srcrect->h,
.x = dstrect == NULL ? 0 : dstrect->x,
.y = dstrect == NULL ? 0 : dstrect->y,
};
for (int i = 0; i < rect.h; i ++) {
memcpy(dst->pixels + (rect.y + i) * dst->w + rect.x,
src->pixels + (srcrect->y + i) * src->w + srcrect->x, rect.w);
}
}
void SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, uint32_t color) {
}
void SDL_UpdateRect(SDL_Surface *s, int x, int y, int w, int h) {
assert(s->format->BitsPerPixel == 32);
if (x == 0 && y == 0 && w == 0 && h == 0) {
w = s->w;
h = s->h;
}
NDL_DrawRect((uint32_t*)s->pixels, x, y, w, h);
}
// APIs below are already implemented.