From fd4c8b80ddda452a88dfdf70dcd952ff5280c14d Mon Sep 17 00:00:00 2001 From: James Coon Date: Sun, 26 Apr 2015 00:45:25 -0600 Subject: [PATCH] Fix (cec) screen.setResolution --- src/component/screen_sdl2.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/component/screen_sdl2.lua b/src/component/screen_sdl2.lua index 1df9c0c..f1c7dd7 100644 --- a/src/component/screen_sdl2.lua +++ b/src/component/screen_sdl2.lua @@ -265,7 +265,9 @@ function cec.getResolution() -- Get the current screen resolution. end function cec.setResolution(newwidth, newheight) -- Set the screen resolution. Returns true if the resolution changed. cprint("(cec) screen.setResolution", newwidth, newheight) + local oldwidth, oldheight = width, height width, height = math.min(newwidth, maxwidth), math.min(newheight, maxheight) + return oldwidth ~= width or oldheight ~= height end function cec.maxResolution() -- Get the maximum screen resolution. cprint("(cec) screen.maxResolution") @@ -342,7 +344,6 @@ function cec.copy(x1, y1, w, h, tx, ty) -- Copies a portion of the screen from t screen.bgp[y][x] = copy.bgp[y-y1-ty][x-x1-tx] end end - SDL.updateTexture(texture, ffi.C.NULL, pixels, (width*8) * ffi.sizeof("uint32_t")) SDL.setRenderTarget(renderer, copytexture); SDL.renderCopy(renderer, texture, ffi.C.NULL, ffi.C.NULL) SDL.renderCopy(renderer, texture, ffi.new("SDL_Rect",{x=(x1-1)*8,y=(y1-1)*16,w=w*8,h=h*16}), ffi.new("SDL_Rect",{x=(x1+tx-1)*8,y=(y1+ty-1)*16,w=w*8,h=h*16}))