From 1b08df18300bbc67dabd12fb35ab6ce1732a1024 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 9 Feb 2017 09:17:20 -0500 Subject: Convert Get methods to return instead of using out params. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl changes several Get methods to return their values instead of using out parameters. Change-Id: Ie9a930a5c2d0e809f2d7181ca033d801945c1cf9 Reviewed-on: https://pdfium-review.googlesource.com/2556 Commit-Queue: dsinclair Reviewed-by: Nicolás Peña --- xfa/fxgraphics/cfx_graphics.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'xfa/fxgraphics/cfx_graphics.cpp') diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp index 7ad1aa45e5..bed7c36149 100644 --- a/xfa/fxgraphics/cfx_graphics.cpp +++ b/xfa/fxgraphics/cfx_graphics.cpp @@ -872,16 +872,12 @@ CFX_Matrix* CFX_Graphics::GetMatrix() { return nullptr; } -FWL_Error CFX_Graphics::GetClipRect(CFX_RectF& rect) const { - if (m_type == FX_CONTEXT_Device && m_renderDevice) { - FX_RECT r = m_renderDevice->GetClipBox(); - rect.left = (FX_FLOAT)r.left; - rect.top = (FX_FLOAT)r.top; - rect.width = (FX_FLOAT)r.Width(); - rect.height = (FX_FLOAT)r.Height(); - return FWL_Error::Succeeded; - } - return FWL_Error::PropertyInvalid; +CFX_RectF CFX_Graphics::GetClipRect() const { + if (m_type != FX_CONTEXT_Device || !m_renderDevice) + return CFX_RectF(); + + FX_RECT r = m_renderDevice->GetClipBox(); + return CFX_Rect(r.left, r.top, r.Width(), r.Height()).As(); } FWL_Error CFX_Graphics::SetClipRect(const CFX_RectF& rect) { @@ -1218,8 +1214,7 @@ FWL_Error CFX_Graphics::RenderDeviceDrawImage(CFX_DIBSource* source, int32_t left, top; std::unique_ptr bmp1 = source->FlipImage(false, true); std::unique_ptr bmp2 = bmp1->TransformTo(&m2, left, top); - CFX_RectF r; - GetClipRect(r); + CFX_RectF r = GetClipRect(); CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap(); CFX_DIBitmap bmp; if (bmp.Create(bitmap->GetWidth(), bitmap->GetHeight(), FXDIB_Argb) && @@ -1251,8 +1246,7 @@ FWL_Error CFX_Graphics::RenderDeviceStretchImage(CFX_DIBSource* source, int32_t top; std::unique_ptr bmp2 = bmp1->FlipImage(false, true); std::unique_ptr bmp3 = bmp2->TransformTo(&m2, left, top); - CFX_RectF r; - GetClipRect(r); + CFX_RectF r = GetClipRect(); CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap(); if (bitmap->CompositeBitmap(FXSYS_round(r.left), FXSYS_round(r.top), FXSYS_round(r.Width()), FXSYS_round(r.Height()), -- cgit v1.2.3