зеркало из https://github.com/mozilla/pjs.git
Bug 716439; using mask layers in OGL. r=BenWa
This commit is contained in:
Родитель
a82db9af35
Коммит
a6780c7a3a
|
@ -249,7 +249,9 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
|||
|
||||
if (useGLContext) {
|
||||
gl()->BindTex2DOffscreen(mCanvasGLContext);
|
||||
program = mOGLManager->GetBasicLayerProgram(CanUseOpaqueSurface(), true);
|
||||
program = mOGLManager->GetBasicLayerProgram(CanUseOpaqueSurface(),
|
||||
true,
|
||||
GetMaskLayer() ? Mask2d : MaskNone);
|
||||
} else if (mDelayedUpdates) {
|
||||
NS_ABORT_IF_FALSE(mCanvasSurface || mDrawTarget, "WebGL canvases should always be using full texture upload");
|
||||
|
||||
|
@ -269,7 +271,7 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
|||
}
|
||||
|
||||
if (!program) {
|
||||
program = mOGLManager->GetProgram(mLayerProgram);
|
||||
program = mOGLManager->GetProgram(mLayerProgram, GetMaskLayer());
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
|
||||
|
@ -286,6 +288,7 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
|||
program->SetLayerOpacity(GetEffectiveOpacity());
|
||||
program->SetRenderOffset(aOffset);
|
||||
program->SetTextureUnit(0);
|
||||
program->LoadMask(GetMaskLayer());
|
||||
|
||||
if (gl()->CanUploadNonPowerOfTwo()) {
|
||||
mOGLManager->BindAndDrawQuad(program, mNeedsYFlip ? true : false);
|
||||
|
@ -394,6 +397,7 @@ ShadowCanvasLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
|||
{
|
||||
mOGLManager->MakeCurrent();
|
||||
|
||||
//TODO[nrc] shadow layer masking?
|
||||
ShaderProgramOGL *program =
|
||||
mOGLManager->GetProgram(mTexImage->GetShaderProgramType());
|
||||
|
||||
|
|
|
@ -63,12 +63,14 @@ RenderColorLayer(ColorLayer* aLayer, LayerManagerOGL *aManager,
|
|||
color.b *= opacity;
|
||||
color.a = opacity;
|
||||
|
||||
ShaderProgramOGL *program = aManager->GetProgram(gl::ColorLayerProgramType);
|
||||
ShaderProgramOGL *program = aManager->GetProgram(gl::ColorLayerProgramType,
|
||||
aLayer->GetMaskLayer());
|
||||
program->Activate();
|
||||
program->SetLayerQuadRect(visibleRect);
|
||||
program->SetLayerTransform(aLayer->GetEffectiveTransform());
|
||||
program->SetRenderOffset(aOffset);
|
||||
program->SetRenderColor(color);
|
||||
program->LoadMask(aLayer->GetMaskLayer());
|
||||
|
||||
aManager->BindAndDrawQuad(program);
|
||||
}
|
||||
|
|
|
@ -279,7 +279,16 @@ ContainerRender(Container* aContainer,
|
|||
|
||||
aContainer->gl()->fBindTexture(aManager->FBOTextureTarget(), containerSurface);
|
||||
|
||||
ShaderProgramOGL *rgb = aManager->GetFBOLayerProgram();
|
||||
MaskType maskType = MaskNone;
|
||||
if (aContainer->GetMaskLayer()) {
|
||||
if (!aContainer->GetTransform().CanDraw2D()) {
|
||||
maskType = Mask3d;
|
||||
} else {
|
||||
maskType = Mask2d;
|
||||
}
|
||||
}
|
||||
ShaderProgramOGL *rgb =
|
||||
aManager->GetFBOLayerProgram(maskType);
|
||||
|
||||
rgb->Activate();
|
||||
rgb->SetLayerQuadRect(visibleRect);
|
||||
|
@ -287,6 +296,7 @@ ContainerRender(Container* aContainer,
|
|||
rgb->SetLayerOpacity(opacity);
|
||||
rgb->SetRenderOffset(aOffset);
|
||||
rgb->SetTextureUnit(0);
|
||||
rgb->LoadMask(aContainer->GetMaskLayer());
|
||||
|
||||
if (rgb->GetTexCoordMultiplierUniformLocation() != -1) {
|
||||
// 2DRect case, get the multiplier right for a sampler2DRect
|
||||
|
|
|
@ -275,7 +275,8 @@ ImageLayerOGL::RenderLayer(int,
|
|||
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, data->mTextures[0].GetTextureID());
|
||||
gl()->ApplyFilterToBoundTexture(mFilter);
|
||||
|
||||
ShaderProgramOGL *program = mOGLManager->GetProgram(YCbCrLayerProgramType);
|
||||
ShaderProgramOGL *program = mOGLManager->GetProgram(YCbCrLayerProgramType,
|
||||
GetMaskLayer());
|
||||
|
||||
program->Activate();
|
||||
program->SetLayerQuadRect(nsIntRect(0, 0,
|
||||
|
@ -285,6 +286,7 @@ ImageLayerOGL::RenderLayer(int,
|
|||
program->SetLayerOpacity(GetEffectiveOpacity());
|
||||
program->SetRenderOffset(aOffset);
|
||||
program->SetYCbCrTextureUnits(0, 1, 2);
|
||||
program->LoadMask(GetMaskLayer());
|
||||
|
||||
mOGLManager->BindAndDrawQuadWithTextureRect(program,
|
||||
yuvImage->mData.GetPictureRect(),
|
||||
|
@ -342,7 +344,7 @@ ImageLayerOGL::RenderLayer(int,
|
|||
#endif
|
||||
|
||||
ShaderProgramOGL *program =
|
||||
mOGLManager->GetProgram(data->mLayerProgram);
|
||||
mOGLManager->GetProgram(data->mLayerProgram, GetMaskLayer());
|
||||
|
||||
gl()->ApplyFilterToBoundTexture(mFilter);
|
||||
|
||||
|
@ -355,6 +357,7 @@ ImageLayerOGL::RenderLayer(int,
|
|||
program->SetLayerOpacity(GetEffectiveOpacity());
|
||||
program->SetRenderOffset(aOffset);
|
||||
program->SetTextureUnit(0);
|
||||
program->LoadMask(GetMaskLayer());
|
||||
|
||||
nsIntRect rect = GetVisibleRegion().GetBounds();
|
||||
|
||||
|
@ -430,7 +433,8 @@ ImageLayerOGL::RenderLayer(int,
|
|||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
gl()->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, data->mTexture.GetTextureID());
|
||||
|
||||
ShaderProgramOGL *program = mOGLManager->GetProgram(gl::RGBARectLayerProgramType);
|
||||
ShaderProgramOGL *program =
|
||||
mOGLManager->GetProgram(gl::RGBARectLayerProgramType, GetMaskLayer());
|
||||
|
||||
program->Activate();
|
||||
if (program->GetTexCoordMultiplierUniformLocation() != -1) {
|
||||
|
@ -447,6 +451,7 @@ ImageLayerOGL::RenderLayer(int,
|
|||
program->SetLayerOpacity(GetEffectiveOpacity());
|
||||
program->SetRenderOffset(aOffset);
|
||||
program->SetTextureUnit(0);
|
||||
program->LoadMask(GetMaskLayer());
|
||||
|
||||
mOGLManager->BindAndDrawQuad(program);
|
||||
gl()->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
@ -800,6 +805,7 @@ ShadowImageLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
|||
mOGLManager->MakeCurrent();
|
||||
|
||||
if (mTexImage) {
|
||||
//TODO[nrc] shadow layer masking?
|
||||
ShaderProgramOGL *colorProgram =
|
||||
mOGLManager->GetProgram(mTexImage->GetShaderProgramType());
|
||||
|
||||
|
@ -842,6 +848,7 @@ ShadowImageLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
|||
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, mYUVTexture[2].GetTextureID());
|
||||
gl()->ApplyFilterToBoundTexture(mFilter);
|
||||
|
||||
//TODO[nrc] shadow layer masking?
|
||||
ShaderProgramOGL *yuvProgram = mOGLManager->GetProgram(YCbCrLayerProgramType);
|
||||
|
||||
yuvProgram->Activate();
|
||||
|
|
Загрузка…
Ссылка в новой задаче