Skip to content

Commit 9780447

Browse files
committed
It turns out that mipmap is slow af
It turns out that Android JIT is slow File selection only for desktop devices - For unknown reason, `os.execute("which")` returns 0 which causes misdetection Yohane simple optimization
1 parent 22d87ce commit 9780447

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

AquaShine.lua

+4-12
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ end
237237
--! @brief Disable screen sleep
238238
--! @note Should be called only in Start function
239239
function AquaShine.DisableSleep()
240-
love.window.setDisplaySleepEnabled(false)
240+
-- tail call
241+
return love.window.setDisplaySleepEnabled(false)
241242
end
242243

243244
--! @brief Gets cached data from cache table, or execute function to load and store in cache
@@ -294,27 +295,18 @@ end
294295
--------------------------------------
295296
local LoadedShelshaObject = {}
296297
local LoadedImage = {}
297-
local ConstImageFlags
298298

299299
--! @brief Load image without caching
300300
--! @param path The image path
301301
--! @param pngonly Do not load .png.imag file even if one exist
302302
--! @returns Drawable object
303303
--! @note The ShelshaObject texture bank will ALWAYS BE CACHED!.
304304
function AquaShine.LoadImageNoCache(path, pngonly)
305-
if not(ConstImageFlags) then
306-
ConstImageFlags = {}
307-
ConstImageFlags.mipmaps = AquaShine.IsDesktopSystem()
308-
end
309-
310305
assert(path:sub(-4) == ".png", "Only PNG image is supported")
311306
local _, img = pcall(love.graphics.newImage, path, ConstImageFlags)
312307

313308
if _ then
314309
-- .png image loaded
315-
img:setFilter("linear", "linear", 16)
316-
img:setMipmapFilter("linear", 16)
317-
318310
return img
319311
elseif not(pngonly) then
320312
-- Try .png.imag
@@ -652,9 +644,9 @@ function love.load(arg)
652644
assert(love.filesystem.load("AquaShineFileDialog.lua"))(AquaShine)
653645
love.resize(wx, wy)
654646

655-
-- JIT is disabled in Android. Enable it
647+
-- JIT is disabled in Android for performance reasons.
656648
if AquaShine.OperatingSystem == "Android" then
657-
jit.on()
649+
jit.off()
658650
end
659651

660652
if jit and AquaShine.GetCommandLineConfig("interpreter") then

AquaShineFileDialog.lua

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
local AquaShine = ...
55

6+
if not(AquaShine.IsDesktopSystem()) then return end
7+
68
--! @fn AquaShine.FileSelection(title, directory, filter, multiple)
79
--! @brief Shows file selection dialog
810
--! @param title The dialog window title (string, or nil)

YohaneMovie.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function YohaneMovie.newMovie(moviedata, parentflash)
108108
__index = YohaneMovie._internal._mt
109109
}
110110

111-
return setmetatable({}, mvdata)
111+
return (setmetatable({}, mvdata))
112112
end
113113

114114
-- Get next instruction

0 commit comments

Comments
 (0)