Bug 1170966 - Check quad's effective region before drawing. r=nical, a=me

This commit is contained in:
JerryShih 2015-06-09 10:53:00 -04:00
Родитель 4263b8da0f
Коммит 379b1ccd1d
2 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@ -607,6 +607,8 @@ CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
*aRenderBoundsOut = rect;
}
mRenderBoundsOut = rect;
GLint width = rect.width;
GLint height = rect.height;
@ -950,6 +952,19 @@ CompositorOGL::DrawQuad(const Rect& aRect,
DrawVRDistortion(aRect, aClipRect, aEffectChain, aOpacity, aTransform);
return;
}
// XXX: This doesn't handle 3D transforms. It also doesn't handled rotated
// quads. Fix me.
Rect destRect = aTransform.TransformBounds(aRect);
mPixelsFilled += destRect.width * destRect.height;
// Do a simple culling if this rect is out of target buffer.
// Inflate a small size to avoid some numerical imprecision issue.
destRect.Inflate(1, 1);
if (!mRenderBoundsOut.Intersects(destRect)) {
return;
}
LayerScope::DrawBegin();
Rect clipRect = aClipRect;
@ -999,13 +1014,6 @@ CompositorOGL::DrawQuad(const Rect& aRect,
maskType = MaskType::MaskNone;
}
{
// XXX: This doesn't handle 3D transforms. It also doesn't handled rotated
// quads. Fix me.
const Rect destRect = aTransform.TransformBounds(aRect);
mPixelsFilled += destRect.width * destRect.height;
}
// Determine the color if this is a color shader and fold the opacity into
// the color since color shaders don't have an opacity uniform.
Color color;

Просмотреть файл

@ -457,6 +457,8 @@ private:
FenceHandle mReleaseFenceHandle;
ShaderProgramOGL *mCurrentProgram;
gfx::Rect mRenderBoundsOut;
CompositorOGLVRObjects mVR;
};