summaryrefslogtreecommitdiff
path: root/core/fxge/dib/cfx_dibsource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge/dib/cfx_dibsource.cpp')
-rw-r--r--core/fxge/dib/cfx_dibsource.cpp46
1 files changed, 17 insertions, 29 deletions
diff --git a/core/fxge/dib/cfx_dibsource.cpp b/core/fxge/dib/cfx_dibsource.cpp
index 63fcc5806a..547f01690c 100644
--- a/core/fxge/dib/cfx_dibsource.cpp
+++ b/core/fxge/dib/cfx_dibsource.cpp
@@ -707,24 +707,24 @@ bool CFX_DIBSource::BuildAlphaMask() {
return true;
}
-uint32_t CFX_DIBSource::GetPaletteEntry(int index) const {
+uint32_t CFX_DIBSource::GetPaletteArgb(int index) const {
ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask());
- if (m_pPalette) {
+ if (m_pPalette)
return m_pPalette.get()[index];
- }
+
if (IsCmykImage()) {
- if (GetBPP() == 1) {
+ if (GetBPP() == 1)
return index ? 0 : 0xff;
- }
+
return 0xff - index;
}
- if (GetBPP() == 1) {
+ if (GetBPP() == 1)
return index ? 0xffffffff : 0xff000000;
- }
+
return index * 0x10101 | 0xff000000;
}
-void CFX_DIBSource::SetPaletteEntry(int index, uint32_t color) {
+void CFX_DIBSource::SetPaletteArgb(int index, uint32_t color) {
ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask());
if (!m_pPalette) {
BuildPalette();
@@ -825,15 +825,9 @@ void CFX_DIBSource::GetPalette(uint32_t* pal, int alpha) const {
}
}
-CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneAlphaMask(
- const FX_RECT* pClip) const {
+CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneAlphaMask() const {
ASSERT(GetFormat() == FXDIB_Argb);
FX_RECT rect(0, 0, m_Width, m_Height);
- if (pClip) {
- rect.Intersect(*pClip);
- if (rect.IsEmpty())
- return nullptr;
- }
auto pMask = pdfium::MakeRetain<CFX_DIBitmap>();
if (!pMask->Create(rect.Width(), rect.Height(), FXDIB_8bppMask))
return nullptr;
@@ -975,7 +969,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(
ret = pSrcAlpha ? pClone->LoadChannel(FXDIB_Alpha, pSrcAlpha, FXDIB_Alpha)
: pClone->LoadChannel(FXDIB_Alpha, 0xff);
} else {
- ret = pClone->SetAlphaMask(pSrcAlpha);
+ ret = pClone->SetAlphaMask(pSrcAlpha, nullptr);
}
}
if (!ret)
@@ -993,13 +987,9 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(
return pClone;
}
-CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY(
- bool bXFlip,
- bool bYFlip,
- const FX_RECT* pDestClip) const {
+CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY(bool bXFlip,
+ bool bYFlip) const {
FX_RECT dest_clip(0, 0, m_Height, m_Width);
- if (pDestClip)
- dest_clip.Intersect(*pDestClip);
if (dest_clip.IsEmpty())
return nullptr;
@@ -1094,16 +1084,14 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY(
CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::TransformTo(
const CFX_Matrix* pDestMatrix,
- int& result_left,
- int& result_top,
- uint32_t flags,
- const FX_RECT* pDestClip) {
+ int* result_left,
+ int* result_top) {
CFX_RetainPtr<CFX_DIBSource> holder(this);
- CFX_ImageTransformer transformer(holder, pDestMatrix, flags, pDestClip);
+ CFX_ImageTransformer transformer(holder, pDestMatrix, 0, nullptr);
transformer.Start();
transformer.Continue(nullptr);
- result_left = transformer.result().left;
- result_top = transformer.result().top;
+ *result_left = transformer.result().left;
+ *result_top = transformer.result().top;
return transformer.DetachBitmap();
}