Title: [285090] trunk/Source
Revision
285090
Author
mmaxfi...@apple.com
Date
2021-10-30 20:22:46 -0700 (Sat, 30 Oct 2021)

Log Message

Migrate the first few callers from ImageBuffer::truncatedLogicalSize() to ImageBuffer::logicalSize()
https://bugs.webkit.org/show_bug.cgi?id=232528

Reviewed by Tim Horton.

Source/WebCore:

These are the callers which seem obviously correct to migrate from truncatedLogicalSize() to logicalSize(),
because these are the callers that immediately cast the result to FloatSize. That means, before this patch,
these callers are going from float -> int -> float.

This patch is the fourth step in https://bugs.webkit.org/show_bug.cgi?id=225377. There is no situation where
truncating the logical size is meaningful - we either want the float logical size, or we want the physical
number of texels in the image (which is the logical size, times the resolution, rounded up to an int size).
Eventually, we should move all callers off of truncatedLogicalSize() and on to either logicalSize() or
a yet-to-be-written physicalSize()/texelCount()/bikeshedName().

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImageBuffer):
(WebCore::GraphicsContext::drawConsumingImageBuffer):
* platform/graphics/displaylists/DisplayListImageBuffer.h:
(WebCore::DisplayList::ImageBuffer::ImageBuffer):
* platform/graphics/filters/FEBlend.cpp:
(WebCore::FEBlend::platformApplySoftware):
* platform/graphics/filters/FEComposite.cpp:
(WebCore::FEComposite::platformApplySoftware):
* rendering/CSSFilter.cpp:
(WebCore::CSSFilter::allocateBackingStoreIfNeeded):
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::buildPattern):

Source/WebKit:

* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285089 => 285090)


--- trunk/Source/WebCore/ChangeLog	2021-10-31 03:19:15 UTC (rev 285089)
+++ trunk/Source/WebCore/ChangeLog	2021-10-31 03:22:46 UTC (rev 285090)
@@ -1,3 +1,34 @@
+2021-10-30  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Migrate the first few callers from ImageBuffer::truncatedLogicalSize() to ImageBuffer::logicalSize()
+        https://bugs.webkit.org/show_bug.cgi?id=232528
+
+        Reviewed by Tim Horton.
+
+        These are the callers which seem obviously correct to migrate from truncatedLogicalSize() to logicalSize(),
+        because these are the callers that immediately cast the result to FloatSize. That means, before this patch,
+        these callers are going from float -> int -> float.
+
+        This patch is the fourth step in https://bugs.webkit.org/show_bug.cgi?id=225377. There is no situation where
+        truncating the logical size is meaningful - we either want the float logical size, or we want the physical
+        number of texels in the image (which is the logical size, times the resolution, rounded up to an int size).
+        Eventually, we should move all callers off of truncatedLogicalSize() and on to either logicalSize() or
+        a yet-to-be-written physicalSize()/texelCount()/bikeshedName().
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::drawImageBuffer):
+        (WebCore::GraphicsContext::drawConsumingImageBuffer):
+        * platform/graphics/displaylists/DisplayListImageBuffer.h:
+        (WebCore::DisplayList::ImageBuffer::ImageBuffer):
+        * platform/graphics/filters/FEBlend.cpp:
+        (WebCore::FEBlend::platformApplySoftware):
+        * platform/graphics/filters/FEComposite.cpp:
+        (WebCore::FEComposite::platformApplySoftware):
+        * rendering/CSSFilter.cpp:
+        (WebCore::CSSFilter::allocateBackingStoreIfNeeded):
+        * rendering/svg/RenderSVGResourcePattern.cpp:
+        (WebCore::RenderSVGResourcePattern::buildPattern):
+
 2021-10-30  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Layer tree should not be stuck in frozen state after explicitly stopping a page load

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (285089 => 285090)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2021-10-31 03:19:15 UTC (rev 285089)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2021-10-31 03:22:46 UTC (rev 285090)
@@ -591,12 +591,12 @@
 
 void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions)
 {
-    drawImageBuffer(image, FloatRect(destination, image.truncatedLogicalSize()), FloatRect(FloatPoint(), image.truncatedLogicalSize()), imagePaintingOptions);
+    drawImageBuffer(image, FloatRect(destination, image.logicalSize()), FloatRect({ }, image.logicalSize()), imagePaintingOptions);
 }
 
 void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions)
 {
-    drawImageBuffer(image, destination, FloatRect(FloatPoint(), FloatSize(image.truncatedLogicalSize())), imagePaintingOptions);
+    drawImageBuffer(image, destination, FloatRect({ }, image.logicalSize()), imagePaintingOptions);
 }
 
 void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& options)
@@ -609,8 +609,8 @@
 {
     if (!image)
         return;
-    IntSize imageLogicalSize = image->truncatedLogicalSize();
-    drawConsumingImageBuffer(WTFMove(image), FloatRect(destination, imageLogicalSize), FloatRect(FloatPoint(), imageLogicalSize), imagePaintingOptions);
+    auto imageLogicalSize = image->logicalSize();
+    drawConsumingImageBuffer(WTFMove(image), FloatRect(destination, imageLogicalSize), FloatRect({ }, imageLogicalSize), imagePaintingOptions);
 }
 
 void GraphicsContext::drawConsumingImageBuffer(RefPtr<ImageBuffer> image, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions)
@@ -617,8 +617,8 @@
 {
     if (!image)
         return;
-    IntSize imageLogicalSize = image->truncatedLogicalSize();
-    drawConsumingImageBuffer(WTFMove(image), destination, FloatRect(FloatPoint(), FloatSize(imageLogicalSize)), imagePaintingOptions);
+    auto imageLogicalSize = image->logicalSize();
+    drawConsumingImageBuffer(WTFMove(image), destination, FloatRect({ }, imageLogicalSize), imagePaintingOptions);
 }
 
 void GraphicsContext::drawConsumingImageBuffer(RefPtr<ImageBuffer> image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& options)

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h (285089 => 285090)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h	2021-10-31 03:19:15 UTC (rev 285089)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h	2021-10-31 03:22:46 UTC (rev 285090)
@@ -52,7 +52,7 @@
 
     ImageBuffer(const ImageBufferBackend::Parameters& parameters, std::unique_ptr<BackendType>&& backend)
         : BaseConcreteImageBuffer(parameters, WTFMove(backend))
-        , m_drawingContext(truncatedLogicalSize(), baseTransform())
+        , m_drawingContext(logicalSize(), baseTransform())
         , m_writingClient(makeUnique<InMemoryDisplayList::WritingClient>())
         , m_readingClient(makeUnique<InMemoryDisplayList::ReadingClient>())
     {
@@ -62,7 +62,7 @@
 
     ImageBuffer(const ImageBufferBackend::Parameters& parameters, RecorderImpl::Delegate* delegate = nullptr)
         : BaseConcreteImageBuffer(parameters)
-        , m_drawingContext(truncatedLogicalSize(), baseTransform(), delegate)
+        , m_drawingContext(logicalSize(), baseTransform(), delegate)
         , m_writingClient(makeUnique<InMemoryDisplayList::WritingClient>())
         , m_readingClient(makeUnique<InMemoryDisplayList::ReadingClient>())
     {

Modified: trunk/Source/WebCore/platform/graphics/filters/FEBlend.cpp (285089 => 285090)


--- trunk/Source/WebCore/platform/graphics/filters/FEBlend.cpp	2021-10-31 03:19:15 UTC (rev 285089)
+++ trunk/Source/WebCore/platform/graphics/filters/FEBlend.cpp	2021-10-31 03:22:46 UTC (rev 285090)
@@ -70,7 +70,7 @@
         return;
 
     filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()));
-    filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->truncatedLogicalSize()), { CompositeOperator::SourceOver, m_mode });
+    filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), { { }, imageBuffer->logicalSize() }, { CompositeOperator::SourceOver, m_mode });
 }
 #endif
 

Modified: trunk/Source/WebCore/platform/graphics/filters/FEComposite.cpp (285089 => 285090)


--- trunk/Source/WebCore/platform/graphics/filters/FEComposite.cpp	2021-10-31 03:19:15 UTC (rev 285089)
+++ trunk/Source/WebCore/platform/graphics/filters/FEComposite.cpp	2021-10-31 03:22:46 UTC (rev 285090)
@@ -278,19 +278,19 @@
     }
     case FECOMPOSITE_OPERATOR_OUT:
         filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()));
