Bug 1496823 - Inline drawUsingOpenGL into drawRect:inContext: and tweak a comment. r=spohl
authorMarkus Stange <mstange@themasta.com>
Wed, 17 Oct 2018 20:48:20 +0000
changeset 500297 408b8733a0a6c805eab8c6bbcb267a07e6bc7dfd
parent 500296 d1d878123a68f2f7bcd4f31f57fd7eb648975ada
child 500298 c9da89f17cf9426dbfad7af2940ebc9f05225c3a
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl
bugs1496823
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1496823 - Inline drawUsingOpenGL into drawRect:inContext: and tweak a comment. r=spohl Depends on D7928 Differential Revision: https://phabricator.services.mozilla.com/D7929
widget/cocoa/nsChildView.mm
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -178,17 +178,16 @@ static NSMutableDictionary* sNativeKeyEv
                            toGeckoEvent:(WidgetMouseEvent*)outGeckoEvent;
 - (NSMenu*)contextMenu;
 
 - (BOOL)isRectObscuredBySubview:(NSRect)inRect;
 
 - (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext;
 - (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
 - (BOOL)isUsingOpenGL;
-- (void)drawUsingOpenGL;
 
 - (BOOL)hasRoundedBottomCorners;
 - (CGFloat)cornerRadius;
 - (void)clearCorners;
 
 -(void)setGLOpaque:(BOOL)aOpaque;
 
 // Overlay drawing functions for traditional CGContext drawing
@@ -3654,18 +3653,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
     // buffer may now contain garbage which we need to prevent from reaching
     // the screen. The only place where garbage can show is in the window
     // corners and the vibrant regions of the window - the rest of the window
     // is covered by opaque content in our OpenGL surface.
     // So we need to clear the pixel buffer contents in these areas.
     mGeckoChild->ClearVibrantAreas();
     [self clearCorners];
 
-    // Do GL composition and return.
-    [self drawUsingOpenGL];
+    // Force a sync OMTC composite into the OpenGL context and return.
+    LayoutDeviceIntRect geckoBounds = mGeckoChild->GetBounds();
+    LayoutDeviceIntRegion region(geckoBounds);
+    mGeckoChild->PaintWindow(region);
     return;
   }
 
   AUTO_PROFILER_LABEL("ChildView::drawRect", OTHER);
 
   // The CGContext that drawRect supplies us with comes with a transform that
   // scales one user space unit to one Cocoa point, which can consist of
   // multiple dev pixels. But Gecko expects its supplied context to be scaled
@@ -3700,29 +3701,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
 - (BOOL)isUsingOpenGL
 {
   if (!mGeckoChild || ![self window])
     return NO;
 
   return mGLContext || mUsingOMTCompositor;
 }
 
-- (void)drawUsingOpenGL
-{
-  AUTO_PROFILER_LABEL("ChildView::drawUsingOpenGL", OTHER);
-
-  if (![self isUsingOpenGL] || !mGeckoChild->IsVisible())
-    return;
-
-  LayoutDeviceIntRect geckoBounds = mGeckoChild->GetBounds();
-  LayoutDeviceIntRegion region(geckoBounds);
-
-  mGeckoChild->PaintWindow(region);
-}
-
 - (BOOL)hasRoundedBottomCorners
 {
   return [[self window] respondsToSelector:@selector(bottomCornerRounded)] &&
   [[self window] bottomCornerRounded];
 }
 
 - (CGFloat)cornerRadius
 {