diff --git a/lib/SDL b/lib/SDL index 983bbf9e..b424665e 160000 --- a/lib/SDL +++ b/lib/SDL @@ -1 +1 @@ -Subproject commit 983bbf9ef3e572a073a6f5877faf1c0b4803527c +Subproject commit b424665e0899769b200231ba943353a5fee1b6b6 diff --git a/src/modules/graphics.c b/src/modules/graphics.c index 81eca42b..2a599b6f 100644 --- a/src/modules/graphics.c +++ b/src/modules/graphics.c @@ -289,9 +289,12 @@ CANVAS_clip(WrenVM* vm) { int64_t y = round(wrenGetSlotDouble(vm, 2)); int64_t w = round(wrenGetSlotDouble(vm, 3)); int64_t h = round(wrenGetSlotDouble(vm, 4)); + + // We store the clip that the user requested, but we modify it + // so that it fits on screen DOME_RECT rect = { - .x = x, - .y = y, + .x = max(0, x), + .y = max(0, y), .w = min(width - x, w), .h = min(height - y, h) }; diff --git a/src/vm.c b/src/vm.c index 87a51857..7771b7c6 100644 --- a/src/vm.c +++ b/src/vm.c @@ -138,12 +138,21 @@ internal void VM_error(WrenVM* vm, WrenErrorType type, const char* module, internal const char* VM_resolve_module_name(WrenVM* vm, const char* importer, const char* name) { const char* localName = name; + bool matchesInternal = false; + if (strlen(name) > 1) { while (localName[0] == '.' && localName[1] == '/') { localName = localName + 2; } } - return path_normalize(localName); + const char* normalized = path_normalize(localName); + ENGINE* engine = wrenGetUserData(vm); + matchesInternal = strcmp(name, localName) != 0 && MAP_getModule(&(engine->moduleMap), normalized) != NULL; + + if (matchesInternal) { + ENGINE_printLog(engine, "WARNING: Module import path \"%s\" resolves to internal module \"%s\"\n", name, localName); + } + return normalized; } internal WrenVM* VM_create(ENGINE* engine) {