Bug 596050 - Set the correct GL minification/magnification filter based on the GraphicsFilter set by content. r=joe a=b

This commit is contained in:
Matt Woodrow 2010-09-21 12:32:17 -04:00
Родитель b92a9be691
Коммит 26e97d8399
4 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -254,6 +254,8 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
program = mOGLManager->GetBGRALayerProgram();
}
ApplyFilter(mFilter);
program->Activate();
program->SetLayerQuadRect(mBounds);
program->SetLayerTransform(mTransform);

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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;