Bug 728524 - Minor rework for TexImage filter setup. r=bgirard
authorOleg Romashin <romaxa@gmail.com>
Sun, 15 Jul 2012 11:11:05 -0400
changeset 99366 5a89db18c245d26a87bf34ab4ac1813d0981219c
parent 99365 f06d25578bdc8b09753adaaca796996c4b791d19
child 99367 4f6f1a2aa64ed36bb2812ee085373e2e37774d26
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbgirard
bugs728524
milestone16.0a1
Bug 728524 - Minor rework for TexImage filter setup. r=bgirard
gfx/layers/opengl/CanvasLayerOGL.cpp
--- a/gfx/layers/opengl/CanvasLayerOGL.cpp
+++ b/gfx/layers/opengl/CanvasLayerOGL.cpp
@@ -371,41 +371,37 @@ ShadowCanvasLayerOGL::RenderLayer(int aP
   }
 
   mOGLManager->MakeCurrent();
 
   ShaderProgramOGL *program =
     mOGLManager->GetProgram(mTexImage->GetShaderProgramType(),
                             GetMaskLayer());
 
-
   gfx3DMatrix effectiveTransform = GetEffectiveTransform();
+  gfxPattern::GraphicsFilter filter = mFilter;
 #ifdef ANDROID
   // Bug 691354
   // Using the LINEAR filter we get unexplained artifacts.
   // Use NEAREST when no scaling is required.
   gfxMatrix matrix;
   bool is2D = GetEffectiveTransform().Is2D(&matrix);
   if (is2D && !matrix.HasNonTranslationOrFlip()) {
-    mTexImage->SetFilter(gfxPattern::FILTER_NEAREST);
-  } else {
-    mTexImage->SetFilter(mFilter);
+    filter = gfxPattern::FILTER_NEAREST;
   }
-#else
-  mTexImage->SetFilter(mFilter);
 #endif
 
-
   program->Activate();
   program->SetLayerTransform(effectiveTransform);
   program->SetLayerOpacity(GetEffectiveOpacity());
   program->SetRenderOffset(aOffset);
   program->SetTextureUnit(0);
   program->LoadMask(GetMaskLayer());
 
+  mTexImage->SetFilter(filter);
   mTexImage->BeginTileIteration();
   if (gl()->CanUploadNonPowerOfTwo()) {
     do {
       TextureImage::ScopedBindTextureAndApplyFilter texBind(mTexImage, LOCAL_GL_TEXTURE0);
       program->SetLayerQuadRect(mTexImage->GetTileRect());
       mOGLManager->BindAndDrawQuad(program, mNeedsYFlip); // FIXME flip order of tiles?
     } while (mTexImage->NextTile());
   } else {