Bug 886999 - Only call setView and update on the GL context when necessary. r=mattwoodrow

--HG--
extra : rebase_source : 5f8b7163cb234e39a4d39bd49e73c3c75017a674
This commit is contained in:
Markus Stange 2013-10-09 10:39:22 -04:00
parent f8d71858b1
commit 6b19ce26ad
2 changed files with 14 additions and 28 deletions

View File

@ -322,8 +322,8 @@ typedef NSInteger NSEventGestureAxis;
enter:(BOOL)aEnter
type:(mozilla::WidgetMouseEvent::exitType)aType;
- (void)update;
- (void) _surfaceNeedsUpdate:(NSNotification*)notification;
- (void)updateGLContext;
- (void)_surfaceNeedsUpdate:(NSNotification*)notification;
- (BOOL)isPluginView;

View File

@ -1959,18 +1959,6 @@ nsChildView::CreateCompositor()
{
nsBaseWidget::CreateCompositor();
if (mCompositorChild) {
LayerManagerComposite *manager =
compositor::GetLayerManager(mCompositorParent);
Compositor *compositor = manager->GetCompositor();
ClientLayerManager *clientManager = static_cast<ClientLayerManager*>(GetLayerManager());
if (clientManager->GetCompositorBackendType() == LAYERS_OPENGL) {
CompositorOGL *compositorOGL = static_cast<CompositorOGL*>(compositor);
NSOpenGLContext *glContext = (NSOpenGLContext *)compositorOGL->gl()->GetNativeData(GLContext::NativeGLContext);
[(ChildView *)mView setGLContext:glContext];
}
[(ChildView *)mView setUsingOMTCompositor:true];
}
}
@ -2863,7 +2851,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
[mGLContext clearDrawable];
[mGLContext setView:self];
[self updateGLContext];
NS_OBJC_END_TRY_ABORT_BLOCK;
}
@ -2882,18 +2870,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
if (!mGLContext) {
[self setGLContext:aGLContext];
}
if ([[self window] isKindOfClass:[BaseWindow class]] &&
![(BaseWindow*)[self window] isVisibleOrBeingShown]) {
// Before the window is shown, our GL context's front FBO is not
// framebuffer complete, so we refuse to render.
return false;
}
[aGLContext setView:self];
[aGLContext update];
if (!mGLContext) {
[self setGLContext:aGLContext];
[self updateGLContext];
}
return true;
@ -3229,16 +3216,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
return [[self window] isMovableByWindowBackground];
}
-(void)update
-(void)updateGLContext
{
if (mGLContext) {
[mGLContext setView:self];
[mGLContext update];
}
}
- (void) _surfaceNeedsUpdate:(NSNotification*)notification
- (void)_surfaceNeedsUpdate:(NSNotification*)notification
{
[self update];
[self updateGLContext];
}
- (BOOL)wantsBestResolutionOpenGLSurface
@ -3451,7 +3439,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
if (!mGeckoChild || ![self window])
return NO;
return mGLContext || [self isUsingMainThreadOpenGL];
return mGLContext || mUsingOMTCompositor || [self isUsingMainThreadOpenGL];
}
- (void)drawUsingOpenGL
@ -3474,10 +3462,8 @@ NSEvent* gLastDragMouseDownEvent = nil;
if (!mGLContext) {
[self setGLContext:glContext];
[self updateGLContext];
}
[glContext setView:self];
[glContext update];
}
mGeckoChild->PaintWindow(region);