From 1978fa991012d93a3d49e2440c76d8aafbb2ae0c Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 22 Aug 2014 17:44:52 -0300 Subject: [PATCH 1/3] Cleaned up a bit of unused code. --- src/modules/graphics/opengl/Image.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/modules/graphics/opengl/Image.cpp b/src/modules/graphics/opengl/Image.cpp index 678f0b9a6..b459fb97f 100644 --- a/src/modules/graphics/opengl/Image.cpp +++ b/src/modules/graphics/opengl/Image.cpp @@ -55,7 +55,6 @@ Image::Image(love::image::ImageData *data, Format format) height = data->getHeight(); preload(); - textureMemorySize = data->getSize(); ++imageCount; } @@ -76,7 +75,6 @@ Image::Image(love::image::CompressedData *cdata, Format format) height = cdata->getHeight(0); preload(); - textureMemorySize = cdata->getSize(0); ++imageCount; } From 234ee0fea6d48d142d5ee7737aa295ad71c0ddac Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 22 Aug 2014 17:58:07 -0300 Subject: [PATCH 2/3] Fixed the default error handler's background color when sRGB is enabled for the screen. --- src/scripts/boot.lua | 8 +++++++- src/scripts/boot.lua.h | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index 3c27c3243..da4928f41 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -1562,9 +1562,15 @@ function love.errhand(msg) end if love.audio then love.audio.stop() end love.graphics.reset() - love.graphics.setBackgroundColor(89, 157, 220) local font = love.graphics.setNewFont(math.floor(14 * love.window.getPixelScale())) + local sRGB = select(3, love.window.getMode()).srgb + if sRGB then + love.graphics.setBackgroundColor(love.math.gammaToLinear(89, 157, 220)) + else + love.graphics.setBackgroundColor(89, 157, 220) + end + love.graphics.setColor(255, 255, 255, 255) local trace = debug.traceback() diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index c3e9b5622..29880a85e 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -5281,14 +5281,25 @@ const unsigned char boot_lua[] = 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x65, 0x74, 0x28, 0x29, 0x0a, - 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, - 0x42, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x38, 0x39, - 0x2c, 0x20, 0x31, 0x35, 0x37, 0x2c, 0x20, 0x32, 0x32, 0x30, 0x29, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x4e, 0x65, 0x77, 0x46, 0x6f, 0x6e, 0x74, 0x28, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x28, 0x31, 0x34, 0x20, 0x2a, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x28, 0x29, 0x29, 0x29, 0x0a, + 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x52, 0x47, 0x42, 0x20, 0x3d, 0x20, 0x73, 0x65, 0x6c, 0x65, + 0x63, 0x74, 0x28, 0x33, 0x2c, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, + 0x67, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x28, 0x29, 0x29, 0x2e, 0x73, 0x72, 0x67, 0x62, 0x0a, + 0x09, 0x69, 0x66, 0x20, 0x73, 0x52, 0x47, 0x42, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, + 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, + 0x74, 0x42, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x6c, + 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x67, 0x61, 0x6d, 0x6d, 0x61, 0x54, 0x6f, 0x4c, 0x69, + 0x6e, 0x65, 0x61, 0x72, 0x28, 0x38, 0x39, 0x2c, 0x20, 0x31, 0x35, 0x37, 0x2c, 0x20, 0x32, 0x32, 0x30, 0x29, + 0x29, 0x0a, + 0x09, 0x65, 0x6c, 0x73, 0x65, 0x0a, + 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, + 0x74, 0x42, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x38, + 0x39, 0x2c, 0x20, 0x31, 0x35, 0x37, 0x2c, 0x20, 0x32, 0x32, 0x30, 0x29, 0x0a, + 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x32, 0x35, 0x35, 0x2c, 0x20, 0x32, 0x35, 0x35, 0x2c, 0x20, 0x32, 0x35, 0x35, 0x2c, 0x20, 0x32, 0x35, 0x35, 0x29, 0x0a, From d5e5f38e2f83c7fd4e104cfd5098574d5072990e Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 25 Aug 2014 03:46:11 -0300 Subject: [PATCH 3/3] Fixed Source:tell crashing if the Source is static. --- src/modules/audio/openal/Source.cpp | 5 ++++- src/modules/audio/openal/Source.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/audio/openal/Source.cpp b/src/modules/audio/openal/Source.cpp index a60907a79..20d2daf09 100644 --- a/src/modules/audio/openal/Source.cpp +++ b/src/modules/audio/openal/Source.cpp @@ -62,6 +62,7 @@ Source::Source(Pool *pool, love::sound::SoundData *soundData) , cone() , offsetSamples(0) , offsetSeconds(0) + , sampleRate(soundData->getSampleRate()) , channels(soundData->getChannels()) , decoder(nullptr) , toLoop(0) @@ -94,6 +95,7 @@ Source::Source(Pool *pool, love::sound::Decoder *decoder) , cone() , offsetSamples(0) , offsetSeconds(0) + , sampleRate(decoder->getSampleRate()) , channels(decoder->getChannels()) , decoder(decoder) , toLoop(0) @@ -125,6 +127,7 @@ Source::Source(const Source &s) , cone(s.cone) , offsetSamples(0) , offsetSeconds(0) + , sampleRate(s.sampleRate) , channels(s.channels) , decoder(nullptr) , toLoop(0) @@ -383,7 +386,7 @@ float Source::tellAtomic(void *unit) const default: { alGetSourcef(source, AL_SAMPLE_OFFSET, &offset); - offset /= decoder->getSampleRate(); + offset /= sampleRate; if (type == TYPE_STREAM) offset += offsetSeconds; } break; diff --git a/src/modules/audio/openal/Source.h b/src/modules/audio/openal/Source.h index a8985aa30..6c923e3e3 100644 --- a/src/modules/audio/openal/Source.h +++ b/src/modules/audio/openal/Source.h @@ -180,6 +180,7 @@ private: float offsetSamples; float offsetSeconds; + int sampleRate; int channels; Object::StrongRef decoder;