diff --git a/gfx/layers/opengl/CanvasLayerOGL.cpp b/gfx/layers/opengl/CanvasLayerOGL.cpp index 476605cb171..d72327fa8c9 100644 --- a/gfx/layers/opengl/CanvasLayerOGL.cpp +++ b/gfx/layers/opengl/CanvasLayerOGL.cpp @@ -254,6 +254,8 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination, program = mOGLManager->GetBGRALayerProgram(); } + ApplyFilter(mFilter); + program->Activate(); program->SetLayerQuadRect(mBounds); program->SetLayerTransform(mTransform); diff --git a/gfx/layers/opengl/ImageLayerOGL.cpp b/gfx/layers/opengl/ImageLayerOGL.cpp index 7edb686e6d5..dae076aae1a 100644 --- a/gfx/layers/opengl/ImageLayerOGL.cpp +++ b/gfx/layers/opengl/ImageLayerOGL.cpp @@ -392,10 +392,13 @@ ImageLayerOGL::RenderLayer(int, gl()->fActiveTexture(LOCAL_GL_TEXTURE0); gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, yuvImage->mTextures[0].GetTextureID()); + ApplyFilter(mFilter); gl()->fActiveTexture(LOCAL_GL_TEXTURE1); gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, yuvImage->mTextures[1].GetTextureID()); + ApplyFilter(mFilter); gl()->fActiveTexture(LOCAL_GL_TEXTURE2); gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, yuvImage->mTextures[2].GetTextureID()); + ApplyFilter(mFilter); YCbCrTextureLayerProgram *program = mOGLManager->GetYCbCrLayerProgram(); @@ -428,6 +431,8 @@ ImageLayerOGL::RenderLayer(int, else program = mOGLManager->GetBGRALayerProgram(); + ApplyFilter(mFilter); + program->Activate(); program->SetLayerQuadRect(nsIntRect(0, 0, cairoImage->mSize.width, diff --git a/gfx/layers/opengl/LayerManagerOGL.cpp b/gfx/layers/opengl/LayerManagerOGL.cpp index 3588f7c9e44..ac7561096d9 100644 --- a/gfx/layers/opengl/LayerManagerOGL.cpp +++ b/gfx/layers/opengl/LayerManagerOGL.cpp @@ -872,5 +872,19 @@ LayerManagerOGL::CreateFBOWithTexture(int aWidth, int aHeight, DEBUG_GL_ERROR_CHECK(gl()); } +void LayerOGL::ApplyFilter(gfxPattern::GraphicsFilter aFilter) +{ + if (aFilter == gfxPattern::FILTER_NEAREST) { + gl()->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_NEAREST); + gl()->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_NEAREST); + } else { + if (aFilter != gfxPattern::FILTER_GOOD) { + NS_WARNING("Unsupported filter type!"); + } + gl()->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR); + gl()->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR); + } +} + } /* layers */ } /* mozilla */ diff --git a/gfx/layers/opengl/LayerManagerOGL.h b/gfx/layers/opengl/LayerManagerOGL.h index abdf7105f02..2d98a7fb359 100644 --- a/gfx/layers/opengl/LayerManagerOGL.h +++ b/gfx/layers/opengl/LayerManagerOGL.h @@ -439,6 +439,8 @@ public: typedef mozilla::gl::GLContext GLContext; GLContext *gl() const { return mOGLManager->gl(); } + + void ApplyFilter(gfxPattern::GraphicsFilter aFilter); protected: LayerManagerOGL *mOGLManager; PRPackedBool mDestroyed;