Add SkMatrix::cheapEqualTo, use in Gr code
Review URL: http://codereview.appspot.com/5865057/
git-svn-id: http://skia.googlecode.com/svn/trunk@3488 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGpuGLShaders.cpp b/src/gpu/gl/GrGpuGLShaders.cpp
index cb156f7..ec2d4e2 100644
--- a/src/gpu/gl/GrGpuGLShaders.cpp
+++ b/src/gpu/gl/GrGpuGLShaders.cpp
@@ -409,7 +409,7 @@
void GrGpuGLShaders::flushViewMatrix() {
const GrMatrix& vm = this->getDrawState().getViewMatrix();
- if (GrGpuGLShaders::getHWViewMatrix() != vm) {
+ if (!GrGpuGLShaders::getHWViewMatrix().cheapEqualTo(vm)) {
const GrRenderTarget* rt = this->getDrawState().getRenderTarget();
GrAssert(NULL != rt);
@@ -492,11 +492,13 @@
const GrGLTexture* texture =
static_cast<const GrGLTexture*>(drawState.getTexture(s));
if (NULL != texture) {
+ const GrMatrix& hwMatrix = this->getHWSamplerMatrix(s);
+ const GrMatrix& samplerMatrix = drawState.getSampler(s).getMatrix();
if (GrGLProgram::kUnusedUniform != uni &&
(((1 << s) & fDirtyFlags.fTextureChangedMask) ||
- this->getHWSamplerMatrix(s) != drawState.getSampler(s).getMatrix())) {
+ !hwMatrix.cheapEqualTo(samplerMatrix))) {
- GrMatrix m = drawState.getSampler(s).getMatrix();
+ GrMatrix m = samplerMatrix;
GrSamplerState::SampleMode mode =
drawState.getSampler(s).getSampleMode();
AdjustTextureMatrix(texture, mode, &m);