Changeset 247466 in webkit
- Timestamp:
- Jul 15, 2019 7:32:43 PM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r247461 r247466 1 2019-07-15 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 [ Mojave WK1 ] Some Image tests are flakey failures and are failing in tandem with zoomed in or blank image results 4 https://bugs.webkit.org/show_bug.cgi?id=193108 5 6 Reviewed by Simon Fraser. 7 8 Add a workaround for <rdar://problem/17084993> in createBitmapContextFromWebView(). 9 Re-request the snapshot at kCGWindowImageNominalResolution if it was captured 10 at the wrong scale. 11 12 * DumpRenderTree/mac/PixelDumpSupportMac.mm: 13 (takeWindowSnapshot): 14 (createBitmapContextFromWebView): 15 1 16 2019-07-15 Brady Eidson <beidson@apple.com> 2 17 -
trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm
r234115 r247466 37 37 #import <CoreGraphics/CGBitmapContext.h> 38 38 #import <QuartzCore/QuartzCore.h> 39 #import <pal/spi/cg/CoreGraphicsSPI.h> 39 40 #import <wtf/Assertions.h> 40 41 #import <wtf/RefPtr.h> … … 81 82 CGContextEndTransparencyLayer(context); 82 83 CGContextRestoreGState(context); 84 } 85 86 static CGImageRef takeWindowSnapshot(CGSWindowID windowID, CGWindowImageOption imageOptions) 87 { 88 imageOptions |= kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque; 89 return CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, windowID, imageOptions); 83 90 } 84 91 … … 129 136 // Ask the window server to provide us a composited version of the *real* window content including surfaces (i.e. OpenGL content) 130 137 // Note that the returned image might differ very slightly from the window backing because of dithering artifacts in the window server compositor. 131 CGImageRef image = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [[view window] windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque); 138 NSWindow *window = [view window]; 139 CGImageRef image = takeWindowSnapshot([window windowNumber], kCGWindowImageDefault); 140 141 if (image) { 142 // Work around <rdar://problem/17084993>; re-request the snapshot at kCGWindowImageNominalResolution if it was captured at the wrong scale. 143 CGFloat desiredSnapshotWidth = window.frame.size.width * deviceScaleFactor; 144 if (CGImageGetWidth(image) != desiredSnapshotWidth) 145 image = takeWindowSnapshot([window windowNumber], kCGWindowImageNominalResolution); 146 } 147 148 if (!image) 149 return nullptr; 150 132 151 CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image); 133 152 CGImageRelease(image);
Note: See TracChangeset
for help on using the changeset viewer.