Replace more getSize() with getOriginalSize() calls in tests.

Textures involved had all power of two sizes anyway, so no real difference in this case, just a bit cleaner.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6326 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-03-30 21:52:26 +00:00
parent 3aac180dc7
commit 3dc5f8fd9f
3 changed files with 21 additions and 23 deletions

View File

@ -27,12 +27,12 @@ static bool doTestWith(E_DRIVER_TYPE driverType,
cube->setMaterialTexture(0, driver->getTexture("../media/wall.bmp"));
cube->setMaterialFlag(video::EMF_LIGHTING, false);
ITexture * Texture = device->getVideoDriver()->getTexture("../media/portal2.bmp");
ITexture * texture = device->getVideoDriver()->getTexture("../media/portal2.bmp");
device->getVideoDriver()->makeColorKeyTexture(Texture,
device->getVideoDriver()->makeColorKeyTexture(texture,
position2d<s32>(64,64),
zeroTexels);
device->getVideoDriver()->makeColorKeyTexture(Texture,
device->getVideoDriver()->makeColorKeyTexture(texture,
position2d<s32>(64,64),
zeroTexels);
(void)smgr->addCameraSceneNode();
@ -40,9 +40,9 @@ static bool doTestWith(E_DRIVER_TYPE driverType,
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140));
smgr->drawAll();
driver->draw2DImage(Texture,
driver->draw2DImage(texture,
position2di(40, 40),
rect<s32>(0, 0, Texture->getSize().Width, Texture->getSize().Height),
recti(texture->getOriginalSize()),
0,
SColor(255,255,255,255),
true);

View File

@ -45,14 +45,13 @@ static bool testWith2DImage(video::E_DRIVER_TYPE driverType)
//draw the image :
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor (255, 200, 200, 200));
driver->draw2DImage (image,
core::rect < s32 >
(64 - image->getSize ().Width / 2,
64 - image->getSize ().Height / 2,
64 + image->getSize ().Width / 2,
64 + image->getSize ().Height / 2),
core::rect < s32 > (0, 0, image->getSize ().Width,
image->getSize ().Height), 0, colors,
true);
core::recti(
64 - image->getOriginalSize().Width / 2,
64 - image->getOriginalSize().Height / 2,
64 + image->getOriginalSize().Width / 2,
64 + image->getOriginalSize().Height / 2),
core::recti(image->getOriginalSize()),
0, colors, true);
driver->endScene ();
//then create a model and apply to it the RTT Texture
@ -76,14 +75,13 @@ static bool testWith2DImage(video::E_DRIVER_TYPE driverType)
//draw img
driver->draw2DImage (image,
core::rect < s32 >
(64 - image->getSize ().Width / 2,
64 - image->getSize ().Height / 2,
64 + image->getSize ().Width / 2,
64 + image->getSize ().Height / 2),
core::rect < s32 > (0, 0, image->getSize ().Width,
image->getSize ().Height), 0,
colors, true);
core::recti(
64 - image->getOriginalSize().Width / 2,
64 - image->getOriginalSize().Height / 2,
64 + image->getOriginalSize().Width / 2,
64 + image->getOriginalSize().Height / 2),
core::recti(image->getOriginalSize()),
0, colors, true);
//call this is important :
//if not called, the bug won't appear
@ -243,7 +241,7 @@ bool rttAndText(video::E_DRIVER_TYPE driverType)
driver->beginScene(0, video::SColor(255,255, 255, 255));
driver->setRenderTargetEx(renderTarget, video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,0,255));
driver->draw2DImage(driver->getTexture("../media/fireball.bmp"), core::recti(0, 0, renderTargetTex->getSize().Width, renderTargetTex->getSize().Height), core::recti(0, 0, 64, 64));
driver->draw2DImage(driver->getTexture("../media/fireball.bmp"), core::recti(renderTargetTex->getOriginalSize()), core::recti(0, 0, 64, 64));
guienv->getBuiltInFont()->draw(L"OMGGG =!", core::rect<s32>(120, 100, 256, 256), video::SColor(255, 0, 0, 255));
driver->setRenderTargetEx(0, 0, 0);
driver->endScene();

View File

@ -1,4 +1,4 @@
Tests finished. 72 tests of 72 passed.
Compiled as DEBUG
Test suite pass at GMT Tue Mar 29 20:20:24 2022
Test suite pass at GMT Wed Mar 30 21:02:37 2022