<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Deduplicated initializer lists of BitmapImage constructors."
href="https://bugs.webkit.org/show_bug.cgi?id=157249#c11">Comment # 11</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Deduplicated initializer lists of BitmapImage constructors."
href="https://bugs.webkit.org/show_bug.cgi?id=157249">bug 157249</a>
from <span class="vcard"><a class="email" href="mailto:sabouhallawa@apple.com" title="Said Abou-Hallawa <sabouhallawa@apple.com>"> <span class="fn">Said Abou-Hallawa</span></a>
</span></b>
<pre>Another cleaner way is the following:
1. Convert all the bit-field boolean members in the BitImage class to be non bit-field so you can initialize them in the class header like that:
<< bool m_isSolidColor : 1;
>> bool m_isSolidColor { false };
2. Move the platform-dependent constructor BitmapImage::BitmapImage() from BitmapImageCairo.cpp and BitmapImageCG.cpp to BitmapImage.cpp and have only one constructor written like that
BitmapImage(NativeImagePtr&& image, ImageObserver* observer)
: Image(observer)
, m_frameCount(1)
, m_animationFinished(true)
...
3. Add two new static methods in FrameData which return the size and the hasAlpha of a NativeImagePtr. And call these functions from the constructor like that:
BitmapImage::BitmapImage(NativeImagePtr&& image, ImageObserver* observer)
: mage(observer)
, m_frameCount(1)
, m_animationFinished(true)
...
{
m_size = FrameData::size(image);
m_decodedSize = size.area() * 4;
m_frames.grow(1);
m_frames[0].m_haveMetadata = true;
m_frames[0].m_hasAlpha = FrameData::hasAlpha(image;
m_frames[0].m_image = WTFMove(image);
checkForSolidColor();
}
5. Have different implementations for these function in BitmapImageCairo.cpp and BitmapImageCG.cpp.
e.g. in BitmapImageCG.cpp:
FrameData::hasAlpha(NativeImagePtr&)
{
return true;
}
FrameData::size(NativeImagePtr& image)
{
return IntSize(CGImageGetWidth(image.get()), CGImageGetHeight(image.get()))
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>