diff options
author | tsepez <tsepez@chromium.org> | 2016-11-02 15:17:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-02 15:17:30 -0700 |
commit | 12f3e4a58f05850b93af35619cb04f0231d86acc (patch) | |
tree | 9851d8e46e5c168f5d148864caa2eebf814529dd /core/fxge/skia | |
parent | 3b3ce1a242f8445848d3f23d6c35ba01d7c645f4 (diff) | |
download | pdfium-12f3e4a58f05850b93af35619cb04f0231d86acc.tar.xz |
Remove FX_BOOL from core
Review-Url: https://codereview.chromium.org/2477443002
Diffstat (limited to 'core/fxge/skia')
-rw-r--r-- | core/fxge/skia/fx_skia_device.cpp | 152 | ||||
-rw-r--r-- | core/fxge/skia/fx_skia_device.h | 118 |
2 files changed, 134 insertions, 136 deletions
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index f3349c906a..5e91fbd8c3 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -942,9 +942,9 @@ void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint, } CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, - FX_BOOL bRgbByteOrder, + bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, - FX_BOOL bGroupKnockout) + bool bGroupKnockout) : m_pBitmap(pBitmap), m_pOriDevice(pOriDevice), m_pRecorder(nullptr), @@ -969,7 +969,7 @@ CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y) m_pOriDevice(nullptr), m_pRecorder(new SkPictureRecorder), m_pCache(new SkiaState), - m_bGroupKnockout(FALSE) { + m_bGroupKnockout(false) { m_pRecorder->beginRecording(SkIntToScalar(size_x), SkIntToScalar(size_y)); m_pCanvas = m_pRecorder->getRecordingCanvas(); } @@ -979,7 +979,7 @@ CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(SkPictureRecorder* recorder) m_pOriDevice(nullptr), m_pRecorder(recorder), m_pCache(new SkiaState), - m_bGroupKnockout(FALSE) { + m_bGroupKnockout(false) { m_pCanvas = m_pRecorder->getRecordingCanvas(); } @@ -994,15 +994,15 @@ void CFX_SkiaDeviceDriver::Flush() { m_pCache->FlushCommands(this); } -FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, - uint32_t color) { +bool CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + const CFX_Matrix* pObject2Device, + FX_FLOAT font_size, + uint32_t color) { if (m_pCache->DrawText(nChars, pCharPos, pFont, pObject2Device, font_size, color, this)) { - return TRUE; + return true; } sk_sp<SkTypeface> typeface(SkSafeRef(pFont->GetDeviceCache())); SkPaint paint; @@ -1028,7 +1028,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, } m_pCanvas->drawPosText(glyphs.begin(), nChars * 2, positions.begin(), paint); m_pCanvas->restore(); - return TRUE; + return true; } int CFX_SkiaDeviceDriver::GetDeviceCaps(int caps_id) const { @@ -1064,7 +1064,7 @@ void CFX_SkiaDeviceDriver::RestoreState(bool bKeepSaved) { SaveState(); } -FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill( +bool CFX_SkiaDeviceDriver::SetClip_PathFill( const CFX_PathData* pPathData, // path info const CFX_Matrix* pObject2Device, // flips object's y-axis int fill_mode // fill mode, WINDING or ALTERNATE @@ -1072,7 +1072,7 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill( CFX_Matrix identity; const CFX_Matrix* deviceMatrix = pObject2Device ? pObject2Device : &identity; if (m_pCache->SetClipFill(pPathData, deviceMatrix, fill_mode, this)) - return TRUE; + return true; if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { CFX_FloatRect rectf; if (pPathData->IsRect(deviceMatrix, &rectf)) { @@ -1084,7 +1084,7 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill( SkRect::MakeLTRB(rectf.left, rectf.bottom, rectf.right, rectf.top); DebugDrawSkiaClipRect(m_pCanvas, skClipRect); m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true); - return TRUE; + return true; } } SkPath skClipPath = BuildPath(pPathData); @@ -1097,16 +1097,16 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill( DebugDrawSkiaClipPath(m_pCanvas, skClipPath); m_pCanvas->clipPath(skClipPath, SkCanvas::kIntersect_Op, true); - return TRUE; + return true; } -FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke( +bool CFX_SkiaDeviceDriver::SetClip_PathStroke( const CFX_PathData* pPathData, // path info const CFX_Matrix* pObject2Device, // optional transformation const CFX_GraphStateData* pGraphState // graphic state, for pen attributes ) { if (m_pCache->SetClipStroke(pPathData, pObject2Device, pGraphState, this)) - return TRUE; + return true; // build path data SkPath skPath = BuildPath(pPathData); SkMatrix skMatrix = ToSkMatrix(*pObject2Device); @@ -1117,10 +1117,10 @@ FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke( dst_path.transform(skMatrix); DebugDrawSkiaClipPath(m_pCanvas, dst_path); m_pCanvas->clipPath(dst_path, SkCanvas::kIntersect_Op, true); - return TRUE; + return true; } -FX_BOOL CFX_SkiaDeviceDriver::DrawPath( +bool CFX_SkiaDeviceDriver::DrawPath( const CFX_PathData* pPathData, // path info const CFX_Matrix* pObject2Device, // optional transformation const CFX_GraphStateData* pGraphState, // graphic state, for pen attributes @@ -1130,7 +1130,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath( int blend_type) { if (m_pCache->DrawPath(pPathData, pObject2Device, pGraphState, fill_color, stroke_color, fill_mode, blend_type, this)) { - return TRUE; + return true; } SkIRect rect; rect.set(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), @@ -1177,21 +1177,21 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath( m_pCanvas->drawPath(skPath, skPaint); } m_pCanvas->restore(); - return TRUE; + return true; } -FX_BOOL CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - uint32_t color, - int blend_type) { - return FALSE; +bool CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, + uint32_t color, + int blend_type) { + return false; } -FX_BOOL CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, - uint32_t fill_color, - int blend_type) { +bool CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, + uint32_t fill_color, + int blend_type) { SkPaint spaint; spaint.setAntiAlias(true); spaint.setColor(fill_color); @@ -1200,14 +1200,14 @@ FX_BOOL CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, m_pCanvas->drawRect( SkRect::MakeLTRB(pRect->left, pRect->top, pRect->right, pRect->bottom), spaint); - return TRUE; + return true; } -FX_BOOL CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, - const CFX_Matrix* pMatrix, - const FX_RECT& clip_rect, - int alpha, - FX_BOOL bAlphaMode) { +bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, + const CFX_Matrix* pMatrix, + const FX_RECT& clip_rect, + int alpha, + bool bAlphaMode) { if (kAxialShading != pPattern->GetShadingType() && kRadialShading != pPattern->GetShadingType()) { // TODO(caryclark) more types @@ -1341,24 +1341,22 @@ uint8_t* CFX_SkiaDeviceDriver::GetBuffer() const { return m_pBitmap->GetBuffer(); } -FX_BOOL CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) { +bool CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) { // TODO(caryclark) call m_canvas->getClipDeviceBounds() instead pRect->left = 0; pRect->top = 0; const SkImageInfo& canvasSize = m_pCanvas->imageInfo(); pRect->right = canvasSize.width(); pRect->bottom = canvasSize.height(); - return TRUE; + return true; } -FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, - int left, - int top) { +bool CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { if (!m_pBitmap) - return TRUE; + return true; uint8_t* srcBuffer = m_pBitmap->GetBuffer(); if (!srcBuffer) - return TRUE; + return true; int srcWidth = m_pBitmap->GetWidth(); int srcHeight = m_pBitmap->GetHeight(); int srcRowBytes = srcWidth * sizeof(uint32_t); @@ -1380,21 +1378,21 @@ FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, nullptr, nullptr); SkCanvas canvas(skDstBitmap); canvas.drawBitmap(skSrcBitmap, left, top, nullptr); - return TRUE; + return true; } CFX_DIBitmap* CFX_SkiaDeviceDriver::GetBackDrop() { return m_pOriDevice; } -FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, - uint32_t argb, - const FX_RECT* pSrcRect, - int left, - int top, - int blend_type) { +bool CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, + uint32_t argb, + const FX_RECT* pSrcRect, + int left, + int top, + int blend_type) { if (!m_pBitmap || !m_pBitmap->GetBuffer()) - return TRUE; + return true; CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left, top + pBitmap->GetHeight()); @@ -1402,17 +1400,17 @@ FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, return StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, blend_type); } -FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, - uint32_t argb, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) { +bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, + uint32_t argb, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) { if (!m_pBitmap->GetBuffer()) - return TRUE; + return true; CFX_Matrix m(dest_width, 0, 0, -dest_height, dest_left, dest_top + dest_height); @@ -1421,19 +1419,19 @@ FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, pClipRect->right, pClipRect->top); m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true); void* dummy; - FX_BOOL result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type); + bool result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type); m_pCanvas->restore(); return result; } -FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, - int bitmap_alpha, - uint32_t argb, - const CFX_Matrix* pMatrix, - uint32_t render_flags, - void*& handle, - int blend_type) { +bool CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, + int bitmap_alpha, + uint32_t argb, + const CFX_Matrix* pMatrix, + uint32_t render_flags, + void*& handle, + int blend_type) { DebugValidate(m_pBitmap, m_pOriDevice); SkColorTable* ct = nullptr; std::unique_ptr<uint8_t, FxFreeDeleter> dst8Storage; @@ -1442,7 +1440,7 @@ FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int width, height; if (!Upsample(pSource, dst8Storage, dst32Storage, &ct, &skBitmap, &width, &height, false)) { - return FALSE; + return false; } m_pCanvas->save(); SkMatrix skMatrix; @@ -1472,11 +1470,11 @@ FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, if (ct) ct->unref(); DebugValidate(m_pBitmap, m_pOriDevice); - return TRUE; + return true; } -FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) { - return FALSE; +bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) { + return false; } void CFX_SkiaDeviceDriver::PreMultiply(CFX_DIBitmap* pDIBitmap) { @@ -1573,7 +1571,7 @@ void CFX_SkiaDeviceDriver::DebugVerifyBitmapIsPreMultiplied() const { } CFX_FxgeDevice::CFX_FxgeDevice() { - m_bOwnedBitmap = FALSE; + m_bOwnedBitmap = false; } void CFX_FxgeDevice::Clear(uint32_t color) { @@ -1611,7 +1609,7 @@ bool CFX_FxgeDevice::Create(int width, int height, FXDIB_Format format, CFX_DIBitmap* pOriDevice) { - m_bOwnedBitmap = TRUE; + m_bOwnedBitmap = true; CFX_DIBitmap* pBitmap = new CFX_DIBitmap; if (!pBitmap->Create(width, height, format)) { delete pBitmap; diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h index eb5063aafb..199e76689a 100644 --- a/core/fxge/skia/fx_skia_device.h +++ b/core/fxge/skia/fx_skia_device.h @@ -22,9 +22,9 @@ struct SkIRect; class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { public: CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, - FX_BOOL bRgbByteOrder, + bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, - FX_BOOL bGroupKnockout); + bool bGroupKnockout); explicit CFX_SkiaDeviceDriver(SkPictureRecorder* recorder); CFX_SkiaDeviceDriver(int size_x, int size_y); ~CFX_SkiaDeviceDriver() override; @@ -37,13 +37,13 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { void RestoreState(bool bKeepSaved) override; /** Set clipping path using filled region */ - FX_BOOL SetClip_PathFill( + bool SetClip_PathFill( const CFX_PathData* pPathData, // path info const CFX_Matrix* pObject2Device, // optional transformation int fill_mode) override; // fill mode, WINDING or ALTERNATE /** Set clipping path using stroked region */ - FX_BOOL SetClip_PathStroke( + bool SetClip_PathStroke( const CFX_PathData* pPathData, // path info const CFX_Matrix* pObject2Device, // optional transformation const CFX_GraphStateData* @@ -51,64 +51,64 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { override; /** Draw a path */ - FX_BOOL DrawPath(const CFX_PathData* pPathData, - const CFX_Matrix* pObject2Device, - const CFX_GraphStateData* pGraphState, - uint32_t fill_color, - uint32_t stroke_color, - int fill_mode, - int blend_type) override; - - FX_BOOL FillRectWithBlend(const FX_RECT* pRect, - uint32_t fill_color, - int blend_type) override; + bool DrawPath(const CFX_PathData* pPathData, + const CFX_Matrix* pObject2Device, + const CFX_GraphStateData* pGraphState, + uint32_t fill_color, + uint32_t stroke_color, + int fill_mode, + int blend_type) override; + + bool FillRectWithBlend(const FX_RECT* pRect, + uint32_t fill_color, + int blend_type) override; /** Draw a single pixel (device dependant) line */ - FX_BOOL DrawCosmeticLine(FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - uint32_t color, - int blend_type) override; + bool DrawCosmeticLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2, + uint32_t color, + int blend_type) override; - FX_BOOL GetClipBox(FX_RECT* pRect) override; + bool GetClipBox(FX_RECT* pRect) override; /** Load device buffer into a DIB */ - FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; + bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; CFX_DIBitmap* GetBackDrop() override; - FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - const FX_RECT* pSrcRect, - int dest_left, - int dest_top, - int blend_type) override; + bool SetDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + const FX_RECT* pSrcRect, + int dest_left, + int dest_top, + int blend_type) override; bool SetBitsWithMask(const CFX_DIBSource* pBitmap, const CFX_DIBSource* pMask, int dest_left, int dest_top, int bitmap_alpha, int blend_type) override; - FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) override; - - FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, - int bitmap_alpha, - uint32_t color, - const CFX_Matrix* pMatrix, - uint32_t flags, - void*& handle, - int blend_type) override; + bool StretchDIBits(const CFX_DIBSource* pBitmap, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) override; + + bool StartDIBits(const CFX_DIBSource* pBitmap, + int bitmap_alpha, + uint32_t color, + const CFX_Matrix* pMatrix, + uint32_t flags, + void*& handle, + int blend_type) override; - FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override; + bool ContinueDIBits(void* handle, IFX_Pause* pPause) override; void CancelDIBits(void* handle) override {} @@ -118,18 +118,18 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { const CFX_Matrix* pMatrix, int blend_type); - FX_BOOL DrawDeviceText(int nChars, - const FXTEXT_CHARPOS* pCharPos, - CFX_Font* pFont, - const CFX_Matrix* pObject2Device, - FX_FLOAT font_size, - uint32_t color) override; + bool DrawDeviceText(int nChars, + const FXTEXT_CHARPOS* pCharPos, + CFX_Font* pFont, + const CFX_Matrix* pObject2Device, + FX_FLOAT font_size, + uint32_t color) override; - FX_BOOL DrawShading(const CPDF_ShadingPattern* pPattern, - const CFX_Matrix* pMatrix, - const FX_RECT& clip_rect, - int alpha, - FX_BOOL bAlphaMode) override; + bool DrawShading(const CPDF_ShadingPattern* pPattern, + const CFX_Matrix* pMatrix, + const FX_RECT& clip_rect, + int alpha, + bool bAlphaMode) override; virtual uint8_t* GetBuffer() const; @@ -152,7 +152,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { SkCanvas* m_pCanvas; SkPictureRecorder* const m_pRecorder; std::unique_ptr<SkiaState> m_pCache; - FX_BOOL m_bGroupKnockout; + bool m_bGroupKnockout; }; #endif // defined(_SKIA_SUPPORT_) |