Title: [288489] trunk/Source/WebCore
Revision
288489
Author
[email protected]
Date
2022-01-24 17:02:41 -0800 (Mon, 24 Jan 2022)

Log Message

[iOS] Avoid calling IOSurfaceGetPropertyMaximum
https://bugs.webkit.org/show_bug.cgi?id=235526
<rdar://85128431>

Reviewed by Simon Fraser and Darin Adler.

There should be no need to call IOSurfaceGetPropertyMaximum on iOS, since the return value will exceed the hardcoded maximum.

* platform/graphics/cocoa/IOSurface.mm:
(WebCore::maxSurfaceDimensionCA):
(WebCore::computeMaximumSurfaceSize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288488 => 288489)


--- trunk/Source/WebCore/ChangeLog	2022-01-25 00:51:08 UTC (rev 288488)
+++ trunk/Source/WebCore/ChangeLog	2022-01-25 01:02:41 UTC (rev 288489)
@@ -1,3 +1,17 @@
+2022-01-24  Per Arne Vollan  <[email protected]>
+
+        [iOS] Avoid calling IOSurfaceGetPropertyMaximum
+        https://bugs.webkit.org/show_bug.cgi?id=235526
+        <rdar://85128431>
+
+        Reviewed by Simon Fraser and Darin Adler.
+
+        There should be no need to call IOSurfaceGetPropertyMaximum on iOS, since the return value will exceed the hardcoded maximum.
+
+        * platform/graphics/cocoa/IOSurface.mm:
+        (WebCore::maxSurfaceDimensionCA):
+        (WebCore::computeMaximumSurfaceSize):
+
 2022-01-24  Wenson Hsieh  <[email protected]>
 
         [macOS] Update Pasteboard::read to prioritize native representations over TIFF

Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (288488 => 288489)


--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2022-01-25 00:51:08 UTC (rev 288488)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2022-01-25 01:02:41 UTC (rev 288489)
@@ -228,22 +228,30 @@
 
 IOSurface::~IOSurface() = default;
 
+static constexpr IntSize maxSurfaceDimensionCA()
+{
+    // Match limits imposed by Core Animation. FIXME: should have API for this <rdar://problem/25454148>
+#if PLATFORM(IOS_FAMILY)
+    constexpr int maxSurfaceDimension = 8 * 1024;
+#else
+    // IOSurface::maximumSize() can return { INT_MAX, INT_MAX } when hardware acceleration is unavailable.
+    constexpr int maxSurfaceDimension = 32 * 1024;
+#endif
+    return { maxSurfaceDimension, maxSurfaceDimension };
+}
+
 static IntSize computeMaximumSurfaceSize()
 {
+#if PLATFORM(IOS)
+    return maxSurfaceDimensionCA();
+#else
     IntSize maxSize(clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth)), clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceHeight)));
 
     // Protect against maxSize being { 0, 0 }.
-    const int maxSurfaceDimensionLowerBound = 1024;
+    constexpr int maxSurfaceDimensionLowerBound = 1024;
 
-#if PLATFORM(IOS_FAMILY)
-    // Match limits imposed by Core Animation. FIXME: should have API for this <rdar://problem/25454148>
-    const int maxSurfaceDimension = 8 * 1024;
-#else
-    // IOSurface::maximumSize() can return { INT_MAX, INT_MAX } when hardware acceleration is unavailable.
-    const int maxSurfaceDimension = 32 * 1024;
+    return maxSize.constrainedBetween({ maxSurfaceDimensionLowerBound, maxSurfaceDimensionLowerBound }, maxSurfaceDimensionCA() );
 #endif
-
-    return maxSize.constrainedBetween({ maxSurfaceDimensionLowerBound, maxSurfaceDimensionLowerBound }, { maxSurfaceDimension, maxSurfaceDimension });
 }
 
 static WTF::Atomic<IntSize>& surfaceMaximumSize()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to