[webkit-changes] [WebKit/WebKit] 828ba3: [CG] Optimize getting the ImageFrame metadata

Said Abou-Hallawa noreply at github.com
Tue May 21 11:46:30 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 828ba37f8b033c4d0fc61f65f5abc40885b469df
      https://github.com/WebKit/WebKit/commit/828ba37f8b033c4d0fc61f65f5abc40885b469df
  Author: Said Abou-Hallawa <said at apple.com>
  Date:   2024-05-21 (Tue, 21 May 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/BitmapImageSource.cpp
    M Source/WebCore/platform/graphics/ImageDecoder.cpp
    M Source/WebCore/platform/graphics/ImageDecoder.h
    M Source/WebCore/platform/graphics/ImageFrame.h
    M Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp
    M Source/WebCore/platform/graphics/cg/ImageDecoderCG.h
    M Source/WebCore/platform/image-decoders/ScalableImageDecoder.h

  Log Message:
  -----------
  [CG] Optimize getting the ImageFrame metadata
https://bugs.webkit.org/show_bug.cgi?id=274399
rdar://126232516

Reviewed by Simon Fraser.

BitmapImageSource::cacheMetadataAtIndex() currently makes separate calls to
ImageDecoder functions. Some of them calls CGImageSourceCopyPropertiesAtIndex()
and we end up calling CGImageSourceCopyPropertiesAtIndex() multiple times.

This can be optimized by adding ImageDecoder::frameMetadataAtIndex() which fills
in the ImageFrame metadata. This way CGImageSourceCopyPropertiesAtIndex() will
be called once and its CFDictionary will be used to retrieve all the ImageFrame
metadata.

* Source/WebCore/platform/graphics/BitmapImageSource.cpp:
(WebCore::BitmapImageSource::cacheMetadataAtIndex):
* Source/WebCore/platform/graphics/ImageDecoder.cpp:
(WebCore::ImageDecoder::fetchFrameMetaDataAtIndex const):
* Source/WebCore/platform/graphics/ImageDecoder.h:
(WebCore::ImageDecoder::frameDensityCorrectedSizeAtIndex const):
(WebCore::ImageDecoder::densityCorrectedSizeAtIndex const): Deleted.
* Source/WebCore/platform/graphics/ImageFrame.h:
* Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::frameSizeFromProperties):
(WebCore::ImageDecoderCG::encodedDataStatus const):
(WebCore::ImageDecoderCG::hasAlpha const):
(WebCore::ImageDecoderCG::frameSizeAtIndex const):
(WebCore::ImageDecoderCG::frameOrientationAtIndex const):
(WebCore::ImageDecoderCG::frameDensityCorrectedSizeAtIndex const):
(WebCore::ImageDecoderCG::frameHasAlphaAtIndex const):
(WebCore::ImageDecoderCG::fetchFrameMetaDataAtIndex const):
(WebCore::ImageDecoderCG::decodeUTI):
(WebCore::ImageDecoderCG::shouldUseQuickLookForFullscreen const):
(WebCore::ImageDecoderCG::densityCorrectedSizeAtIndex const): Deleted.
* Source/WebCore/platform/graphics/cg/ImageDecoderCG.h:
* Source/WebCore/platform/image-decoders/ScalableImageDecoder.h:

Canonical link: https://commits.webkit.org/279069@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list