From 7bb948a00ec1ee1c6f7cfc2b410cc0faf6770eb5 Mon Sep 17 00:00:00 2001 From: Rahul Singhal Date: Wed, 20 Jun 2012 16:22:34 +0530 Subject: [PATCH] ViewportTransform: Change order of texture coordinates Change order of texture coordinates returned by transformRectangleToTextureCoordinates() to be consistent with the rest of the code. Before: {x1, x2, y1, y2} Now: {x1, y1, x2, y2} --- .../src/GraphicSystems/GLESGraphicSystem.cpp | 6 +- .../src/GraphicSystems/GLXGraphicSystem.cpp | 6 +- .../src/Transformation/ViewportTransform.cpp | 4 +- .../Graphic/tests/ViewportTransformTest.cpp | 114 ++++++++++----------- 4 files changed, 65 insertions(+), 65 deletions(-) diff --git a/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp index 94d044e..00bd2a4 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp @@ -316,10 +316,10 @@ void GLESGraphicsystem::renderSurface(Surface* surface) uniforms.width = targetSurfaceDestination.width / m_displayWidth; uniforms.height = targetSurfaceDestination.height / m_displayHeight; uniforms.opacity = (surface)->getOpacity() * m_currentLayer->getOpacity(); - uniforms.texRange[0] = (textureCoordinates[1]-textureCoordinates[0]); - uniforms.texRange[1] = (textureCoordinates[3]-textureCoordinates[2]); + uniforms.texRange[0] = (textureCoordinates[2]-textureCoordinates[0]); + uniforms.texRange[1] = (textureCoordinates[3]-textureCoordinates[1]); uniforms.texOffset[0] = textureCoordinates[0]; - uniforms.texOffset[1] = textureCoordinates[2]; + uniforms.texOffset[1] = textureCoordinates[1]; uniforms.texUnit = 0; uniforms.matrix = &layerMatrix.f[0]; diff --git a/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLXGraphicSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLXGraphicSystem.cpp index ea1d8c6..73ab5ee 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLXGraphicSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLXGraphicSystem.cpp @@ -356,15 +356,15 @@ void GLXGraphicsystem::renderSurface(Surface* currentSurface) glVertex2d((float)targetSurfaceDestination.x/m_windowWidth*2-1, 1-(float)(targetSurfaceDestination.y+targetSurfaceDestination.height)/m_windowHeight*2); // bottom right - glTexCoord2f(textureCoordinates[1],textureCoordinates[3]); + glTexCoord2f(textureCoordinates[2],textureCoordinates[3]); glVertex2d( (float)(targetSurfaceDestination.x+targetSurfaceDestination.width)/m_windowWidth*2-1, 1-(float)(targetSurfaceDestination.y+targetSurfaceDestination.height)/m_windowHeight*2); // top right - glTexCoord2f(textureCoordinates[1], textureCoordinates[2]); + glTexCoord2f(textureCoordinates[2], textureCoordinates[1]); glVertex2d((float)(targetSurfaceDestination.x+targetSurfaceDestination.width)/m_windowWidth*2-1, 1-(float)targetSurfaceDestination.y/m_windowHeight*2); // top left - glTexCoord2f(textureCoordinates[0], textureCoordinates[2]); + glTexCoord2f(textureCoordinates[0], textureCoordinates[1]); glVertex2d((float)targetSurfaceDestination.x/m_windowWidth*2-1 , 1-(float)targetSurfaceDestination.y/m_windowHeight*2); glEnd(); diff --git a/LayerManagerPlugins/Renderers/Graphic/src/Transformation/ViewportTransform.cpp b/LayerManagerPlugins/Renderers/Graphic/src/Transformation/ViewportTransform.cpp index bee67bd..414a3c2 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/Transformation/ViewportTransform.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/Transformation/ViewportTransform.cpp @@ -128,12 +128,12 @@ void ViewportTransform::transformRectangleToTextureCoordinates(const FloatRectan // move texture coordinate proportional to the cropped pixels uint newRightSide = rectangle.x + rectangle.width; float percentageCroppedFromRightSide = (originalWidth - newRightSide) / originalWidth; - textureCoordinates[1] = 1.0f - percentageCroppedFromRightSide; + textureCoordinates[2] = 1.0f - percentageCroppedFromRightSide; // the same for Y // move texture coordinate proportional to the cropped pixels float percentageCroppedFromTopSide = rectangle.y / originalHeight; - textureCoordinates[2] = percentageCroppedFromTopSide; + textureCoordinates[1] = percentageCroppedFromTopSide; // move texture coordinate proportional to the cropped pixels int newBottomSide = rectangle.y + rectangle.height; diff --git a/LayerManagerPlugins/Renderers/Graphic/tests/ViewportTransformTest.cpp b/LayerManagerPlugins/Renderers/Graphic/tests/ViewportTransformTest.cpp index 29fcc09..d115fdc 100644 --- a/LayerManagerPlugins/Renderers/Graphic/tests/ViewportTransformTest.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/tests/ViewportTransformTest.cpp @@ -73,8 +73,8 @@ TEST_F(ViewportTransformTest, doLayerSRCSurfaceCroppedFromLeft){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_EQ(0.5,textureCoordinates[0]); - ASSERT_EQ(1.0,textureCoordinates[1]); - ASSERT_EQ(0.5,textureCoordinates[2]); + ASSERT_EQ(1.0,textureCoordinates[2]); + ASSERT_EQ(0.5,textureCoordinates[1]); ASSERT_EQ(1.0,textureCoordinates[3]); ASSERT_EQ(0.0, targetSurfaceDest.x); ASSERT_EQ(10.0, targetSurfaceDest.width); @@ -93,8 +93,8 @@ TEST_F(ViewportTransformTest, doLayerSRCSurfaceCroppedFromRight){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_EQ(0,textureCoordinates[0]); - ASSERT_EQ(0.75,textureCoordinates[1]); - ASSERT_EQ(0,textureCoordinates[2]); + ASSERT_EQ(0.75,textureCoordinates[2]); + ASSERT_EQ(0,textureCoordinates[1]); ASSERT_EQ(0.75,textureCoordinates[3]); ASSERT_EQ(20.0, targetSurfaceDest.x); ASSERT_EQ(15.0, targetSurfaceDest.width); @@ -113,8 +113,8 @@ TEST_F(ViewportTransformTest, doLayerSRCSurfaceCroppedFromBothSides){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_EQ(0.25,textureCoordinates[0]); - ASSERT_EQ(0.75,textureCoordinates[1]); - ASSERT_EQ(0.25,textureCoordinates[2]); + ASSERT_EQ(0.75,textureCoordinates[2]); + ASSERT_EQ(0.25,textureCoordinates[1]); ASSERT_EQ(0.75,textureCoordinates[3]); ASSERT_EQ(0.0, targetSurfaceDest.x); ASSERT_EQ(10.0, targetSurfaceDest.width); @@ -136,8 +136,8 @@ TEST_F(ViewportTransformTest, doLayerDESTScaleUp){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_EQ(0.0,textureCoordinates[0]); - ASSERT_EQ(1.0,textureCoordinates[1]); - ASSERT_EQ(0.0,textureCoordinates[2]); + ASSERT_EQ(1.0,textureCoordinates[2]); + ASSERT_EQ(0.0,textureCoordinates[1]); ASSERT_EQ(1.0,textureCoordinates[3]); ASSERT_EQ(80.0, targetSurfaceDest.x); ASSERT_EQ(300.0, targetSurfaceDest.width); @@ -157,8 +157,8 @@ TEST_F(ViewportTransformTest, doLayerDESTScaleDown){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_EQ(0.0,textureCoordinates[0]); - ASSERT_EQ(1.0,textureCoordinates[1]); - ASSERT_EQ(0.0,textureCoordinates[2]); + ASSERT_EQ(1.0,textureCoordinates[2]); + ASSERT_EQ(0.0,textureCoordinates[1]); ASSERT_EQ(1.0,textureCoordinates[3]); ASSERT_EQ(51.0, targetSurfaceDest.x); ASSERT_EQ(10.0, targetSurfaceDest.width); @@ -178,8 +178,8 @@ TEST_F(ViewportTransformTest, doLayerSRCTransformationTest1){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.5,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); - ASSERT_NEAR(0.5,textureCoordinates[2],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.5,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); ASSERT_EQ(0.0, targetSurfaceDest.x); ASSERT_EQ(5.0, targetSurfaceDest.width); @@ -198,8 +198,8 @@ TEST_F(ViewportTransformTest, doLayerSRCTransformationTest2){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.0,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); ASSERT_EQ(5.0, targetSurfaceDest.x); ASSERT_EQ(30.0, targetSurfaceDest.width); @@ -218,8 +218,8 @@ TEST_F(ViewportTransformTest, doLayerSRCTransformationTest3){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.0,textureCoordinates[0],0.01); - ASSERT_NEAR(0.5,textureCoordinates[1],0.01); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.5,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); ASSERT_NEAR(0.5,textureCoordinates[3],0.01); ASSERT_EQ(45.0, targetSurfaceDest.x); ASSERT_EQ(5.0, targetSurfaceDest.width); @@ -238,8 +238,8 @@ TEST_F(ViewportTransformTest, doLayerSRCTransformationTest4){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.25,textureCoordinates[0],0.01); - ASSERT_NEAR(0.75,textureCoordinates[1],0.01); - ASSERT_NEAR(0.25,textureCoordinates[2],0.01); + ASSERT_NEAR(0.75,textureCoordinates[2],0.01); + ASSERT_NEAR(0.25,textureCoordinates[1],0.01); ASSERT_NEAR(0.75,textureCoordinates[3],0.01); ASSERT_EQ(0.0, targetSurfaceDest.x); ASSERT_EQ(50.0, targetSurfaceDest.width); @@ -260,8 +260,8 @@ TEST_F(ViewportTransformTest, doLayerSRCTransformationTest5){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.0,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); ASSERT_EQ(20.0, targetSurfaceDest.x); ASSERT_EQ(20.0, targetSurfaceDest.width); @@ -281,8 +281,8 @@ TEST_F(ViewportTransformTest, doLayerDESTTransformationTest1){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.0,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); ASSERT_EQ(0.0, targetSurfaceDest.x); ASSERT_EQ(100.0, targetSurfaceDest.width); @@ -302,8 +302,8 @@ TEST_F(ViewportTransformTest, doLayerDESTTransformationTest2){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.0,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); ASSERT_EQ(0.0, targetSurfaceDest.x); ASSERT_EQ(200.0, targetSurfaceDest.width); @@ -323,11 +323,11 @@ TEST_F(ViewportTransformTest, doLayerDESTTransformationTest3){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.0,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); + ASSERT_NEAR(1.0,textureCoordinates[3],0.01); ASSERT_EQ(50.0, targetSurfaceDest.x); ASSERT_EQ(200.0, targetSurfaceDest.width); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); - ASSERT_NEAR(1.0,textureCoordinates[3],0.01); ASSERT_EQ(50.0, targetSurfaceDest.y); ASSERT_EQ(200.0, targetSurfaceDest.height); } @@ -344,11 +344,11 @@ TEST_F(ViewportTransformTest, doLayerDESTTransformationTest4){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.0,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); + ASSERT_NEAR(1.0,textureCoordinates[3],0.01); ASSERT_EQ(150.0, targetSurfaceDest.x); ASSERT_EQ(100.0, targetSurfaceDest.width); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); - ASSERT_NEAR(1.0,textureCoordinates[3],0.01); ASSERT_EQ(150.0, targetSurfaceDest.y); ASSERT_EQ(100.0, targetSurfaceDest.height); } @@ -371,8 +371,8 @@ TEST_F(ViewportTransformTest, completeExample1){ ASSERT_EQ(30.0,targetSurfaceSrc.y); ASSERT_EQ(10.0,targetSurfaceSrc.height); ASSERT_NEAR(0.5,textureCoordinates[0],0.01); - ASSERT_NEAR(0.66,textureCoordinates[1],0.01); - ASSERT_NEAR(0.5,textureCoordinates[2],0.01); + ASSERT_NEAR(0.66,textureCoordinates[2],0.01); + ASSERT_NEAR(0.5,textureCoordinates[1],0.01); ASSERT_NEAR(0.66,textureCoordinates[3],0.01); ASSERT_EQ(0.0,targetSurfaceDest.x); @@ -384,11 +384,11 @@ TEST_F(ViewportTransformTest, completeExample1){ ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_EQ(120.0,targetSurfaceDest.width); ASSERT_EQ(0.0,targetSurfaceDest.x); - ASSERT_NEAR(0.5,textureCoordinates[0],0.01); - ASSERT_NEAR(0.66,textureCoordinates[1],0.01); ASSERT_EQ(120.0,targetSurfaceDest.height); ASSERT_EQ(0.0,targetSurfaceDest.y); - ASSERT_NEAR(0.5,textureCoordinates[2],0.01); + ASSERT_NEAR(0.5,textureCoordinates[0],0.01); + ASSERT_NEAR(0.66,textureCoordinates[2],0.01); + ASSERT_NEAR(0.5,textureCoordinates[1],0.01); ASSERT_NEAR(0.66,textureCoordinates[3],0.01); } @@ -409,11 +409,11 @@ TEST_F(ViewportTransformTest, completeExample2){ ASSERT_EQ(200.0,targetSurfaceDest.width); ASSERT_EQ(0.0,targetSurfaceDest.x); - ASSERT_NEAR(0.0,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); ASSERT_EQ(200.0,targetSurfaceDest.height); ASSERT_EQ(0.0,targetSurfaceDest.y); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[0],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); } @@ -433,11 +433,11 @@ TEST_F(ViewportTransformTest, completeExample3){ ASSERT_EQ(200.0,targetSurfaceDest.width); ASSERT_EQ(0.0,targetSurfaceDest.x); - ASSERT_NEAR(0.5,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); ASSERT_EQ(200.0,targetSurfaceDest.height); ASSERT_EQ(0.0,targetSurfaceDest.y); - ASSERT_NEAR(0.5,textureCoordinates[2],0.01); + ASSERT_NEAR(0.5,textureCoordinates[0],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.5,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); } @@ -457,11 +457,11 @@ TEST_F(ViewportTransformTest, completeExample4){ ASSERT_EQ(200.0,targetSurfaceDest.width); ASSERT_EQ(50.0,targetSurfaceDest.x); - ASSERT_NEAR(0.5,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); ASSERT_EQ(200.0,targetSurfaceDest.height); ASSERT_EQ(50.0,targetSurfaceDest.y); - ASSERT_NEAR(0.5,textureCoordinates[2],0.01); + ASSERT_NEAR(0.5,textureCoordinates[0],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.5,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); } @@ -482,11 +482,11 @@ TEST_F(ViewportTransformTest, completeExample5){ ASSERT_EQ(0.0,targetSurfaceDest.x); ASSERT_EQ(220.0,targetSurfaceDest.width); - ASSERT_NEAR(0.3125,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); ASSERT_EQ(0.0,targetSurfaceDest.y); ASSERT_EQ(220.0,targetSurfaceDest.height); - ASSERT_NEAR(0.3125,textureCoordinates[2],0.01); + ASSERT_NEAR(0.3125,textureCoordinates[0],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.3125,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); } @@ -515,8 +515,8 @@ TEST_F(ViewportTransformTest, completeExample6){ ASSERT_EQ(320.0,targetSurfaceSrc.height); ASSERT_NEAR(0.0,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); } @@ -546,8 +546,8 @@ TEST_F(ViewportTransformTest, completeExample7){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.3125,textureCoordinates[0],0.01); - ASSERT_NEAR(0.5625,textureCoordinates[1],0.01); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.5625,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); } @@ -576,8 +576,8 @@ TEST_F(ViewportTransformTest, completeExample8){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSrc, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.003125,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); } @@ -602,8 +602,8 @@ TEST_F(ViewportTransformTest, layersourceZoomOnTwoSurfaces){ float* textureCoordinates = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurface1Src, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates); ASSERT_NEAR(0.25,textureCoordinates[0],0.01); - ASSERT_NEAR(1.0,textureCoordinates[1],0.01); - ASSERT_NEAR(0.0,textureCoordinates[2],0.01); + ASSERT_NEAR(1.0,textureCoordinates[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates[1],0.01); ASSERT_NEAR(1.0,textureCoordinates[3],0.01); FloatRectangle targetSurface2Src = FloatRectangle(0, 0, 800, 480); @@ -621,8 +621,8 @@ TEST_F(ViewportTransformTest, layersourceZoomOnTwoSurfaces){ float* textureCoordinates2 = new float[4]; ViewportTransform::transformRectangleToTextureCoordinates(targetSurface2Src, surfaceOriginalWidth, surfaceOriginalHeight, textureCoordinates2); ASSERT_NEAR(0,textureCoordinates2[0],0.01); - ASSERT_NEAR(0.75,textureCoordinates2[1],0.01); - ASSERT_NEAR(0.0,textureCoordinates2[2],0.01); + ASSERT_NEAR(0.75,textureCoordinates2[2],0.01); + ASSERT_NEAR(0.0,textureCoordinates2[1],0.01); ASSERT_NEAR(1.0,textureCoordinates2[3],0.01); } -- 2.7.4