Remove unreachable code from CFX_DIBBase::ConvertTo()
CFX_DIBBase::ConvertTo() first handles the case where the source and
destination formats are the same. Then it proceeds to handle the `kArgb`
format, which is also the only format with an alpha channel. When the
destination format is `kArgb`, the only way for `pSrcAlpha` to be
non-null is for the source format to also be `kArgb`. Since this case
has also been handled, it cannot occur again. After removing this
unreachable code, the code to set `pSrcAlpha` also becomes useless.
Change-Id: I544c2dcacb156140f1cace64fe38c23fd3f69c2c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/111930
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/dib/cfx_dibbase.cpp b/core/fxge/dib/cfx_dibbase.cpp
index bf823dc..5186248 100644
--- a/core/fxge/dib/cfx_dibbase.cpp
+++ b/core/fxge/dib/cfx_dibbase.cpp
@@ -939,17 +939,10 @@
if (!pClone->Create(m_Width, m_Height, dest_format))
return nullptr;
- RetainPtr<CFX_DIBitmap> pSrcAlpha;
- if (IsAlphaFormat()) {
- pSrcAlpha = CloneAlphaMask();
- if (!pSrcAlpha)
- return nullptr;
- }
if (dest_format == FXDIB_Format::kArgb) {
- bool ret = pSrcAlpha ? pClone->SetAlphaFromBitmap(pSrcAlpha)
- : pClone->SetUniformOpaqueAlpha();
- if (!ret)
+ if (!pClone->SetUniformOpaqueAlpha()) {
return nullptr;
+ }
}
RetainPtr<const CFX_DIBBase> holder(this);