Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2360)

Unified Diff: core/src/fxge/dib/fx_dib_engine.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxge/dib/fx_dib_convert.cpp ('k') | core/src/fxge/dib/fx_dib_main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/dib/fx_dib_engine.cpp
diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp
index 11e9a110cbe69363ca19ae28376b0354a6ee60cf..6b65b2a4b456b8653f9be6be8e4a1a4b127293b0 100644
--- a/core/src/fxge/dib/fx_dib_engine.cpp
+++ b/core/src/fxge/dib/fx_dib_engine.cpp
@@ -217,7 +217,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format d
m_SrcHeight = pSrcBitmap->GetHeight();
m_SrcPitch = (m_SrcWidth * m_SrcBpp + 31) / 32 * 4;
if ((flags & FXDIB_NOSMOOTH) == 0) {
- FX_BOOL bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL;
+ bool bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL;
if (!bInterpol && FXSYS_abs(dest_width) != 0 && FXSYS_abs(dest_height) < m_SrcWidth * m_SrcHeight * 8 / FXSYS_abs(dest_width)) {
flags = FXDIB_INTERPOL;
}
@@ -280,16 +280,16 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format d
}
}
}
-FX_BOOL CStretchEngine::Continue(IFX_Pause* pPause)
+bool CStretchEngine::Continue(IFX_Pause* pPause)
{
while (m_State == 1) {
if (ContinueStretchHorz(pPause)) {
- return TRUE;
+ return true;
}
m_State = 2;
StretchVert();
}
- return FALSE;
+ return false;
}
CStretchEngine::~CStretchEngine()
{
@@ -306,46 +306,46 @@ CStretchEngine::~CStretchEngine()
FX_Free(m_pDestMaskScanline);
}
}
-FX_BOOL CStretchEngine::StartStretchHorz()
+bool CStretchEngine::StartStretchHorz()
{
if (m_DestWidth == 0 || m_pDestScanline == NULL || m_SrcClip.Height() > (int)((1U << 29) / m_InterPitch) || m_SrcClip.Height() == 0) {
- return FALSE;
+ return false;
}
m_pInterBuf = FX_TryAlloc(unsigned char, m_SrcClip.Height() * m_InterPitch);
if (m_pInterBuf == NULL) {
- return FALSE;
+ return false;
}
if (m_pSource && m_bHasAlpha && m_pSource->m_pAlphaMask) {
m_pExtraAlphaBuf = FX_Alloc2D(unsigned char, m_SrcClip.Height(), m_ExtraMaskPitch);
FX_DWORD size = (m_DestClip.Width() * 8 + 31) / 32 * 4;
m_pDestMaskScanline = FX_TryAlloc(unsigned char, size);
if (!m_pDestMaskScanline) {
- return FALSE;
+ return false;
}
}
m_WeightTable.Calc(m_DestWidth, m_DestClip.left, m_DestClip.right, m_SrcWidth, m_SrcClip.left, m_SrcClip.right, m_Flags);
if (m_WeightTable.m_pWeightTables == NULL) {
- return FALSE;
+ return false;
}
m_CurRow = m_SrcClip.top;
m_State = 1;
- return TRUE;
+ return true;
}
#define FX_STRECH_PAUSE_ROWS 10
-FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause)
+bool CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause)
{
if (!m_DestWidth) {
return 0;
}
if (m_pSource->SkipToScanline(m_CurRow, pPause)) {
- return TRUE;
+ return true;
}
int Bpp = m_DestBpp / 8;
int rows_to_go = FX_STRECH_PAUSE_ROWS;
for (; m_CurRow < m_SrcClip.bottom; m_CurRow ++) {
if (rows_to_go == 0) {
if (pPause && pPause->NeedToPauseNow()) {
- return TRUE;
+ return true;
} else {
rows_to_go = FX_STRECH_PAUSE_ROWS;
}
@@ -533,7 +533,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause)
}
rows_to_go --;
}
- return FALSE;
+ return false;
}
void CStretchEngine::StretchVert()
{
@@ -698,7 +698,7 @@ FXDIB_Format _GetStretchedFormat(const CFX_DIBSource* pSrc)
}
return format;
}
-FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest,
+bool CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest,
const CFX_DIBSource* pSource, int dest_width, int dest_height,
const FX_RECT& rect, FX_DWORD flags)
{
@@ -723,7 +723,7 @@ FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest,
pal[i] = ArgbEncode(a, r, g, b);
}
if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) {
- return FALSE;
+ return false;
}
} else if (pSource->GetFormat() == FXDIB_1bppCmyk && pSource->GetPalette()) {
FX_CMYK pal[256];
@@ -738,10 +738,10 @@ FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest,
pal[i] = CmykEncode(c, m, y, k);
}
if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) {
- return FALSE;
+ return false;
}
} else if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, NULL)) {
- return FALSE;
+ return false;
}
if (flags & FXDIB_DOWNSAMPLE) {
return StartQuickStretch();
@@ -749,7 +749,7 @@ FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest,
return StartStretch();
}
}
-FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause)
+bool CFX_ImageStretcher::Continue(IFX_Pause* pPause)
{
if (m_Flags & FXDIB_DOWNSAMPLE) {
return ContinueQuickStretch(pPause);
@@ -758,39 +758,39 @@ FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause)
}
}
#define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000
-FX_BOOL CFX_ImageStretcher::StartStretch()
+bool CFX_ImageStretcher::StartStretch()
{
m_pStretchEngine = new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource, m_Flags);
m_pStretchEngine->StartStretchHorz();
if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) {
m_pStretchEngine->Continue(NULL);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause)
+bool CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause)
{
if (m_pStretchEngine == NULL) {
- return FALSE;
+ return false;
}
return m_pStretchEngine->Continue(pPause);
}
-FX_BOOL CFX_ImageStretcher::StartQuickStretch()
+bool CFX_ImageStretcher::StartQuickStretch()
{
- m_bFlipX = FALSE;
- m_bFlipY = FALSE;
+ m_bFlipX = false;
+ m_bFlipY = false;
if (m_DestWidth < 0) {
- m_bFlipX = TRUE;
+ m_bFlipX = true;
m_DestWidth = -m_DestWidth;
}
if (m_DestHeight < 0) {
- m_bFlipY = TRUE;
+ m_bFlipY = true;
m_DestHeight = -m_DestHeight;
}
m_LineIndex = 0;
FX_DWORD size = m_ClipRect.Width();
if (size && m_DestBPP > (int)(INT_MAX / size)) {
- return FALSE;
+ return false;
}
size *= m_DestBPP;
m_pScanline = FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4);
@@ -799,14 +799,14 @@ FX_BOOL CFX_ImageStretcher::StartQuickStretch()
}
if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) {
ContinueQuickStretch(NULL);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause)
+bool CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause)
{
if (m_pScanline == NULL) {
- return FALSE;
+ return false;
}
int result_width = m_ClipRect.Width(), result_height = m_ClipRect.Height();
int src_height = m_pSource->GetHeight();
@@ -826,7 +826,7 @@ FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause)
src_y = 0;
}
if (m_pSource->SkipToScanline(src_y, pPause)) {
- return TRUE;
+ return true;
}
m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width);
if (m_pMaskScanline) {
@@ -834,5 +834,5 @@ FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause)
}
m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline);
}
- return FALSE;
+ return false;
}
« no previous file with comments | « core/src/fxge/dib/fx_dib_convert.cpp ('k') | core/src/fxge/dib/fx_dib_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698