diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-07-27 11:55:29 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-07-27 11:55:29 -0700 |
commit | ff46aaf499edcf153ee2f57c7016587aa96dcfa0 (patch) | |
tree | 0a0d92713af476897899b126d180cc6294433d10 /core/src/fxge/agg | |
parent | aafeff816e22c1333c17d8a0eb4fe8927c28142d (diff) | |
download | pdfium-ff46aaf499edcf153ee2f57c7016587aa96dcfa0.tar.xz |
FX Bool considered harmful, part 3
Try to reland this patch after fixing underlying issues that
caused it to be reverted.
fx_system.h is the only manual edit.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1258093002 .
Diffstat (limited to 'core/src/fxge/agg')
-rw-r--r-- | core/src/fxge/agg/include/fx_agg_driver.h | 38 | ||||
-rw-r--r-- | core/src/fxge/agg/src/fx_agg_driver.cpp | 164 |
2 files changed, 101 insertions, 101 deletions
diff --git a/core/src/fxge/agg/include/fx_agg_driver.h b/core/src/fxge/agg/include/fx_agg_driver.h index 29b56c77e4..c8d620122e 100644 --- a/core/src/fxge/agg/include/fx_agg_driver.h +++ b/core/src/fxge/agg/include/fx_agg_driver.h @@ -22,7 +22,7 @@ public: class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { public: - CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout); + CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout); virtual ~CFX_AggDeviceDriver(); void InitPlatform(); void DestroyPlatform(); @@ -32,22 +32,22 @@ public: virtual void SaveState(); - virtual void RestoreState(FX_BOOL bKeepSaved); + virtual void RestoreState(bool bKeepSaved); - virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, + virtual bool SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, int fill_mode ); - virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, + virtual bool SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState ); - virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, + virtual bool DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, @@ -58,44 +58,44 @@ public: int blend_type ); - virtual FX_BOOL SetPixel(int x, int y, FX_DWORD color, + virtual bool SetPixel(int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform); - virtual FX_BOOL FillRect(const FX_RECT* pRect, + virtual bool FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, + virtual bool DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, FX_DWORD color, int alpha_flag, void* pIccTransform, int blend_type) { - return FALSE; + return false; } - virtual FX_BOOL GetClipBox(FX_RECT* pRect); + virtual bool GetClipBox(FX_RECT* pRect); - virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, FX_BOOL bDEdge = FALSE); + virtual bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, bool bDEdge = false); virtual CFX_DIBitmap* GetBackDrop() { return m_pOriDevice; } - virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, + virtual bool SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform); - virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, + virtual bool StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, + virtual bool StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, const CFX_AffineMatrix* pMatrix, FX_DWORD flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type); - virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); + virtual bool ContinueDIBits(void* handle, IFX_Pause* pPause); virtual void CancelDIBits(void* handle); - virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, + virtual bool DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, int alpha_flag, void* pIccTransform); - virtual FX_BOOL RenderRasterizer(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa)& rasterizer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, + virtual bool RenderRasterizer(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa)& rasterizer, FX_DWORD color, bool bFullCover, bool bGroupKnockout, int alpha_flag, void* pIccTransform); void SetClipMask(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa)& rasterizer); @@ -117,9 +117,9 @@ public: void* m_pDwRenderTartget; int m_FillFlags; int m_DitherBits; - FX_BOOL m_bRgbByteOrder; + bool m_bRgbByteOrder; CFX_DIBitmap* m_pOriDevice; - FX_BOOL m_bGroupKnockout; + bool m_bGroupKnockout; }; #endif // FX_AGG_DRIVER_H_ diff --git a/core/src/fxge/agg/src/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp index 118db7bf1f..2f96ef7379 100644 --- a/core/src/fxge/agg/src/fx_agg_driver.cpp +++ b/core/src/fxge/agg/src/fx_agg_driver.cpp @@ -119,7 +119,7 @@ private: static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, agg::path_storage& path_data, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_FLOAT scale = 1.0f, - FX_BOOL bStrokeAdjust = FALSE, FX_BOOL bTextMode = FALSE) + bool bStrokeAdjust = false, bool bTextMode = false) { agg::line_cap_e cap; switch (pGraphState->m_LineCap) { @@ -185,11 +185,11 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, agg::path_s rasterizer.add_path_transformed(stroke, pObject2Device); } } -IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver(CFX_DIBitmap* pBitmap, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) +IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver(CFX_DIBitmap* pBitmap, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout) { return new CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice, bGroupKnockout); } -CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) +CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout) { m_pBitmap = pBitmap; m_DitherBits = dither_bits; @@ -217,11 +217,11 @@ void CFX_AggDeviceDriver::InitPlatform() void CFX_AggDeviceDriver::DestroyPlatform() { } -FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, +bool CFX_AggDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, int alpha_flag, void* pIccTransform) { - return FALSE; + return false; } #endif int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) @@ -267,7 +267,7 @@ void CFX_AggDeviceDriver::SaveState() } m_StateStack.Add(pClip); } -void CFX_AggDeviceDriver::RestoreState(FX_BOOL bKeepSaved) +void CFX_AggDeviceDriver::RestoreState(bool bKeepSaved) { if (m_StateStack.GetSize() == 0) { delete m_pClipRgn; @@ -307,7 +307,7 @@ void CFX_AggDeviceDriver::SetClipMask(agg::rasterizer_scanline_aa& rasterizer) agg::render_scanlines(rasterizer, scanline, final_render, (m_FillFlags & FXFILL_NOPATHSMOOTH) != 0); m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask); } -FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, +bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, int fill_mode ) @@ -322,7 +322,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, rectf.Intersect(CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); FX_RECT rect = rectf.GetOutterRect(); m_pClipRgn->IntersectRect(rect); - return TRUE; + return true; } } CAgg_PathData path_data; @@ -333,9 +333,9 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, rasterizer.add_path(path_data.m_PathData); rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_non_zero : agg::fill_even_odd); SetClipMask(rasterizer); - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, +bool CFX_AggDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState ) @@ -350,7 +350,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, RasterizeStroke(rasterizer, path_data.m_PathData, pObject2Device, pGraphState); rasterizer.filling_rule(agg::fill_non_zero); SetClipMask(rasterizer); - return TRUE; + return true; } class CFX_Renderer { @@ -361,8 +361,8 @@ private: m_Blue, m_Gray; FX_DWORD m_Color; - FX_BOOL m_bFullCover; - FX_BOOL m_bRgbByteOrder; + bool m_bFullCover; + bool m_bRgbByteOrder; CFX_DIBitmap* m_pOriDevice; FX_RECT m_ClipBox; const CFX_DIBitmap* m_pClipMask; @@ -371,7 +371,7 @@ private: void (CFX_Renderer::*composite_span)(uint8_t*, int, int, int, uint8_t*, int, int, uint8_t*, uint8_t*); public: void prepare(unsigned) {} - void CompositeSpan(uint8_t* dest_scan, uint8_t* ori_scan, int Bpp, FX_BOOL bDestAlpha, + void CompositeSpan(uint8_t* dest_scan, uint8_t* ori_scan, int Bpp, bool bDestAlpha, int span_left, int span_len, uint8_t* cover_scan, int clip_left, int clip_right, uint8_t* clip_scan) { @@ -955,7 +955,7 @@ public: ori_scan = m_pOriDevice->GetBuffer() + m_pOriDevice->GetPitch() * y; } int Bpp = m_pDevice->GetBPP() / 8; - FX_BOOL bDestAlpha = m_pDevice->HasAlpha() || m_pDevice->IsAlphaMask(); + bool bDestAlpha = m_pDevice->HasAlpha() || m_pDevice->IsAlphaMask(); unsigned num_spans = sl.num_spans(); typename Scanline::const_iterator span = sl.begin(); while (1) { @@ -988,7 +988,7 @@ public: } } - FX_BOOL Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRgbByteOrder, + bool Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, bool bFullCover, bool bRgbByteOrder, int alpha_flag = 0, void* pIccTransform = NULL) { m_pDevice = pDevice; @@ -1008,8 +1008,8 @@ public: m_pClipMask = m_pClipRgn->GetMask(); } m_bFullCover = bFullCover; - FX_BOOL bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag); - FX_BOOL bDeviceCMYK = pDevice->IsCmykImage(); + bool bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag); + bool bDeviceCMYK = pDevice->IsCmykImage(); m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); ICodec_IccModule* pIccModule = NULL; if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { @@ -1039,7 +1039,7 @@ public: } } } - return TRUE; + return true; } if (bDeviceCMYK) { ASSERT(!m_bRgbByteOrder); @@ -1051,7 +1051,7 @@ public: } } else { if (!pIccTransform) { - return FALSE; + return false; } color = FXARGB_TODIB(color); pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); @@ -1100,22 +1100,22 @@ public: if (m_pDevice->GetBPP() == 1) { composite_span = &CFX_Renderer::CompositeSpan1bpp; } - return TRUE; + return true; } }; -FX_BOOL CFX_AggDeviceDriver::RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, +bool CFX_AggDeviceDriver::RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer, FX_DWORD color, bool bFullCover, bool bGroupKnockout, int alpha_flag, void* pIccTransform) { CFX_DIBitmap* pt = bGroupKnockout ? m_pOriDevice : NULL; CFX_Renderer render; if (!render.Init(m_pBitmap, pt, m_pClipRgn, color, bFullCover, m_bRgbByteOrder, alpha_flag, pIccTransform)) { - return FALSE; + return false; } agg::scanline_u8 scanline; agg::render_scanlines(rasterizer, scanline, render, (m_FillFlags & FXFILL_NOPATHSMOOTH) != 0); - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, +bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device, const CFX_GraphStateData* pGraphState, FX_DWORD fill_color, @@ -1127,10 +1127,10 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, ) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } if (GetBuffer() == NULL) { - return TRUE; + return true; } m_FillFlags = fill_mode; if ((fill_mode & 3) && fill_color) { @@ -1140,8 +1140,8 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); rasterizer.add_path(path_data.m_PathData); rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_non_zero : agg::fill_even_odd); - if (!RenderRasterizer(rasterizer, fill_color, fill_mode & FXFILL_FULLCOVER, FALSE, alpha_flag, pIccTransform)) { - return FALSE; + if (!RenderRasterizer(rasterizer, fill_color, fill_mode & FXFILL_FULLCOVER, false, alpha_flag, pIccTransform)) { + return false; } } int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_STROKE(alpha_flag) : FXARGB_A(stroke_color); @@ -1151,12 +1151,12 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, path_data.BuildPath(pPathData, pObject2Device); agg::rasterizer_scanline_aa rasterizer; rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); - RasterizeStroke(rasterizer, path_data.m_PathData, NULL, pGraphState, 1, FALSE, fill_mode & FX_STROKE_TEXT_MODE); + RasterizeStroke(rasterizer, path_data.m_PathData, NULL, pGraphState, 1, false, fill_mode & FX_STROKE_TEXT_MODE); int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 | FXGETFLAG_ALPHA_STROKE(alpha_flag); if (!RenderRasterizer(rasterizer, stroke_color, fill_mode & FXFILL_FULLCOVER, m_bGroupKnockout, fill_flag, pIccTransform)) { - return FALSE; + return false; } - return TRUE; + return true; } CFX_AffineMatrix matrix1, matrix2; if (pObject2Device) { @@ -1174,13 +1174,13 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, path_data.BuildPath(pPathData, &matrix1); agg::rasterizer_scanline_aa rasterizer; rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); - RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState, matrix1.a, FALSE, fill_mode & FX_STROKE_TEXT_MODE); + RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState, matrix1.a, false, fill_mode & FX_STROKE_TEXT_MODE); int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 | FXGETFLAG_ALPHA_STROKE(alpha_flag); if (!RenderRasterizer(rasterizer, stroke_color, fill_mode & FXFILL_FULLCOVER, m_bGroupKnockout, fill_flag, pIccTransform)) { - return FALSE; + return false; } } - return TRUE; + return true; } void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, FX_DWORD argb) { @@ -1208,7 +1208,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid width = rect.Width(); int src_r = FXARGB_R(argb), src_g = FXARGB_G(argb), src_b = FXARGB_B(argb); int Bpp = pBitmap->GetBPP() / 8; - FX_BOOL bAlpha = pBitmap->HasAlpha(); + bool bAlpha = pBitmap->HasAlpha(); int dib_argb = FXARGB_TOBGRORDERDIB(argb); uint8_t* pBuffer = pBitmap->GetBuffer(); if (src_alpha == 255) { @@ -1317,7 +1317,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t } } } else { - ASSERT(FALSE); + ASSERT(false); } } else if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) { if (src_format == FXDIB_Rgb) { @@ -1351,7 +1351,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t } } } else { - ASSERT(FALSE); + ASSERT(false); } } FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) @@ -1361,9 +1361,9 @@ FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) r, g, b); return ArgbEncode(alpha, r, g, b); } -FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) +bool _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) { - FX_BOOL bObjCMYK = FXGETFLAG_COLORTYPE(alpha_flag); + bool bObjCMYK = FXGETFLAG_COLORTYPE(alpha_flag); int alpha = bObjCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); if (pIccTransform) { ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); @@ -1376,7 +1376,7 @@ FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int al } else { if (pDevice->IsCmykImage()) { if (!bObjCMYK) { - return FALSE; + return false; } } else { if (bObjCMYK) { @@ -1388,12 +1388,12 @@ FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int al if (pDevice->m_pAlphaMask) { pDevice->m_pAlphaMask->SetPixel(x, y, alpha << 24); } - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) +bool CFX_AggDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { pIccTransform = NULL; @@ -1413,12 +1413,12 @@ FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_fl } } else if (m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) { const CFX_DIBitmap* pMask = m_pClipRgn->GetMask(); - FX_BOOL bCMYK = FXGETFLAG_COLORTYPE(alpha_flag); + bool bCMYK = FXGETFLAG_COLORTYPE(alpha_flag); int new_alpha = bCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); new_alpha = new_alpha * pMask->GetScanline(y)[x] / 255; if (m_bRgbByteOrder) { RgbByteOrderSetPixel(m_pBitmap, x, y, (color & 0xffffff) | (new_alpha << 24)); - return TRUE; + return true; } if (bCMYK) { FXSETFLAG_ALPHA_FILL(alpha_flag, new_alpha); @@ -1428,15 +1428,15 @@ FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_fl return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform); } } - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type) +bool CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) { - return FALSE; + return false; } if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } FX_RECT clip_rect; GetClipBox(&clip_rect); @@ -1445,7 +1445,7 @@ FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, draw_rect.Intersect(*pRect); } if (draw_rect.IsEmpty()) { - return TRUE; + return true; } if (m_pClipRgn == NULL || m_pClipRgn->GetType() == CFX_ClipRgn::RectI) { if (m_bRgbByteOrder) { @@ -1453,27 +1453,27 @@ FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, } else { m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(), fill_color, alpha_flag, pIccTransform); } - return TRUE; + return true; } m_pBitmap->CompositeMask(draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(), (const CFX_DIBitmap*)m_pClipRgn->GetMask(), fill_color, draw_rect.left - clip_rect.left, draw_rect.top - clip_rect.top, FXDIB_BLEND_NORMAL, NULL, m_bRgbByteOrder, alpha_flag, pIccTransform); - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) +bool CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) { if (m_pClipRgn == NULL) { pRect->left = pRect->top = 0; pRect->right = GetDeviceCaps(FXDC_PIXEL_WIDTH); pRect->bottom = GetDeviceCaps(FXDC_PIXEL_HEIGHT); - return TRUE; + return true; } *pRect = m_pClipRgn->GetBox(); - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform, FX_BOOL bDEdge) +bool CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform, bool bDEdge) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } if (bDEdge) { if (m_bRgbByteOrder) { @@ -1481,23 +1481,23 @@ FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, } else { return pBitmap->TransferBitmap(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight(), m_pBitmap, left, top, pIccTransform); } - return TRUE; + return true; } FX_RECT rect(left, top, left + pBitmap->GetWidth(), top + pBitmap->GetHeight()); CFX_DIBitmap *pBack = NULL; if (m_pOriDevice) { pBack = m_pOriDevice->Clone(&rect); if (!pBack) { - return TRUE; + return true; } pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(), m_pBitmap, 0, 0); } else { pBack = m_pBitmap->Clone(&rect); } if (!pBack) { - return TRUE; + return true; } - FX_BOOL bRet = TRUE; + bool bRet = true; left = left >= 0 ? 0 : left; top = top >= 0 ? 0 : top; if (m_bRgbByteOrder) { @@ -1508,11 +1508,11 @@ FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, delete pBack; return bRet; } -FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD argb, const FX_RECT* pSrcRect, int left, int top, int blend_type, +bool CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD argb, const FX_RECT* pSrcRect, int left, int top, int blend_type, int alpha_flag, void* pIccTransform) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } if (pBitmap->IsAlphaMask()) return m_pBitmap->CompositeMask(left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb, @@ -1520,12 +1520,12 @@ FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD ar return m_pBitmap->CompositeBitmap(left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder, pIccTransform); } -FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD argb, int dest_left, int dest_top, +bool CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD argb, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, int alpha_flag, void* pIccTransform, int blend_type) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } if (dest_width == pSource->GetWidth() && dest_height == pSource->GetHeight()) { FX_RECT rect(0, 0, dest_width, dest_height); @@ -1536,30 +1536,30 @@ FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWOR FX_RECT dest_clip = dest_rect; dest_clip.Intersect(*pClipRect); CFX_BitmapComposer composer; - composer.Compose(m_pBitmap, m_pClipRgn, 255, argb, dest_clip, FALSE, FALSE, FALSE, m_bRgbByteOrder, alpha_flag, pIccTransform, blend_type); + composer.Compose(m_pBitmap, m_pClipRgn, 255, argb, dest_clip, false, false, false, m_bRgbByteOrder, alpha_flag, pIccTransform, blend_type); dest_clip.Offset(-dest_rect.left, -dest_rect.top); CFX_ImageStretcher stretcher; if (stretcher.Start(&composer, pSource, dest_width, dest_height, dest_clip, flags)) { stretcher.Continue(NULL); } - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD argb, +bool CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, FX_DWORD argb, const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, int alpha_flag, void* pIccTransform, int blend_type) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; pRenderer->Start(m_pBitmap, m_pClipRgn, pSource, bitmap_alpha, argb, pMatrix, render_flags, m_bRgbByteOrder, alpha_flag, pIccTransform); handle = pRenderer; - return TRUE; + return true; } -FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) +bool CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { if (m_pBitmap->GetBuffer() == NULL) { - return TRUE; + return true; } return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); } @@ -1572,30 +1572,30 @@ void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) } CFX_FxgeDevice::CFX_FxgeDevice() { - m_bOwnedBitmap = FALSE; + m_bOwnedBitmap = false; } -FX_BOOL CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) +bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout) { if (pBitmap == NULL) { - return FALSE; + return false; } SetBitmap(pBitmap); IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout); SetDeviceDriver(pDriver); - return TRUE; + return true; } -FX_BOOL CFX_FxgeDevice::Create(int width, int height, FXDIB_Format format, int dither_bits, CFX_DIBitmap* pOriDevice) +bool CFX_FxgeDevice::Create(int width, int height, FXDIB_Format format, int dither_bits, CFX_DIBitmap* pOriDevice) { - m_bOwnedBitmap = TRUE; + m_bOwnedBitmap = true; CFX_DIBitmap* pBitmap = new CFX_DIBitmap; if (!pBitmap->Create(width, height, format)) { delete pBitmap; - return FALSE; + return false; } SetBitmap(pBitmap); - IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); + IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, false, pOriDevice, false); SetDeviceDriver(pDriver); - return TRUE; + return true; } CFX_FxgeDevice::~CFX_FxgeDevice() { |