From 1807413f5ed246026011950b6b8db6a742dea123 Mon Sep 17 00:00:00 2001 From: Andreas Gal Date: Sat, 24 May 2014 02:49:41 +0200 Subject: [PATCH] Bug 1012407 - Part 9: Normalize texture coordinates in DecomposeIntoNoRepeatRects (r=BenWa) --- gfx/layers/opengl/CompositorOGL.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index b2d99014148..fbbeb08f1c4 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -384,6 +384,14 @@ DecomposeIntoNoRepeatRects(const Rect& aRect, { Rect texCoordRect = aTexCoordRect; + // We want to normalize here instead of clamp because the rects we were + // given assume GL_REPEAT, which we explicitly won't use and instead + // manually split into sub-rects. + while (texCoordRect.x >= 1.0f) + texCoordRect.x -= 1.0f; + while (texCoordRect.y >= 1.0f) + texCoordRect.y -= 1.0f; + // If the texture should be flipped, it will have negative height. Detect that // here and compensate for it. We will flip each rect as we emit it. bool flipped = false;