Bug 215300 - Address additional review feedback from r265360
Summary: Address additional review feedback from r265360
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kenneth Russell
Keywords: InRadar
Depends on: 183438
  Show dependency treegraph
Reported: 2020-08-07 16:26 PDT by Kenneth Russell
Modified: 2020-08-14 16:27 PDT (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Russell 2020-08-07 16:26:24 PDT
From Bug 183438:

- Refactor copyPremultipliedToPremultiplied and copyUnpremultipliedToUnpremultiplied in Source/WebCore/platform/graphics/ImageBufferBackend.cpp .

- Remove comment which was added in place of the previous assert in copyImagePixelsAccelerated in Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp .
Comment 1 Said Abou-Hallawa 2020-08-10 16:30:41 PDT

- The members: m_originClean, m_premultiplyAlpha and m_forciblyPremultiplyAlpha of ImageBitmap can be replaced by ImageBuffer::SerializationState. This will eliminate the need to sync the members of ImageBitmap and ImageBuffer::SerializationState. Also the whole struct can be copied in many places from std::pair<std::unique_ptr<ImageBuffer>, ImageBuffer::SerializationState> to ImageBitmap and vice versa.
Comment 2 Said Abou-Hallawa 2020-08-12 10:19:13 PDT
Another approach is to make SerializationState enum class type and have an OptionSet< SerializationState> be stored in ImageBitmap:

enum class SerializationState {
    OriginClean = 1 << 0,
    PremultiplyAlpha = 1 << 1,
    ForciblyPremultiplyAlpha = 1 << 2,

class ImageBitmap {
    bool originClean() const { return m_serializationState.contains(SerializationState::OriginClean); }

    OptionSet<SerializationState> m_serializationState;
Comment 3 Radar WebKit Bug Importer 2020-08-14 16:27:40 PDT