Added a couple of null guards against invalid quads / textures in the render() call, with JLOG calls to trace this out if we should hit one of these cases. (Reformatted tabbing in the function while I was there.)

This commit is contained in:
wrenczes@gmail.com
2011-01-11 10:36:15 +00:00
parent 2063e27681
commit eac6d74ebd
+13 -3
View File
@@ -534,7 +534,19 @@ void JRenderer::PlotArray(float *x, float *y, int count, PIXEL_TYPE color)
// v3---v4 // v3---v4
void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float xScale, float yScale) void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float xScale, float yScale)
{ {
if (mCurrentTextureFormat != quad->mTex->mTextureFormat){ if (quad == NULL)
{
JLOG("JRenderer::RenderQuad: NULL quad pointer!");
return;
}
if (quad->mTex == NULL)
{
JLOG("JRenderer::RenderQuad:: invalid texture!");
return;
}
if (mCurrentTextureFormat != quad->mTex->mTextureFormat)
{
mCurrentTextureFormat = quad->mTex->mTextureFormat; mCurrentTextureFormat = quad->mTex->mTextureFormat;
sceGuTexMode(mCurrentTextureFormat, 0, 0, mSwizzle); sceGuTexMode(mCurrentTextureFormat, 0, 0, mSwizzle);
} }
@@ -551,8 +563,6 @@ void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float x
mCurrentBlend = quad->mBlend; mCurrentBlend = quad->mBlend;
} }
//float destWidth = quad->mWidth*quad->mScaleX; //float destWidth = quad->mWidth*quad->mScaleX;
float destHeight = quad->mHeight*yScale; float destHeight = quad->mHeight*yScale;
float x = xo - quad->mHotSpotX*xScale; float x = xo - quad->mHotSpotX*xScale;