> 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:
@ -26,7 +26,7 @@ void init_proc() {
|
|||||||
|
|
||||||
// load program here
|
// load program here
|
||||||
void naive_uload(PCB *pcb, const char *filename);
|
void naive_uload(PCB *pcb, const char *filename);
|
||||||
naive_uload(NULL, "/bin/bmp-test");
|
naive_uload(NULL, "/bin/nslider");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ ARCHIVE = $(WORK_DIR)/build/$(NAME)-$(ISA).a
|
|||||||
|
|
||||||
### Add default libraries for ISA != native
|
### Add default libraries for ISA != native
|
||||||
ifneq ($(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
|
CFLAGS += -U_FORTIFY_SOURCE # fix compile error in Newlib on ubuntu
|
||||||
else
|
else
|
||||||
WL = -Wl,
|
WL = -Wl,
|
||||||
@ -166,7 +166,7 @@ $(CLEAN_ALL):
|
|||||||
.PHONY: clean-all $(CLEAN_ALL)
|
.PHONY: clean-all $(CLEAN_ALL)
|
||||||
|
|
||||||
### Build fsimg and ramdisk for Nanos-lite
|
### Build fsimg and ramdisk for Nanos-lite
|
||||||
APPS =
|
APPS = nslider
|
||||||
TESTS = dummy hello file-test timer-test event-test bmp-test
|
TESTS = dummy hello file-test timer-test event-test bmp-test
|
||||||
|
|
||||||
fsimg: $(addprefix apps/, $(APPS)) $(addprefix tests/, $(TESTS))
|
fsimg: $(addprefix apps/, $(APPS)) $(addprefix tests/, $(TESTS))
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# sudo vim /etc/ImageMagick-6/policy.xml
|
||||||
convert slides.pdf \
|
convert slides.pdf \
|
||||||
-sharpen "0x1.0" \
|
-sharpen "0x1.0" \
|
||||||
-type truecolor -resize 400x300\! slides.bmp
|
-type truecolor -resize 400x300\! slides.bmp
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// gg - first page
|
// gg - first page
|
||||||
|
|
||||||
// number of slides
|
// number of slides
|
||||||
const int N = 10;
|
const int N = 42;
|
||||||
// slides path pattern (starts from 0)
|
// slides path pattern (starts from 0)
|
||||||
const char *path = "/share/slides/slides-%d.bmp";
|
const char *path = "/share/slides/slides-%d.bmp";
|
||||||
|
|
||||||
|
@ -7,12 +7,29 @@
|
|||||||
void SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) {
|
void SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) {
|
||||||
assert(dst && src);
|
assert(dst && src);
|
||||||
assert(dst->format->BitsPerPixel == src->format->BitsPerPixel);
|
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_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, uint32_t color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_UpdateRect(SDL_Surface *s, int x, int y, int w, int h) {
|
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.
|
// APIs below are already implemented.
|
||||||
|
Reference in New Issue
Block a user