From aa77c0c92ddf76fb2284d3df5a75a36bacf0a976 Mon Sep 17 00:00:00 2001 From: Vincent Bénony Date: Wed, 6 Jan 2016 08:41:45 +0100 Subject: IOS: Disable scalers --- backends/platform/ios7/ios7_common.h | 3 +++ backends/platform/ios7/ios7_osys_main.cpp | 3 +++ backends/platform/ios7/ios7_video.h | 2 ++ backends/platform/ios7/ios7_video.mm | 12 ++++++++++++ 4 files changed, 20 insertions(+) (limited to 'backends/platform') diff --git a/backends/platform/ios7/ios7_common.h b/backends/platform/ios7/ios7_common.h index b7a47eda8a..a32a59a541 100644 --- a/backends/platform/ios7/ios7_common.h +++ b/backends/platform/ios7/ios7_common.h @@ -25,6 +25,9 @@ #include "graphics/surface.h" +// #define ENABLE_IOS7_SCALERS + + enum InputEvent { kInputMouseDown, kInputMouseUp, diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp index cd62148ca9..d6b9ce3741 100644 --- a/backends/platform/ios7/ios7_osys_main.cpp +++ b/backends/platform/ios7/ios7_osys_main.cpp @@ -54,6 +54,8 @@ const OSystem::GraphicsMode OSystem_iOS7::s_supportedGraphicsModes[] = { { "none", "No filtering", kGraphicsModeNone }, { "linear", "Linear filtering", kGraphicsModeLinear }, + +#ifdef ENABLE_IOS7_SCALERS #ifdef USE_SCALERS // {"2x", "2x", GFX_DOUBLESIZE}, // {"3x", "3x", GFX_TRIPLESIZE}, @@ -68,6 +70,7 @@ const OSystem::GraphicsMode OSystem_iOS7::s_supportedGraphicsModes[] = { #endif {"tv2x", "TV2x", kGraphicsModeTV2x}, {"dotmatrix", "DotMatrix", kGraphicsModeDotMatrix}, +#endif #endif { 0, 0, 0 } }; diff --git a/backends/platform/ios7/ios7_video.h b/backends/platform/ios7/ios7_video.h index 799cd21a94..ab261a977b 100644 --- a/backends/platform/ios7/ios7_video.h +++ b/backends/platform/ios7/ios7_video.h @@ -88,12 +88,14 @@ typedef struct { UITouch *_firstTouch; UITouch *_secondTouch; +#ifdef ENABLE_IOS7_SCALERS uint8_t *_scalerMemorySrc; uint8_t *_scalerMemoryDst; size_t _scalerMemorySrcSize; size_t _scalerMemoryDstSize; int _scalerScale; ScalerProc *_scaler; +#endif } - (id)initWithFrame:(struct CGRect)frame; diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm index 78e7dc254c..2cfc3e05f7 100644 --- a/backends/platform/ios7/ios7_video.mm +++ b/backends/platform/ios7/ios7_video.mm @@ -388,12 +388,14 @@ uint getSizeNextPOT(uint size) { [self setContentScaleFactor:[[UIScreen mainScreen] scale]]; +#ifdef ENABLE_IOS7_SCALERS _scalerMemorySrc = NULL; _scalerMemoryDst = NULL; _scalerMemorySrcSize = 0; _scalerMemoryDstSize = 0; _scaler = NULL; _scalerScale = 1; +#endif _keyboardView = nil; _screenTexture = 0; @@ -424,8 +426,10 @@ uint getSizeNextPOT(uint size) { _videoContext.overlayTexture.free(); _videoContext.mouseTexture.free(); +#ifdef ENABLE_IOS7_SCALERS free(_scalerMemorySrc); free(_scalerMemoryDst); +#endif [_eventLock release]; [super dealloc]; @@ -468,6 +472,7 @@ uint getSizeNextPOT(uint size) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); printOpenGLError(); } +#ifdef ENABLE_IOS7_SCALERS - (void)setScaler { ScalerProc *scaler = NULL; int scalerScale = 1; @@ -534,12 +539,15 @@ uint getSizeNextPOT(uint size) { _scaler = scaler; _scalerScale = scalerScale; } +#endif - (void)setGraphicsMode { [self setFilterModeForTexture:_screenTexture]; [self setFilterModeForTexture:_overlayTexture]; [self setFilterModeForTexture:_mouseCursorTexture]; +#ifdef ENABLE_IOS7_SCALERS [self setScaler]; +#endif } - (void)updateSurface { @@ -633,6 +641,7 @@ uint getSizeNextPOT(uint size) { // Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases // due to the iPhone internals having to convert the whole texture back from its internal format when used. // In the future we could use several tiled textures instead. +#ifdef ENABLE_IOS7_SCALERS if (_scaler) { size_t neededSrcMemorySize = (size_t) (_videoContext.screenTexture.pitch * (_videoContext.screenTexture.h + 4)); size_t neededDstMemorySize = (size_t) (_videoContext.screenTexture.pitch * (_videoContext.screenTexture.h + 4) * _scalerScale * _scalerScale); @@ -661,8 +670,11 @@ uint getSizeNextPOT(uint size) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _videoContext.screenTexture.w * _scalerScale, _videoContext.screenTexture.h * _scalerScale, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _scalerMemoryDst); printOpenGLError(); } else { +#endif glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _videoContext.screenTexture.w, _videoContext.screenTexture.h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _videoContext.screenTexture.getPixels()); printOpenGLError(); +#ifdef ENABLE_IOS7_SCALERS } +#endif glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); printOpenGLError(); } -- cgit v1.2.3