summaryrefslogtreecommitdiff
path: root/core/fxge/dib
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-05-08 15:08:12 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-05-08 19:50:11 +0000
commit615bb96eb26570fd87004e2fa6f42eca0dbf79cd (patch)
treea2e2ece53fcaa41c5670ac7e7afd706373f2078f /core/fxge/dib
parent852fb12d554abbbda65bbbf3720117a0aad5a9c9 (diff)
downloadpdfium-615bb96eb26570fd87004e2fa6f42eca0dbf79cd.tar.xz
Remove default params in CFX_DIBSource
Change-Id: I9306afed2747e3b0054adeea1d39916cac47f5c5 Reviewed-on: https://pdfium-review.googlesource.com/5091 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/dib')
-rw-r--r--core/fxge/dib/cfx_dibextractor.cpp4
-rw-r--r--core/fxge/dib/cfx_dibitmap.cpp8
-rw-r--r--core/fxge/dib/cfx_dibsource.cpp46
-rw-r--r--core/fxge/dib/cfx_dibsource.h32
-rw-r--r--core/fxge/dib/cfx_imagestretcher.cpp8
5 files changed, 38 insertions, 60 deletions
diff --git a/core/fxge/dib/cfx_dibextractor.cpp b/core/fxge/dib/cfx_dibextractor.cpp
index 8de69e2e3b..325454a580 100644
--- a/core/fxge/dib/cfx_dibextractor.cpp
+++ b/core/fxge/dib/cfx_dibextractor.cpp
@@ -10,7 +10,7 @@
CFX_DIBExtractor::CFX_DIBExtractor(const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
if (!pSrc->GetBuffer()) {
- m_pBitmap = pSrc->Clone();
+ m_pBitmap = pSrc->Clone(nullptr);
return;
}
CFX_RetainPtr<CFX_DIBSource> pOldSrc(pSrc);
@@ -21,7 +21,7 @@ CFX_DIBExtractor::CFX_DIBExtractor(const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
return;
}
m_pBitmap->SetPalette(pOldSrc->GetPalette());
- m_pBitmap->SetAlphaMask(pOldSrc->m_pAlphaMask);
+ m_pBitmap->SetAlphaMask(pOldSrc->m_pAlphaMask, nullptr);
}
CFX_DIBExtractor::~CFX_DIBExtractor() {}
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
index 6f46e1d57e..4cba073321 100644
--- a/core/fxge/dib/cfx_dibitmap.cpp
+++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -94,7 +94,7 @@ bool CFX_DIBitmap::Copy(const CFX_RetainPtr<CFX_DIBSource>& pSrc) {
return false;
SetPalette(pSrc->GetPalette());
- SetAlphaMask(pSrc->m_pAlphaMask);
+ SetAlphaMask(pSrc->m_pAlphaMask, nullptr);
for (int row = 0; row < pSrc->GetHeight(); row++)
memcpy(m_pBuffer.Get() + row * m_Pitch, pSrc->GetScanline(row), m_Pitch);
return true;
@@ -317,7 +317,7 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
if (pSrcClone->GetWidth() != m_Width ||
pSrcClone->GetHeight() != m_Height) {
if (pAlphaMask) {
- pAlphaMask = pAlphaMask->StretchTo(m_Width, m_Height);
+ pAlphaMask = pAlphaMask->StretchTo(m_Width, m_Height, 0, nullptr);
if (!pAlphaMask)
return false;
}
@@ -327,7 +327,7 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
} else if (pSrcClone->GetWidth() != m_Width ||
pSrcClone->GetHeight() != m_Height) {
CFX_RetainPtr<CFX_DIBitmap> pSrcMatched =
- pSrcClone->StretchTo(m_Width, m_Height);
+ pSrcClone->StretchTo(m_Width, m_Height, 0, nullptr);
if (!pSrcMatched)
return false;
@@ -426,7 +426,7 @@ bool CFX_DIBitmap::MultiplyAlpha(
CFX_RetainPtr<CFX_DIBitmap> pSrcClone = pSrcBitmap.As<CFX_DIBitmap>();
if (pSrcBitmap->GetWidth() != m_Width ||
pSrcBitmap->GetHeight() != m_Height) {
- pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height);
+ pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height, 0, nullptr);
if (!pSrcClone)
return false;
}
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();
}
diff --git a/core/fxge/dib/cfx_dibsource.h b/core/fxge/dib/cfx_dibsource.h
index 97af196677..798e092d16 100644
--- a/core/fxge/dib/cfx_dibsource.h
+++ b/core/fxge/dib/cfx_dibsource.h
@@ -65,39 +65,29 @@ class CFX_DIBSource : public CFX_Retainable {
return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0));
}
- uint32_t GetPaletteEntry(int index) const;
-
- void SetPaletteEntry(int index, uint32_t color);
- uint32_t GetPaletteArgb(int index) const { return GetPaletteEntry(index); }
- void SetPaletteArgb(int index, uint32_t color) {
- SetPaletteEntry(index, color);
- }
+ uint32_t GetPaletteArgb(int index) const;
+ void SetPaletteArgb(int index, uint32_t color);
// Copies into internally-owned palette.
void SetPalette(const uint32_t* pSrcPal);
- CFX_RetainPtr<CFX_DIBitmap> Clone(const FX_RECT* pClip = nullptr) const;
+ CFX_RetainPtr<CFX_DIBitmap> Clone(const FX_RECT* pClip) const;
CFX_RetainPtr<CFX_DIBitmap> CloneConvert(FXDIB_Format format);
CFX_RetainPtr<CFX_DIBitmap> StretchTo(int dest_width,
int dest_height,
- uint32_t flags = 0,
- const FX_RECT* pClip = nullptr);
+ uint32_t flags,
+ const FX_RECT* pClip);
CFX_RetainPtr<CFX_DIBitmap> TransformTo(const CFX_Matrix* pMatrix,
- int& left,
- int& top,
- uint32_t flags = 0,
- const FX_RECT* pClip = nullptr);
- CFX_RetainPtr<CFX_DIBitmap> SwapXY(bool bXFlip,
- bool bYFlip,
- const FX_RECT* pClip = nullptr) const;
+ int* left,
+ int* top);
+ CFX_RetainPtr<CFX_DIBitmap> SwapXY(bool bXFlip, bool bYFlip) const;
CFX_RetainPtr<CFX_DIBitmap> FlipImage(bool bXFlip, bool bYFlip) const;
- CFX_RetainPtr<CFX_DIBitmap> CloneAlphaMask(
- const FX_RECT* pClip = nullptr) const;
+ CFX_RetainPtr<CFX_DIBitmap> CloneAlphaMask() const;
// Copies into internally-owned mask.
bool SetAlphaMask(const CFX_RetainPtr<CFX_DIBSource>& pAlphaMask,
- const FX_RECT* pClip = nullptr);
+ const FX_RECT* pClip);
void GetOverlapRect(int& dest_left,
int& dest_top,
@@ -110,7 +100,7 @@ class CFX_DIBSource : public CFX_Retainable {
const CFX_ClipRgn* pClipRgn);
#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
- void DebugVerifyBitmapIsPreMultiplied(void* buffer = nullptr) const;
+ void DebugVerifyBitmapIsPreMultiplied(void* buffer) const;
#endif
CFX_RetainPtr<CFX_DIBitmap> m_pAlphaMask;
diff --git a/core/fxge/dib/cfx_imagestretcher.cpp b/core/fxge/dib/cfx_imagestretcher.cpp
index d633318feb..809b72d1fb 100644
--- a/core/fxge/dib/cfx_imagestretcher.cpp
+++ b/core/fxge/dib/cfx_imagestretcher.cpp
@@ -73,12 +73,12 @@ bool CFX_ImageStretcher::Start() {
int r0;
int g0;
int b0;
- std::tie(a0, r0, g0, b0) = ArgbDecode(m_pSource->GetPaletteEntry(0));
+ std::tie(a0, r0, g0, b0) = ArgbDecode(m_pSource->GetPaletteArgb(0));
int a1;
int r1;
int g1;
int b1;
- std::tie(a1, r1, g1, b1) = ArgbDecode(m_pSource->GetPaletteEntry(1));
+ std::tie(a1, r1, g1, b1) = ArgbDecode(m_pSource->GetPaletteArgb(1));
for (int i = 0; i < 256; ++i) {
int a = a0 + (a1 - a0) * i / 255;
int r = r0 + (r1 - r0) * i / 255;
@@ -97,12 +97,12 @@ bool CFX_ImageStretcher::Start() {
int m0;
int y0;
int k0;
- std::tie(c0, m0, y0, k0) = CmykDecode(m_pSource->GetPaletteEntry(0));
+ std::tie(c0, m0, y0, k0) = CmykDecode(m_pSource->GetPaletteArgb(0));
int c1;
int m1;
int y1;
int k1;
- std::tie(c1, m1, y1, k1) = CmykDecode(m_pSource->GetPaletteEntry(1));
+ std::tie(c1, m1, y1, k1) = CmykDecode(m_pSource->GetPaletteArgb(1));
for (int i = 0; i < 256; ++i) {
int c = c0 + (c1 - c0) * i / 255;
int m = m0 + (m1 - m0) * i / 255;