mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 861490, fix crash in MaybeDrawRoundedBottomCorners with OMTC. r=mattwoodrow
--HG-- extra : rebase_source : 849e63417a94cd260e6722c83018f9937c0cb339
This commit is contained in:
parent
7991555156
commit
b4a36f6da1
@ -141,7 +141,10 @@ DEFINES += -DMOZ_ENABLE_D3D10_LAYER
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||||
CPPSRCS += ShadowLayerUtilsMac.cpp
|
EXPORTS_mozilla/layers += GLManager.h
|
||||||
|
CPPSRCS += ShadowLayerUtilsMac.cpp \
|
||||||
|
GLManager.cpp \
|
||||||
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# NB: Gralloc is available on other platforms that use the android GL
|
# NB: Gralloc is available on other platforms that use the android GL
|
||||||
|
@ -135,7 +135,6 @@ public:
|
|||||||
|
|
||||||
virtual LayersBackend GetBackendType() MOZ_OVERRIDE
|
virtual LayersBackend GetBackendType() MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(false, "Shouldn't be called for composited layer manager");
|
|
||||||
return LAYERS_NONE;
|
return LAYERS_NONE;
|
||||||
}
|
}
|
||||||
virtual void GetBackendName(nsAString& name) MOZ_OVERRIDE
|
virtual void GetBackendName(nsAString& name) MOZ_OVERRIDE
|
||||||
|
@ -18,12 +18,15 @@ namespace layers {
|
|||||||
|
|
||||||
struct FPSState;
|
struct FPSState;
|
||||||
class CompositingRenderTargetOGL;
|
class CompositingRenderTargetOGL;
|
||||||
|
class GLManagerCompositor;
|
||||||
|
|
||||||
class CompositorOGL : public Compositor
|
class CompositorOGL : public Compositor
|
||||||
{
|
{
|
||||||
typedef mozilla::gl::GLContext GLContext;
|
typedef mozilla::gl::GLContext GLContext;
|
||||||
typedef mozilla::gl::ShaderProgramType ProgramType;
|
typedef mozilla::gl::ShaderProgramType ProgramType;
|
||||||
|
|
||||||
|
friend class GLManagerCompositor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth = -1, int aSurfaceHeight = -1,
|
CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth = -1, int aSurfaceHeight = -1,
|
||||||
bool aIsRenderingToEGLSurface = false);
|
bool aIsRenderingToEGLSurface = false);
|
||||||
|
80
gfx/layers/opengl/GLManager.cpp
Normal file
80
gfx/layers/opengl/GLManager.cpp
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#include "GLManager.h"
|
||||||
|
#include "LayerManagerOGL.h"
|
||||||
|
#include "CompositorOGL.h"
|
||||||
|
#include "LayerManagerComposite.h"
|
||||||
|
#include "GLContext.h"
|
||||||
|
|
||||||
|
using namespace mozilla::gl;
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace layers {
|
||||||
|
|
||||||
|
class GLManagerLayerManager : public GLManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GLManagerLayerManager(LayerManagerOGL* aManager)
|
||||||
|
: mImpl(aManager)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual GLContext* gl() const MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
return mImpl->gl();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ShaderProgramOGL* GetProgram(ShaderProgramType aType) MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
return mImpl->GetProgram(aType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
mImpl->BindAndDrawQuad(aProg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsRefPtr<LayerManagerOGL> mImpl;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GLManagerCompositor : public GLManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GLManagerCompositor(CompositorOGL* aCompositor)
|
||||||
|
: mImpl(aCompositor)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual GLContext* gl() const MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
return mImpl->gl();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ShaderProgramOGL* GetProgram(gl::ShaderProgramType aType) MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
return mImpl->GetProgram(aType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
mImpl->BindAndDrawQuad(aProg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
RefPtr<CompositorOGL> mImpl;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* static */ GLManager*
|
||||||
|
GLManager::CreateGLManager(LayerManager* aManager)
|
||||||
|
{
|
||||||
|
if (aManager->GetBackendType() == LAYERS_OPENGL) {
|
||||||
|
return new GLManagerLayerManager(static_cast<LayerManagerOGL*>(aManager));
|
||||||
|
}
|
||||||
|
if (aManager->GetBackendType() == LAYERS_NONE) {
|
||||||
|
return new GLManagerCompositor(static_cast<CompositorOGL*>(
|
||||||
|
static_cast<LayerManagerComposite*>(aManager)->GetCompositor()));
|
||||||
|
}
|
||||||
|
|
||||||
|
MOZ_NOT_REACHED("Cannot create GLManager for non-GL layer manager");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
37
gfx/layers/opengl/GLManager.h
Normal file
37
gfx/layers/opengl/GLManager.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#ifndef MOZILLA_GFX_GLMANAGER_H
|
||||||
|
#define MOZILLA_GFX_GLMANAGER_H
|
||||||
|
|
||||||
|
#include "LayerManagerOGL.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace gl {
|
||||||
|
class GLContext;
|
||||||
|
}
|
||||||
|
namespace layers {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimal interface to allow widgets to draw using OpenGL. Abstracts
|
||||||
|
* LayerManagerOGL and CompositorOGL. Call CreateGLManager with either a
|
||||||
|
* LayerManagerOGL or a LayerManagerComposite backed by a CompositorOGL.
|
||||||
|
*/
|
||||||
|
class GLManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static GLManager* CreateGLManager(LayerManager* aManager);
|
||||||
|
|
||||||
|
virtual ~GLManager() {}
|
||||||
|
|
||||||
|
virtual gl::GLContext* gl() const = 0;
|
||||||
|
virtual ShaderProgramOGL* GetProgram(gl::ShaderProgramType aType) = 0;
|
||||||
|
virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -90,7 +90,7 @@ class TextureImage;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace layers {
|
namespace layers {
|
||||||
class LayerManagerOGL;
|
class GLManager;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,8 +573,8 @@ protected:
|
|||||||
return widget.forget();
|
return widget.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaybeDrawResizeIndicator(mozilla::layers::LayerManagerOGL* aManager, nsIntRect aRect);
|
void MaybeDrawResizeIndicator(mozilla::layers::GLManager* aManager, nsIntRect aRect);
|
||||||
void MaybeDrawRoundedBottomCorners(mozilla::layers::LayerManagerOGL* aManager, nsIntRect aRect);
|
void MaybeDrawRoundedBottomCorners(mozilla::layers::GLManager* aManager, nsIntRect aRect);
|
||||||
|
|
||||||
nsIWidget* GetWidgetForListenerEvents();
|
nsIWidget* GetWidgetForListenerEvents();
|
||||||
|
|
||||||
|
@ -51,8 +51,9 @@
|
|||||||
#include "nsRegion.h"
|
#include "nsRegion.h"
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
#include "LayerManagerOGL.h"
|
#include "LayerManagerOGL.h"
|
||||||
#include "GLTextureImage.h"
|
|
||||||
#include "LayerManagerComposite.h"
|
#include "LayerManagerComposite.h"
|
||||||
|
#include "GLTextureImage.h"
|
||||||
|
#include "mozilla/layers/GLManager.h"
|
||||||
#include "mozilla/layers/CompositorCocoaWidgetHelper.h"
|
#include "mozilla/layers/CompositorCocoaWidgetHelper.h"
|
||||||
#include "mozilla/layers/CompositorOGL.h"
|
#include "mozilla/layers/CompositorOGL.h"
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
@ -1865,7 +1866,7 @@ nsChildView::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerManagerOGL *manager = static_cast<LayerManagerOGL *>(aManager);
|
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
|
||||||
MaybeDrawResizeIndicator(manager, aRect);
|
MaybeDrawResizeIndicator(manager, aRect);
|
||||||
MaybeDrawRoundedBottomCorners(manager, aRect);
|
MaybeDrawRoundedBottomCorners(manager, aRect);
|
||||||
}
|
}
|
||||||
@ -1904,7 +1905,7 @@ DrawResizer(CGContextRef aCtx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::MaybeDrawResizeIndicator(LayerManagerOGL* aManager, nsIntRect aRect)
|
nsChildView::MaybeDrawResizeIndicator(GLManager* aManager, nsIntRect aRect)
|
||||||
{
|
{
|
||||||
nsIntRect resizeRect;
|
nsIntRect resizeRect;
|
||||||
if (!ShowsResizeIndicator(&resizeRect) || mFailedResizerImage) {
|
if (!ShowsResizeIndicator(&resizeRect) || mFailedResizerImage) {
|
||||||
@ -1953,7 +1954,7 @@ nsChildView::MaybeDrawResizeIndicator(LayerManagerOGL* aManager, nsIntRect aRect
|
|||||||
TextureImage::ScopedBindTexture texBind(mResizerImage, LOCAL_GL_TEXTURE0);
|
TextureImage::ScopedBindTexture texBind(mResizerImage, LOCAL_GL_TEXTURE0);
|
||||||
|
|
||||||
ShaderProgramOGL *program =
|
ShaderProgramOGL *program =
|
||||||
aManager->GetProgram(mResizerImage->GetShaderProgramType(), nullptr);
|
aManager->GetProgram(mResizerImage->GetShaderProgramType());
|
||||||
program->Activate();
|
program->Activate();
|
||||||
program->SetLayerQuadRect(nsIntRect(bottomX - resizeIndicatorWidth,
|
program->SetLayerQuadRect(nsIntRect(bottomX - resizeIndicatorWidth,
|
||||||
bottomY - resizeIndicatorHeight,
|
bottomY - resizeIndicatorHeight,
|
||||||
@ -1975,7 +1976,7 @@ DrawTopLeftCornerMask(CGContextRef aCtx, int aRadius)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsChildView::MaybeDrawRoundedBottomCorners(LayerManagerOGL* aManager, nsIntRect aRect)
|
nsChildView::MaybeDrawRoundedBottomCorners(GLManager* aManager, nsIntRect aRect)
|
||||||
{
|
{
|
||||||
if (![mView isKindOfClass:[ChildView class]] ||
|
if (![mView isKindOfClass:[ChildView class]] ||
|
||||||
![(ChildView*)mView hasRoundedBottomCorners] ||
|
![(ChildView*)mView hasRoundedBottomCorners] ||
|
||||||
@ -2023,7 +2024,7 @@ nsChildView::MaybeDrawRoundedBottomCorners(LayerManagerOGL* aManager, nsIntRect
|
|||||||
|
|
||||||
TextureImage::ScopedBindTexture texBind(mCornerMaskImage, LOCAL_GL_TEXTURE0);
|
TextureImage::ScopedBindTexture texBind(mCornerMaskImage, LOCAL_GL_TEXTURE0);
|
||||||
|
|
||||||
ShaderProgramOGL *program = aManager->GetProgram(mCornerMaskImage->GetShaderProgramType(), nullptr);
|
ShaderProgramOGL *program = aManager->GetProgram(mCornerMaskImage->GetShaderProgramType());
|
||||||
program->Activate();
|
program->Activate();
|
||||||
program->SetLayerQuadRect(nsIntRect(0, 0, // aRect.x, aRect.y,
|
program->SetLayerQuadRect(nsIntRect(0, 0, // aRect.x, aRect.y,
|
||||||
devPixelCornerRadius,
|
devPixelCornerRadius,
|
||||||
|
Loading…
Reference in New Issue
Block a user