IOS: Disable scalers

This commit is contained in:
Vincent Bénony 2016-01-06 08:41:45 +01:00
parent a522c82f85
commit aa77c0c92d
4 changed files with 20 additions and 0 deletions

View File

@ -25,6 +25,9 @@
#include "graphics/surface.h"
// #define ENABLE_IOS7_SCALERS
enum InputEvent {
kInputMouseDown,
kInputMouseUp,

View File

@ -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 }
};

View File

@ -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;

View File

@ -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();
}