Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c2a0f7a739110d44b44c1cf76e6dc668e3d2b079
      
https://github.com/WebKit/WebKit/commit/c2a0f7a739110d44b44c1cf76e6dc668e3d2b079
  Author: Said Abou-Hallawa <[email protected]>
  Date:   2026-05-06 (Wed, 06 May 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/BitmapImageSource.cpp
    M Source/WebCore/platform/graphics/ImageFrame.cpp
    M Source/WebCore/platform/graphics/ImageFrame.h
    M Source/WebCore/platform/graphics/NativeImage.cpp
    M Source/WebCore/platform/graphics/NativeImage.h
    M Source/WebCore/platform/graphics/cg/NativeImageCG.cpp

  Log Message:
  -----------
  Fix the sizeInBytes of NativeImage and the ImageFrame
https://bugs.webkit.org/show_bug.cgi?id=314258
rdar://176406494

Reviewed by Cameron McCormack.

The sizeInBytes is used to tell the memory manager how much memory an image 
takes.
To fire the memory warning at the right time, the calculation should be 
accurate.

The sizeInBytes of these objects still multiply the area of the image by 4. This
is not necessarily correct for HDR images. the bitPerChannel can 10 or 16 for
example. Also the size of the CVPixelBuffer gain-map image should be taken into
consideration.

* Source/WebCore/platform/graphics/BitmapImageSource.cpp:
(WebCore::BitmapImageSource::cacheNativeImageAtIndex):
* Source/WebCore/platform/graphics/ImageFrame.cpp:
(WebCore::ImageFrame::sizeInBytes const):
(WebCore::ImageFrame::clearSourceImage):
(WebCore::ImageFrame::clearImage):
(WebCore::ImageFrame::clear):
* Source/WebCore/platform/graphics/ImageFrame.h:
(WebCore::ImageFrame::Source::sizeInBytes const):
(WebCore::ImageFrame::sizeInBytes const): Deleted.
* Source/WebCore/platform/graphics/NativeImage.cpp:
(WebCore::NativeImage::sizeInBytes const):
* Source/WebCore/platform/graphics/NativeImage.h:
* Source/WebCore/platform/graphics/cg/NativeImageCG.cpp:
(WebCore::NativeImage::sizeInBytes const):

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



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

Reply via email to