Title: [194912] branches/safari-601.1.46-branch/Source

Diff

Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (194911 => 194912)


--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2016-01-12 19:31:33 UTC (rev 194911)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2016-01-12 19:31:35 UTC (rev 194912)
@@ -1,5 +1,24 @@
 2016-01-11  Matthew Hanson  <[email protected]>
 
+        Merge r194750. rdar://problem/24074335
+
+    2016-01-07  Simon Fraser  <[email protected]>
+
+            Use an appropriate buffer format for swipe snapshots
+            https://bugs.webkit.org/show_bug.cgi?id=152880
+            rdar://problem/23728299
+
+            Reviewed by Tim Horton.
+
+            Choose an appropriate buffer format for swipe snapshots, and avoid converting
+            them to YUV422.
+
+            * platform/graphics/cocoa/IOSurface.h:
+            * platform/graphics/cocoa/IOSurface.mm:
+            (IOSurface::allowConversionFromFormatToFormat):
+
+2016-01-11  Matthew Hanson  <[email protected]>
+
         Merge r194667. rdar://problem/24074334
 
     2016-01-06  Simon Fraser  <[email protected]>

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h (194911 => 194912)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h	2016-01-12 19:31:33 UTC (rev 194911)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.h	2016-01-12 19:31:35 UTC (rev 194912)
@@ -92,6 +92,7 @@
 
 #if PLATFORM(IOS)
     WEBCORE_EXPORT void copyToSurface(IOSurface&);
+    WEBCORE_EXPORT static bool allowConversionFromFormatToFormat(Format, Format);
     WEBCORE_EXPORT static void convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format, std::function<void(std::unique_ptr<WebCore::IOSurface>)>);
 #endif
 

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (194911 => 194912)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2016-01-12 19:31:33 UTC (rev 194911)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2016-01-12 19:31:35 UTC (rev 194912)
@@ -378,6 +378,14 @@
         WTFLogAlways("IOSurfaceAcceleratorTransformSurface %p to %p failed with error %d", m_surface.get(), destSurface.surface(), ret);
 }
 
+bool IOSurface::allowConversionFromFormatToFormat(Format sourceFormat, Format destFormat)
+{
+    if ((sourceFormat == Format::RGB10 || sourceFormat == Format::RGB10A8) && destFormat == Format::YUV422)
+        return false;
+
+    return true;
+}
+
 void IOSurface::convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format format, std::function<void(std::unique_ptr<WebCore::IOSurface>)> callback)
 {
     static IOSurfaceAcceleratorRef accelerator;

Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (194911 => 194912)


--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2016-01-12 19:31:33 UTC (rev 194911)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2016-01-12 19:31:35 UTC (rev 194912)
@@ -1,5 +1,24 @@
 2016-01-11  Matthew Hanson  <[email protected]>
 
+        Merge r194750. rdar://problem/24074335
+
+    2016-01-07  Simon Fraser  <[email protected]>
+
+            Use an appropriate buffer format for swipe snapshots
+            https://bugs.webkit.org/show_bug.cgi?id=152880
+            rdar://problem/23728299
+
+            Reviewed by Tim Horton.
+
+            Choose an appropriate buffer format for swipe snapshots, and avoid converting
+            them to YUV422.
+
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (WebKit::bufferFormat):
+            (-[WKWebView _takeViewSnapshot]):
+
+2016-01-11  Matthew Hanson  <[email protected]>
+
         Merge r194667. rdar://problem/24074334
 
     2016-01-06  Simon Fraser  <[email protected]>

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (194911 => 194912)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-01-12 19:31:33 UTC (rev 194911)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-01-12 19:31:35 UTC (rev 194912)
@@ -133,8 +133,25 @@
     ResizingWithDocumentHidden,
 };
 
+#if __has_include(<WebKitAdditions/RemoteLayerBackingStoreAdditions.mm>)
+#import <WebKitAdditions/RemoteLayerBackingStoreAdditions.mm>
+#else
+
+namespace WebKit {
+
+#if USE(IOSURFACE)
+static WebCore::IOSurface::Format bufferFormat(bool)
+{
+    return WebCore::IOSurface::Format::RGBA;
+}
+#endif // USE(IOSURFACE)
+
+} // namespace WebKit
+
 #endif
 
+#endif // PLATFORM(IOS)
+
 #if PLATFORM(MAC)
 #import "WKViewInternal.h"
 #import <WebCore/ColorMac.h>
@@ -1136,9 +1153,20 @@
     CATransform3D transform = CATransform3DMakeScale(deviceScale, deviceScale, 1);
 
 #if USE(IOSURFACE)
-    auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::ColorSpaceSRGB);
+    WebCore::IOSurface::Format snapshotFormat = WebKit::bufferFormat(true /* is opaque */);
+    auto surface = WebCore::IOSurface::create(WebCore::expandedIntSize(snapshotSize), WebCore::ColorSpaceSRGB, snapshotFormat);
     CARenderServerRenderLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, reinterpret_cast<uint64_t>(self.layer), surface->surface(), 0, 0, &transform);
 
+    WebCore::IOSurface::Format compressedFormat = WebCore::IOSurface::Format::YUV422;
+    if (WebCore::IOSurface::allowConversionFromFormatToFormat(snapshotFormat, compressedFormat)) {
+        RefPtr<WebKit::ViewSnapshot> viewSnapshot = WebKit::ViewSnapshot::create(nullptr);
+        WebCore::IOSurface::convertToFormat(WTF::move(surface), WebCore::IOSurface::Format::YUV422, [viewSnapshot](std::unique_ptr<WebCore::IOSurface> convertedSurface) {
+            viewSnapshot->setSurface(WTF::move(convertedSurface));
+        });
+
+        return viewSnapshot;
+    }
+
     return WebKit::ViewSnapshot::create(WTF::move(surface));
 #else
     uint32_t slotID = [WebKit::ViewSnapshotStore::snapshottingContext() createImageSlot:snapshotSize hasAlpha:YES];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to