[Webkit-unassigned] [Bug 219177] zero boundingRect pointer in Font::platformBoundsForGlyph() to CTFontGetBoundingRectsForGlyphs()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 15 14:01:11 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=219177

--- Comment #9 from Darin Adler <darin at apple.com> ---
Comment on attachment 417721
  --> https://bugs.webkit.org/attachment.cgi?id=417721
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=417721&action=review

>>>>> Source/WebCore/platform/graphics/coretext/FontCoreText.cpp:703
>>>>> +    boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.ctFont(), platformData().orientation() == FontOrientation::Vertical ? kCTFontOrientationVertical : kCTFontOrientationHorizontal, &glyph, &zeroRect, 1);
>>>> 
>>>> After more research I now realize this is an *out* argument from CTFontGetBoundingRectsForGlyphs. So it must not be named "emptyRect" or "zeroRect", since it will get a value and will not be empty or zero! Instead we should pass nullptr. The CTFontGetBoundingRectsForGlyphs documentation for this arguments says "Can be NULL, in which case only the overall bounding rect is calculated." I suggest we use nullptr.
>>> 
>>> Darin, the reason for 218812 was that passing nullptr is not as performant as passing stack-allocated memory, because a heap allocation is performed in that case.
>>> This is what Ryosuke was getting at when he wrote:
>>> 
>>> "So the person who maintains this function told us that passing nullptr will result in heap memory allocation so it's slightly more efficient to pass in a rect."
>> 
>> Oops, forgot that. Then we should not name this "zero rect" but otherwise this is great.
> 
> Sounds good. How does 'dummyRect' sound? (possibly with a comment?)

That’s fine. I might also suggest "ignoredRect".

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210115/d153bb15/attachment-0001.htm>


More information about the webkit-unassigned mailing list