Changeset 285090 in webkit


Ignore:
Timestamp:
Oct 30, 2021, 8:22:46 PM (4 years ago)
Author:
mmaxfield@apple.com
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):

Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r285089 r285090  
     12021-10-30  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Migrate the first few callers from ImageBuffer::truncatedLogicalSize() to ImageBuffer::logicalSize()
     4        https://bugs.webkit.org/show_bug.cgi?id=232528
     5
     6        Reviewed by Tim Horton.
     7
     8        These are the callers which seem obviously correct to migrate from truncatedLogicalSize() to logicalSize(),
     9        because these are the callers that immediately cast the result to FloatSize. That means, before this patch,
     10        these callers are going from float -> int -> float.
     11
     12        This patch is the fourth step in https://bugs.webkit.org/show_bug.cgi?id=225377. There is no situation where
     13        truncating the logical size is meaningful - we either want the float logical size, or we want the physical
     14        number of texels in the image (which is the logical size, times the resolution, rounded up to an int size).
     15        Eventually, we should move all callers off of truncatedLogicalSize() and on to either logicalSize() or
     16        a yet-to-be-written physicalSize()/texelCount()/bikeshedName().
     17
     18        * platform/graphics/GraphicsContext.cpp:
     19        (WebCore::GraphicsContext::drawImageBuffer):
     20        (WebCore::GraphicsContext::drawConsumingImageBuffer):
     21        * platform/graphics/displaylists/DisplayListImageBuffer.h:
     22        (WebCore::DisplayList::ImageBuffer::ImageBuffer):
     23        * platform/graphics/filters/FEBlend.cpp:
     24        (WebCore::FEBlend::platformApplySoftware):
     25        * platform/graphics/filters/FEComposite.cpp:
     26        (WebCore::FEComposite::platformApplySoftware):
     27        * rendering/CSSFilter.cpp:
     28        (WebCore::CSSFilter::allocateBackingStoreIfNeeded):
     29        * rendering/svg/RenderSVGResourcePattern.cpp:
     30        (WebCore::RenderSVGResourcePattern::buildPattern):
     31
    1322021-10-30  Wenson Hsieh  <wenson_hsieh@apple.com>
    233
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r285071 r285090  
    592592void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions)
    593593{
    594     drawImageBuffer(image, FloatRect(destination, image.truncatedLogicalSize()), FloatRect(FloatPoint(), image.truncatedLogicalSize()), imagePaintingOptions);
     594    drawImageBuffer(image, FloatRect(destination, image.logicalSize()), FloatRect({ }, image.logicalSize()), imagePaintingOptions);
    595595}
    596596
    597597void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions)
    598598{
    599     drawImageBuffer(image, destination, FloatRect(FloatPoint(), FloatSize(image.truncatedLogicalSize())), imagePaintingOptions);
     599    drawImageBuffer(image, destination, FloatRect({ }, image.logicalSize()), imagePaintingOptions);
    600600}
    601601
     
    610610    if (!image)
    611611        return;
    612     IntSize imageLogicalSize = image->truncatedLogicalSize();
    613     drawConsumingImageBuffer(WTFMove(image), FloatRect(destination, imageLogicalSize), FloatRect(FloatPoint(), imageLogicalSize), imagePaintingOptions);
     612    auto imageLogicalSize = image->logicalSize();
     613    drawConsumingImageBuffer(WTFMove(image), FloatRect(destination, imageLogicalSize), FloatRect({ }, imageLogicalSize), imagePaintingOptions);
    614614}
    615615
     
    618618    if (!image)
    619619        return;
    620     IntSize imageLogicalSize = image->truncatedLogicalSize();
    621     drawConsumingImageBuffer(WTFMove(image), destination, FloatRect(FloatPoint(), FloatSize(imageLogicalSize)), imagePaintingOptions);
     620    auto imageLogicalSize = image->logicalSize();
     621    drawConsumingImageBuffer(WTFMove(image), destination, FloatRect({ }, imageLogicalSize), imagePaintingOptions);
    622622}
    623623
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h

    r285071 r285090  
    5353    ImageBuffer(const ImageBufferBackend::Parameters& parameters, std::unique_ptr<BackendType>&& backend)
    5454        : BaseConcreteImageBuffer(parameters, WTFMove(backend))
    55         , m_drawingContext(truncatedLogicalSize(), baseTransform())
     55        , m_drawingContext(logicalSize(), baseTransform())
    5656        , m_writingClient(makeUnique<InMemoryDisplayList::WritingClient>())
    5757        , m_readingClient(makeUnique<InMemoryDisplayList::ReadingClient>())
     
    6363    ImageBuffer(const ImageBufferBackend::Parameters& parameters, RecorderImpl::Delegate* delegate = nullptr)
    6464        : BaseConcreteImageBuffer(parameters)
    65         , m_drawingContext(truncatedLogicalSize(), baseTransform(), delegate)
     65        , m_drawingContext(logicalSize(), baseTransform(), delegate)
    6666        , m_writingClient(makeUnique<InMemoryDisplayList::WritingClient>())
    6767        , m_readingClient(makeUnique<InMemoryDisplayList::ReadingClient>())
  • trunk/Source/WebCore/platform/graphics/filters/FEBlend.cpp

    r285071 r285090  
    7171
    7272    filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()));
    73     filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->truncatedLogicalSize()), { CompositeOperator::SourceOver, m_mode });
     73    filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), { { }, imageBuffer->logicalSize() }, { CompositeOperator::SourceOver, m_mode });
    7474}
    7575#endif
  • trunk/Source/WebCore/platform/graphics/filters/FEComposite.cpp

    r285071 r285090  
    279279    case FECOMPOSITE_OPERATOR_OUT:
    280280        filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()));
    281         filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()), IntRect(IntPoint(), imageBuffer2->truncatedLogicalSize()), CompositeOperator::DestinationOut);
     281        filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()), { { }, imageBuffer2->logicalSize() }, CompositeOperator::DestinationOut);
    282282        break;
    283283    case FECOMPOSITE_OPERATOR_ATOP:
    284284        filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()));
    285         filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->truncatedLogicalSize()), CompositeOperator::SourceAtop);
     285        filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), { { }, imageBuffer->logicalSize() }, CompositeOperator::SourceAtop);
    286286        break;
    287287    case FECOMPOSITE_OPERATOR_XOR:
    288288        filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()));
    289         filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->truncatedLogicalSize()), CompositeOperator::XOR);
     289        filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), { { }, imageBuffer->logicalSize() }, CompositeOperator::XOR);
    290290        break;
    291291    case FECOMPOSITE_OPERATOR_LIGHTER:
    292292        filterContext.drawImageBuffer(*imageBuffer2, drawingRegionOfInputImage(in2->absolutePaintRect()));
    293         filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->truncatedLogicalSize()), CompositeOperator::PlusLighter);
     293        filterContext.drawImageBuffer(*imageBuffer, drawingRegionOfInputImage(in->absolutePaintRect()), { { }, imageBuffer->logicalSize() }, CompositeOperator::PlusLighter);
    294294        break;
    295295    default:
  • trunk/Source/WebCore/rendering/CSSFilter.cpp

    r285071 r285090  
    332332        return;
    333333
    334     IntSize logicalSize { m_sourceDrawingRegion.size() };
    335     if (!sourceImage() || sourceImage()->truncatedLogicalSize() != logicalSize) {
     334    auto logicalSize = m_sourceDrawingRegion.size();
     335    if (!sourceImage() || sourceImage()->logicalSize() != logicalSize) {
    336336#if USE(DIRECT2D)
    337337        setSourceImage(ImageBuffer::create(logicalSize, renderingMode(), &targetContext, filterScale(), DestinationColorSpace::SRGB(), PixelFormat::BGRA8));
  • trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp

    r285071 r285090  
    112112        return nullptr;
    113113
    114     const IntSize tileImageSize = tileImage->truncatedLogicalSize();
     114    auto tileImageSize = tileImage->logicalSize();
    115115
    116116    auto copiedImage = ImageBuffer::sinkIntoNativeImage(WTFMove(tileImage));
  • trunk/Source/WebKit/ChangeLog

    r285089 r285090  
     12021-10-30  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Migrate the first few callers from ImageBuffer::truncatedLogicalSize() to ImageBuffer::logicalSize()
     4        https://bugs.webkit.org/show_bug.cgi?id=232528
     5
     6        Reviewed by Tim Horton.
     7
     8        * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
     9        (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy):
     10
    1112021-10-30  Wenson Hsieh  <wenson_hsieh@apple.com>
    212
  • trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h

    r285088 r285090  
    103103        : BaseConcreteImageBuffer(parameters)
    104104        , m_remoteRenderingBackendProxy(remoteRenderingBackendProxy)
    105         , m_remoteDisplayList(*this, remoteRenderingBackendProxy, { { }, BaseConcreteImageBuffer::truncatedLogicalSize() }, BaseConcreteImageBuffer::baseTransform())
     105        , m_remoteDisplayList(*this, remoteRenderingBackendProxy, { { }, BaseConcreteImageBuffer::logicalSize() }, BaseConcreteImageBuffer::baseTransform())
    106106    {
    107107        ASSERT(m_remoteRenderingBackendProxy);
Note: See TracChangeset for help on using the changeset viewer.