-        filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()), IntRect(IntPoint(), imageBuffer2->truncatedLogicalSize()), CompositeOperator::DestinationOut);
+        filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()), { { }, imageBuffer2->logicalSize() }, CompositeOperator::DestinationOut);
         break;
     case FECOMPOSITE_OPERATOR_ATOP:
         filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()));
-        filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->truncatedLogicalSize()), CompositeOperator::SourceAtop);
+        filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), { { }, imageBuffer->logicalSize() }, CompositeOperator::SourceAtop);
         break;
     case FECOMPOSITE_OPERATOR_XOR:
         filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()));
-        filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->truncatedLogicalSize()), CompositeOperator::XOR);
+        filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), { { }, imageBuffer->logicalSize() }, CompositeOperator::XOR);
         break;
     case FECOMPOSITE_OPERATOR_LIGHTER:
         filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()));
-        filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->truncatedLogicalSize()), CompositeOperator::PlusLighter);
+        filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), { { }, imageBuffer->logicalSize() }, CompositeOperator::PlusLighter);
         break;
     default:
         break;

Modified: trunk/Source/WebCore/rendering/CSSFilter.cpp (285089 => 285090)


--- trunk/Source/WebCore/rendering/CSSFilter.cpp	2021-10-31 03:19:15 UTC (rev 285089)
+++ trunk/Source/WebCore/rendering/CSSFilter.cpp	2021-10-31 03:22:46 UTC (rev 285090)
@@ -331,8 +331,8 @@
     if (m_graphicsBufferAttached)
         return;
 
-    IntSize logicalSize { m_sourceDrawingRegion.size() };
-    if (!sourceImage() || sourceImage()->truncatedLogicalSize() != logicalSize) {
+    auto logicalSize = m_sourceDrawingRegion.size();
+    if (!sourceImage() || sourceImage()->logicalSize() != logicalSize) {
 #if USE(DIRECT2D)
         setSourceImage(ImageBuffer::create(logicalSize, renderingMode(), &targetContext, filterScale(), DestinationColorSpace::SRGB(), PixelFormat::BGRA8));
 #else

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (285089 => 285090)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp	2021-10-31 03:19:15 UTC (rev 285089)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp	2021-10-31 03:22:46 UTC (rev 285090)
@@ -111,7 +111,7 @@
     if (!tileImage)
         return nullptr;
 
-    const IntSize tileImageSize = tileImage->truncatedLogicalSize();
+    auto tileImageSize = tileImage->logicalSize();
 
     auto copiedImage = ImageBuffer::sinkIntoNativeImage(WTFMove(tileImage));
     if (!copiedImage)

Modified: trunk/Source/WebKit/ChangeLog (285089 => 285090)


--- trunk/Source/WebKit/ChangeLog	2021-10-31 03:19:15 UTC (rev 285089)
+++ trunk/Source/WebKit/ChangeLog	2021-10-31 03:22:46 UTC (rev 285090)
@@ -1,3 +1,13 @@
+2021-10-30  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Migrate the first few callers from ImageBuffer::truncatedLogicalSize() to ImageBuffer::logicalSize()
+        https://bugs.webkit.org/show_bug.cgi?id=232528
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
+        (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy):
+
 2021-10-30  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Layer tree should not be stuck in frozen state after explicitly stopping a page load

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (285089 => 285090)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2021-10-31 03:19:15 UTC (rev 285089)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2021-10-31 03:22:46 UTC (rev 285090)
@@ -102,7 +102,7 @@
     RemoteImageBufferProxy(const WebCore::ImageBufferBackend::Parameters& parameters, RemoteRenderingBackendProxy& remoteRenderingBackendProxy)
         : BaseConcreteImageBuffer(parameters)
         , m_remoteRenderingBackendProxy(remoteRenderingBackendProxy)
-        , m_remoteDisplayList(*this, remoteRenderingBackendProxy, { { }, BaseConcreteImageBuffer::truncatedLogicalSize() }, BaseConcreteImageBuffer::baseTransform())
+        , m_remoteDisplayList(*this, remoteRenderingBackendProxy, { { }, BaseConcreteImageBuffer::logicalSize() }, BaseConcreteImageBuffer::baseTransform())
     {
         ASSERT(m_remoteRenderingBackendProxy);
         m_remoteRenderingBackendProxy->remoteResourceCacheProxy().cacheImageBuffer(*this);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to