Bug 756601 - Setup our OpenGL surface before compositing. r=mstange

This commit is contained in:
Matt Woodrow 2013-05-10 09:02:49 +12:00
Родитель 25cd3e4e03
Коммит 99faba83a1
6 изменённых файлов: 40 добавлений и 2 удалений

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

@ -271,6 +271,9 @@ LayerManagerComposite::Render()
return;
}
mCompositor->GetWidget()->PreRender(this);
nsIntRect clipRect;
Rect bounds(mRenderBounds.x, mRenderBounds.y, mRenderBounds.width, mRenderBounds.height);
Rect actualBounds;

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

@ -115,6 +115,14 @@ public:
} else {
MOZ_ASSERT(mInitParams.mStatus == InitParams::INITIALIZED);
mGL->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mFBO);
GLenum result = mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
if (result != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
nsAutoCString msg;
msg.AppendPrintf("Framebuffer not complete -- error 0x%x, aFBOTextureTarget 0x%x, aRect.width %d, aRect.height %d",
result, mInitParams.mFBOTextureTarget, mInitParams.mSize.width, mInitParams.mSize.height);
NS_WARNING(msg.get());
}
mCompositor->PrepareViewport(mInitParams.mSize, mTransform);
}
}

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

@ -324,6 +324,7 @@ typedef NSInteger NSEventGestureAxis;
- (BOOL)isInFailingLeftClickThrough;
- (void)setGLContext:(NSOpenGLContext *)aGLContext;
- (void)preRender:(NSOpenGLContext *)aGLContext;
// Simple gestures support
//
@ -517,6 +518,7 @@ public:
virtual gfxASurface* GetThebesSurface();
virtual void PrepareWindowEffects() MOZ_OVERRIDE;
virtual void CleanupWindowEffects() MOZ_OVERRIDE;
virtual void PreRender(LayerManager* aManager) MOZ_OVERRIDE;
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) MOZ_OVERRIDE;
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries);

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

@ -1869,6 +1869,14 @@ nsChildView::CleanupWindowEffects()
mCornerMaskImage = nullptr;
}
void
nsChildView::PreRender(LayerManager* aManager)
{
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
NSOpenGLContext *glContext = (NSOpenGLContext *)manager->gl()->GetNativeData(GLContext::NativeGLContext);
[(ChildView*)mView preRender:glContext];
}
void
nsChildView::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect)
{
@ -2306,6 +2314,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
NS_OBJC_END_TRY_ABORT_BLOCK;
}
-(void)preRender:(NSOpenGLContext *)aGLContext
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
if (!mGLContext) {
[self setGLContext:aGLContext];
}
[aGLContext setView:self];
[aGLContext update];
NS_OBJC_END_TRY_ABORT_BLOCK;
}
- (void)dealloc
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;

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

@ -92,8 +92,8 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
#endif
#define NS_IWIDGET_IID \
{ 0x16da2e50, 0x0fee, 0x4719, \
{ 0x93, 0x37, 0xce, 0xd4, 0xdd, 0xd2, 0x22, 0x53 } }
{ 0x37b67cb4, 0x140c, 0x4d46, \
{ 0xa9, 0xf8, 0x28, 0xcc, 0x08, 0x3d, 0x1f, 0x54 } }
/*
* Window shadow styles
@ -1169,6 +1169,8 @@ class nsIWidget : public nsISupports {
*/
virtual void CleanupWindowEffects() = 0;
virtual void PreRender(LayerManager* aManager) = 0;
/**
* Called before the LayerManager draws the layer tree.
*

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

@ -118,6 +118,7 @@ public:
virtual void CreateCompositor(int aWidth, int aHeight);
virtual void PrepareWindowEffects() {}
virtual void CleanupWindowEffects() {}
virtual void PreRender(LayerManager* aManager) {}
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) {}
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) {}
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) {}