Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 09496e855222f4a787bed209454e539b1a732ba0 https://github.com/WebKit/WebKit/commit/09496e855222f4a787bed209454e539b1a732ba0 Author: Cameron McCormack <hey...@apple.com> Date: 2022-10-12 (Wed, 12 Oct 2022)
Changed paths: M Source/WTF/wtf/EnumTraits.h M Source/WebCore/platform/graphics/GraphicsContextState.cpp M Source/WebCore/platform/graphics/Path.h Log Message: ----------- Encode WebCore::Paths using a trailing "end of path" marker instead of an element count prefix https://bugs.webkit.org/show_bug.cgi?id=246322 rdar://100873493 Reviewed by Wenson Hsieh. The WebCore::Path decoder doesn't need to know the number of path elements ahead of time. Changing to use an "end of path" marker saves some space in the encoding, since it'll take up one byte as opposed to the 16 bytes for the path element count. Add EncodedPathElementType to represent "a PathElement::Type or an end of path marker" and which can encode its value in a single byte. Do this rather than: * using std::optional<PathElement::Type> or Markable<PathElement::Type>, as both will write out a boolean "is empty/present" value, which is wasteful, or * adding an EndOfPath enum value to PathElement::Type, as then various call sites unrelated to encoding will need to worry about it. * Source/WTF/wtf/EnumTraits.h: * Source/WebCore/platform/graphics/GraphicsContextState.cpp: (WebCore::toIndex): * Source/WebCore/platform/graphics/Path.h: (WebCore::Path::EncodedPathElementType::encode): (WebCore::Path::EncodedPathElementType::decode): (WebCore::Path::encode const): (WebCore::Path::decode): Canonical link: https://commits.webkit.org/255452@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes