mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 05:45:37 +00:00
Bug 914437 - Don't composite windows that are not open. r=mattwoodrow
--HG-- extra : rebase_source : b534eb4c339392c4a2ad60424510c7d264f13d3a
This commit is contained in:
parent
64602ab73f
commit
4ab38a4556
@ -326,7 +326,9 @@ LayerManagerComposite::Render()
|
||||
|
||||
{
|
||||
PROFILER_LABEL("LayerManagerComposite", "PreRender");
|
||||
mCompositor->GetWidget()->PreRender(this);
|
||||
if (!mCompositor->GetWidget()->PreRender(this)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsIntRect clipRect;
|
||||
|
@ -333,7 +333,7 @@ typedef NSInteger NSEventGestureAxis;
|
||||
- (BOOL)isInFailingLeftClickThrough;
|
||||
|
||||
- (void)setGLContext:(NSOpenGLContext *)aGLContext;
|
||||
- (void)preRender:(NSOpenGLContext *)aGLContext;
|
||||
- (bool)preRender:(NSOpenGLContext *)aGLContext;
|
||||
|
||||
- (BOOL)isCoveringTitlebar;
|
||||
|
||||
@ -537,7 +537,7 @@ public:
|
||||
virtual gfxASurface* GetThebesSurface();
|
||||
virtual void PrepareWindowEffects() MOZ_OVERRIDE;
|
||||
virtual void CleanupWindowEffects() MOZ_OVERRIDE;
|
||||
virtual void PreRender(LayerManager* aManager) MOZ_OVERRIDE;
|
||||
virtual bool PreRender(LayerManager* aManager) MOZ_OVERRIDE;
|
||||
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) MOZ_OVERRIDE;
|
||||
|
||||
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries);
|
||||
|
@ -2034,15 +2034,15 @@ nsChildView::CleanupWindowEffects()
|
||||
mTitlebarImage = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
nsChildView::PreRender(LayerManager* aManager)
|
||||
{
|
||||
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
|
||||
if (!manager) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
NSOpenGLContext *glContext = (NSOpenGLContext *)manager->gl()->GetNativeData(GLContext::NativeGLContext);
|
||||
[(ChildView*)mView preRender:glContext];
|
||||
return [(ChildView*)mView preRender:glContext];
|
||||
}
|
||||
|
||||
void
|
||||
@ -2437,7 +2437,9 @@ nsChildView::CleanupRemoteDrawing()
|
||||
void
|
||||
nsChildView::DoRemoteComposition(const nsIntRect& aRenderRect)
|
||||
{
|
||||
[(ChildView*)mView preRender:mGLPresenter->GetNSOpenGLContext()];
|
||||
if (![(ChildView*)mView preRender:mGLPresenter->GetNSOpenGLContext()]) {
|
||||
return;
|
||||
}
|
||||
mGLPresenter->BeginFrame(aRenderRect.Size());
|
||||
|
||||
// Draw the result from the basic compositor.
|
||||
@ -2876,18 +2878,26 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
-(void)preRender:(NSOpenGLContext *)aGLContext
|
||||
- (bool)preRender:(NSOpenGLContext *)aGLContext
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
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];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
return true;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
|
@ -76,6 +76,8 @@ typedef struct _nsCocoaWindowList {
|
||||
float mDPI;
|
||||
|
||||
NSTrackingArea* mTrackingArea;
|
||||
|
||||
BOOL mBeingShown;
|
||||
}
|
||||
|
||||
- (void)importState:(NSDictionary*)aState;
|
||||
@ -95,6 +97,8 @@ typedef struct _nsCocoaWindowList {
|
||||
- (void)updateTrackingArea;
|
||||
- (NSView*)trackingAreaView;
|
||||
|
||||
- (BOOL)isVisibleOrBeingShown;
|
||||
|
||||
- (ChildView*)mainChildView;
|
||||
|
||||
- (NSArray*)titlebarControls;
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "gfxPlatform.h"
|
||||
#include "qcms.h"
|
||||
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include <algorithm>
|
||||
@ -2518,11 +2519,31 @@ GetDPI(NSWindow* aWindow)
|
||||
mScheduledShadowInvalidation = NO;
|
||||
mDPI = GetDPI(self);
|
||||
mTrackingArea = nil;
|
||||
mBeingShown = NO;
|
||||
[self updateTrackingArea];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isVisibleOrBeingShown
|
||||
{
|
||||
return [super isVisible] || mBeingShown;
|
||||
}
|
||||
|
||||
- (void)orderFront:(id)sender
|
||||
{
|
||||
AutoRestore<BOOL> saveBeingShown(mBeingShown);
|
||||
mBeingShown = YES;
|
||||
[super orderFront:sender];
|
||||
}
|
||||
|
||||
- (void)makeKeyAndOrderFront:(id)sender
|
||||
{
|
||||
AutoRestore<BOOL> saveBeingShown(mBeingShown);
|
||||
mBeingShown = YES;
|
||||
[super makeKeyAndOrderFront:sender];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[mActiveTitlebarColor release];
|
||||
|
@ -96,8 +96,8 @@ typedef void* nsNativeWidget;
|
||||
#endif
|
||||
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0x1ebdb596, 0x0f90, 0x4f02, \
|
||||
{ 0x97, 0x07, 0x4e, 0xc1, 0x16, 0xcd, 0x54, 0xf6 } }
|
||||
{ 0x8e2afc1c, 0x7087, 0x4ec2, \
|
||||
{ 0xac, 0xc6, 0xd4, 0xf2, 0x3e, 0x13, 0xd2, 0xb7 } }
|
||||
|
||||
/*
|
||||
* Window shadow styles
|
||||
@ -1215,7 +1215,14 @@ class nsIWidget : public nsISupports {
|
||||
*/
|
||||
virtual void CleanupWindowEffects() = 0;
|
||||
|
||||
virtual void PreRender(LayerManager* aManager) = 0;
|
||||
/**
|
||||
* Called before rendering using OpenGL. Returns false when the widget is
|
||||
* not ready to be rendered (for example while the window is closed).
|
||||
*
|
||||
* Always called from the compositing thread, which may be the main-thread if
|
||||
* OMTC is not enabled.
|
||||
*/
|
||||
virtual bool PreRender(LayerManager* aManager) = 0;
|
||||
|
||||
/**
|
||||
* Called before the LayerManager draws the layer tree.
|
||||
|
@ -136,7 +136,7 @@ public:
|
||||
virtual void CreateCompositor(int aWidth, int aHeight);
|
||||
virtual void PrepareWindowEffects() {}
|
||||
virtual void CleanupWindowEffects() {}
|
||||
virtual void PreRender(LayerManager* aManager) {}
|
||||
virtual bool PreRender(LayerManager* aManager) { return true; }
|
||||
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) {}
|
||||
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) {}
|
||||
virtual mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing();
|
||||
|
Loading…
Reference in New Issue
Block a user