diff options
author | Nicolas Pena <npm@chromium.org> | 2017-06-29 17:02:48 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-29 21:54:18 +0000 |
commit | caf6d61fbb38083f213a9d3441e12c5082d3ad3a (patch) | |
tree | ddfaf73e97af75ac862dddc34b47603d5492cfa1 /core/fxge/dib/cfx_imagerenderer.cpp | |
parent | cd984752d05a58c0bd6f8ddd740d5cd4bfca20c6 (diff) | |
download | pdfium-caf6d61fbb38083f213a9d3441e12c5082d3ad3a.tar.xz |
Move Start to constructor in CFX_Image(Renderer|Transformer)chromium/3145
The bool returned by Start was not being used and the method was always
called right after the constructor, so it should be in the constructor.
Change-Id: I98abf9f7c11fbe42b3aa15ec5e46731198aa23d5
Reviewed-on: https://pdfium-review.googlesource.com/7151
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxge/dib/cfx_imagerenderer.cpp')
-rw-r--r-- | core/fxge/dib/cfx_imagerenderer.cpp | 66 |
1 files changed, 28 insertions, 38 deletions
diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp index ec611cacbe..db3fe02bd5 100644 --- a/core/fxge/dib/cfx_imagerenderer.cpp +++ b/core/fxge/dib/cfx_imagerenderer.cpp @@ -13,39 +13,30 @@ #include "core/fxge/ge/cfx_cliprgn.h" #include "third_party/base/ptr_util.h" -CFX_ImageRenderer::CFX_ImageRenderer() - : m_Status(0), - m_bRgbByteOrder(false), - m_BlendType(FXDIB_BLEND_NORMAL) {} - -CFX_ImageRenderer::~CFX_ImageRenderer() {} - -bool CFX_ImageRenderer::Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice, - const CFX_ClipRgn* pClipRgn, - const CFX_RetainPtr<CFX_DIBSource>& pSource, - int bitmap_alpha, - uint32_t mask_color, - const CFX_Matrix* pMatrix, - uint32_t dib_flags, - bool bRgbByteOrder) { - m_Matrix = *pMatrix; - CFX_FloatRect image_rect_f = m_Matrix.GetUnitRect(); - FX_RECT image_rect = image_rect_f.GetOuterRect(); +CFX_ImageRenderer::CFX_ImageRenderer( + const CFX_RetainPtr<CFX_DIBitmap>& pDevice, + const CFX_ClipRgn* pClipRgn, + const CFX_RetainPtr<CFX_DIBSource>& pSource, + int bitmap_alpha, + uint32_t mask_color, + const CFX_Matrix* pMatrix, + uint32_t dib_flags, + bool bRgbByteOrder) + : m_pDevice(pDevice), + m_pClipRgn(pClipRgn), + m_Matrix(*pMatrix), + m_BitmapAlpha(bitmap_alpha), + m_BlendType(FXDIB_BLEND_NORMAL), + m_bRgbByteOrder(bRgbByteOrder), + m_MaskColor(mask_color), + m_Status(0), + m_AlphaFlag(0) { + FX_RECT image_rect = m_Matrix.GetUnitRect().GetOuterRect(); m_ClipBox = pClipRgn ? pClipRgn->GetBox() : FX_RECT(0, 0, pDevice->GetWidth(), pDevice->GetHeight()); m_ClipBox.Intersect(image_rect); if (m_ClipBox.IsEmpty()) - return false; - - m_pDevice = pDevice; - m_pClipRgn = pClipRgn; - m_MaskColor = mask_color; - m_BitmapAlpha = bitmap_alpha; - m_Matrix = *pMatrix; - m_Flags = dib_flags; - m_AlphaFlag = 0; - m_bRgbByteOrder = bRgbByteOrder; - m_BlendType = FXDIB_BLEND_NORMAL; + return; if ((fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) || (fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0)) { @@ -64,17 +55,14 @@ bool CFX_ImageRenderer::Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice, m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( &m_Composer, pSource, dest_height, dest_width, bitmap_clip, dib_flags); - if (!m_Stretcher->Start()) - return false; - - m_Status = 1; - return true; + if (m_Stretcher->Start()) + m_Status = 1; + return; } m_Status = 2; m_pTransformer = pdfium::MakeUnique<CFX_ImageTransformer>( pSource, &m_Matrix, dib_flags, &m_ClipBox); - m_pTransformer->Start(); - return true; + return; } int dest_width = image_rect.Width(); @@ -86,7 +74,7 @@ bool CFX_ImageRenderer::Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice, dest_height = -dest_height; if (dest_width == 0 || dest_height == 0) - return false; + return; FX_RECT bitmap_clip = m_ClipBox; bitmap_clip.Offset(-image_rect.left, -image_rect.top); @@ -95,9 +83,11 @@ bool CFX_ImageRenderer::Start(const CFX_RetainPtr<CFX_DIBitmap>& pDevice, m_Status = 1; m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( &m_Composer, pSource, dest_width, dest_height, bitmap_clip, dib_flags); - return m_Stretcher->Start(); + m_Stretcher->Start(); } +CFX_ImageRenderer::~CFX_ImageRenderer() {} + bool CFX_ImageRenderer::Continue(IFX_Pause* pPause) { if (m_Status == 1) return m_Stretcher->Continue(pPause); |