Bug 1404536 - Use float division not accidentally int division. - r=daoshengmu
MozReview-Commit-ID: KUIE0dl6hlE
--- a/gfx/gl/GLBlitHelper.cpp
+++ b/gfx/gl/GLBlitHelper.cpp
@@ -168,37 +168,36 @@ SubRectMat3(const float x, const float y
ret.at(2,1) = y;
ret.at(2,2) = 1.0f;
return ret;
}
Mat3
SubRectMat3(const gfx::IntRect& subrect, const gfx::IntSize& size)
{
- return SubRectMat3(subrect.x / size.width,
- subrect.y / size.height,
- subrect.width / size.width,
- subrect.height / size.height);
+ return SubRectMat3(float(subrect.x) / size.width,
+ float(subrect.y) / size.height,
+ float(subrect.width) / size.width,
+ float(subrect.height) / size.height);
}
Mat3
SubRectMat3(const gfx::IntRect& bigSubrect, const gfx::IntSize& smallSize,
const gfx::IntSize& divisors)
{
const float x = float(bigSubrect.x) / divisors.width;
const float y = float(bigSubrect.y) / divisors.height;
const float w = float(bigSubrect.width) / divisors.width;
const float h = float(bigSubrect.height) / divisors.height;
return SubRectMat3(x / smallSize.width,
y / smallSize.height,
w / smallSize.width,
h / smallSize.height);
}
-
// --
ScopedSaveMultiTex::ScopedSaveMultiTex(GLContext* const gl, const uint8_t texCount,
const GLenum texTarget)
: mGL(*gl)
, mTexCount(texCount)
, mTexTarget(texTarget)
, mOldTexUnit(mGL.GetIntAs<GLenum>(LOCAL_GL_ACTIVE_TEXTURE))