diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-29 11:24:29 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-29 11:24:29 -0800 |
commit | d5e7b355b8c4c22ff770547797cbc536bdc95d5b (patch) | |
tree | 4c0607b1701f23753a71b42c02b74764dd4bfd38 /core/src/fpdfapi/fpdf_render | |
parent | a74e9c9d3b0d98c5d6042d7ca739cd921a4524db (diff) | |
download | pdfium-d5e7b355b8c4c22ff770547797cbc536bdc95d5b.tar.xz |
Fixup FX_RECT and FX_SMALL_RECT classes.
Put these first, so later on more complicated classes can
have constructors that take these as arguments.
Add better constructors, and call appropriately. Also don't
be afraid to return these from methods since RVO.
R=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/1745683002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_render')
-rw-r--r-- | core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index a470e94b86..4c7abea30c 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -240,7 +240,7 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, void CPDF_RenderStatus::RenderObjectList( const CPDF_PageObjectHolder* pObjectHolder, const CFX_Matrix* pObj2Device) { - CFX_FloatRect clip_rect = m_pDevice->GetClipBox(); + CFX_FloatRect clip_rect(m_pDevice->GetClipBox()); CFX_Matrix device2object; device2object.SetReverse(*pObj2Device); device2object.TransformRect(clip_rect); @@ -1059,7 +1059,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { m_pContext, m_pDevice, NULL, NULL, NULL, NULL, m_pOptions, m_pCurrentLayer->m_pObjectHolder->m_Transparency, FALSE, NULL); m_pDevice->SaveState(); - m_ClipRect = m_pDevice->GetClipBox(); + m_ClipRect = CFX_FloatRect(m_pDevice->GetClipBox()); CFX_Matrix device2object; device2object.SetReverse(m_pCurrentLayer->m_Matrix); device2object.TransformRect(m_ClipRect); @@ -1295,18 +1295,16 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, dibFormat = FXDIB_Argb; bpp = 32; } - CFX_FloatRect rect; - int32_t iWidth, iHeight, iPitch; while (1) { - rect = pRect; + CFX_FloatRect rect(pRect); m_Matrix.TransformRect(rect); FX_RECT bitmap_rect = rect.GetOutterRect(); - iWidth = bitmap_rect.Width(); - iHeight = bitmap_rect.Height(); - iPitch = (iWidth * bpp + 31) / 32 * 4; - if (iWidth * iHeight < 1) { + int32_t iWidth = bitmap_rect.Width(); + int32_t iHeight = bitmap_rect.Height(); + int32_t iPitch = (iWidth * bpp + 31) / 32 * 4; + if (iWidth * iHeight < 1) return FALSE; - } + if (iPitch * iHeight <= _FPDFAPI_IMAGESIZE_LIMIT_ && m_pBitmapDevice->Create(iWidth, iHeight, dibFormat)) { break; |