diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 3e99dc4ac4..94e86571b9 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -827,6 +827,7 @@ RageSurface* RageDisplay_OGL::CreateScreenshot() glReadPixels(0, 0, wind->GetVideoModeParams().width, wind->GetVideoModeParams().height, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels); + AssertNoGLError(); // flip vertically int pitch = image->pitch; diff --git a/stepmania/src/SDL_rotozoom.cpp b/stepmania/src/SDL_rotozoom.cpp index e2bf2469bf..58ad0350c8 100644 --- a/stepmania/src/SDL_rotozoom.cpp +++ b/stepmania/src/SDL_rotozoom.cpp @@ -1,6 +1,7 @@ #include "global.h" #include "SDL_rotozoom.h" #include "RageSurface.h" +#include "RageUtil.h" #include using namespace std; @@ -15,6 +16,11 @@ using namespace std; static void ZoomSurface( RageSurface * src, RageSurface * dst ) { + // The original code here didn't handle the magnification case correctly. + // the sample centers sax and say aren't being calculated correctly. + // The coordinate system here is a bit confusing. This might be + // easier to follow if the + /* Ratio from source to dest. */ const float sx = float(src->w) / dst->w; const float sy = float(src->h) / dst->h; @@ -33,7 +39,12 @@ static void ZoomSurface( RageSurface * src, RageSurface * dst ) * distance from the start of the sample to its center. */ for( x = 0; x < dst->w; x++ ) { - const float sax = sx*x + sx/2; + float sax = sx*x + sx/2;//SCALE(sx,2.f,0.5f,2.f,1.f); + + // Pixel alignment is off in the magnify case. + // This is an ugly hack to correct for it. + if( sx < 1 ) // magnifying + sax += SCALE(sx,0.5f,1.f,sx/2.f,0.f); /* sx/2 is the distance from the start of the sample to the center; * sx/4 is the distance from the center of the sample to the center of @@ -66,6 +77,11 @@ static void ZoomSurface( RageSurface * src, RageSurface * dst ) { float say = sy*y + sy/2; + // Pixel alignment is off in the magnify case. + // This is an ugly hack to correct for it. + if( sy < 1 ) // magnifying + say += SCALE(sy,0.5f,1.f,sy/2.f,0.f); + float ystep = sy/4; esy0.push_back( int(say-ystep) );