reducing size of gfx state, cleanup
[drnoksnes] / platform / sdlv.cpp
index afe0187..fe5cfb7 100644 (file)
@@ -144,18 +144,19 @@ static void setupVideoSurface()
        scaler = sFactory->instantiate(screen, gameWidth, gameHeight);
 
        // Each scaler may have its own pitch
-       GFX.RealPitch = GFX.Pitch = scaler->getDrawBufferPitch();
-       GFX.ZPitch = GFX.Pitch / 2; // gfx & tile.cpp depend on this, unfortunately.
-       GFX.PixSize = screen->format->BitsPerPixel / 8;
-       
+       GFX.Pitch = scaler->getDrawBufferPitch();
+       GFX.ZPitch = GFX.Pitch / 2;
+       // gfx & tile.cpp depend on the zbuffer pitch being always half of the color buffer pitch.
+       // Which is a pity, since the color buffer might be much larger.
+
        GFX.Screen = scaler->getDrawBuffer();
        GFX.SubScreen = (uint8 *) malloc(GFX.Pitch * IMAGE_HEIGHT);
        GFX.ZBuffer =  (uint8 *) malloc(GFX.ZPitch * IMAGE_HEIGHT);
        GFX.SubZBuffer = (uint8 *) malloc(GFX.ZPitch * IMAGE_HEIGHT);
 
        GFX.Delta = (GFX.SubScreen - GFX.Screen) >> 1;
-       GFX.PPL = GFX.Pitch >> 1;
-       GFX.PPLx2 = GFX.Pitch;
+       GFX.DepthDelta = GFX.SubZBuffer - GFX.ZBuffer;
+       GFX.PPL = GFX.Pitch / (screen->format->BitsPerPixel / 8);
 
        scaler->getRenderedGUIArea(GUI.RenderX, GUI.RenderY, GUI.RenderW, GUI.RenderH);
        scaler->getRatio(GUI.ScaleX, GUI.ScaleY);