Consolidate DebugVerify*IsPreMultiplied() methods.
Combine CFX_DIBitmap::DebugVerifyBitmapIsPreMultiplied() and
CFX_DIBBase::DebugVerifyBufferIsPreMultiplied(). CFX_DIBBase should not
be checking an external buffer anyway. When actually called, the
argument passed to CFX_DIBBase is always its own buffer.
Change-Id: I4cf496ec17486654ecaaed6c9591ca78a6ea3dfe
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/103218
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 7dfbf73..8b3deec 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -1216,7 +1216,7 @@
if (CFX_DefaultRenderDevice::SkiaIsDefaultRenderer()) {
// DrawNormalTextHelper() can result in unpremultiplied bitmaps for
// rendering glyphs. Make sure `bitmap` is premultiplied before proceeding
- // or CFX_DIBBase::DebugVerifyBufferIsPreMultiplied() check will fail.
+ // or CFX_DIBBase::DebugVerifyBitmapIsPreMultiplied() check will fail.
bitmap->PreMultiply();
}
#endif
diff --git a/core/fxge/dib/cfx_dibbase.h b/core/fxge/dib/cfx_dibbase.h
index e0916e7..a015bbf 100644
--- a/core/fxge/dib/cfx_dibbase.h
+++ b/core/fxge/dib/cfx_dibbase.h
@@ -88,7 +88,7 @@
const CFX_ClipRgn* pClipRgn) const;
#ifdef _SKIA_SUPPORT_
- void DebugVerifyBufferIsPreMultiplied(void* buffer) const;
+ void DebugVerifyBitmapIsPreMultiplied() const;
#endif
protected:
diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h
index fb7ba95..3354684 100644
--- a/core/fxge/dib/cfx_dibitmap.h
+++ b/core/fxge/dib/cfx_dibitmap.h
@@ -108,7 +108,6 @@
#ifdef _SKIA_SUPPORT_
void PreMultiply();
- void DebugVerifyBitmapIsPreMultiplied() const;
void UnPreMultiply();
#endif
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 8847c17..69082ea 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -684,7 +684,7 @@
}
case 32:
colorType = kBGRA_8888_SkColorType;
- pSource->DebugVerifyBufferIsPreMultiplied(buffer);
+ pSource->DebugVerifyBitmapIsPreMultiplied();
break;
default:
NOTREACHED(); // TODO(bug_11) ensure that all cases are covered
@@ -2294,10 +2294,10 @@
->SetBitsWithMask(pBitmap, pMask, left, top, bitmap_alpha, blend_type);
}
-void CFX_DIBBase::DebugVerifyBufferIsPreMultiplied(void* arg) const {
+void CFX_DIBBase::DebugVerifyBitmapIsPreMultiplied() const {
#ifdef SK_DEBUG
DCHECK_EQ(GetBPP(), 32);
- const uint32_t* buffer = (const uint32_t*)arg;
+ const uint32_t* buffer = reinterpret_cast<uint32_t*>(GetBuffer().data());
int width = GetWidth();
int height = GetHeight();
// verify that input is really premultiplied
@@ -2316,9 +2316,3 @@
}
#endif // SK_DEBUG
}
-
-void CFX_DIBitmap::DebugVerifyBitmapIsPreMultiplied() const {
-#ifdef SK_DEBUG
- DebugVerifyBufferIsPreMultiplied(GetBuffer().data());
-#endif // SK_DEBUG
-}