diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-09 09:17:20 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-09 15:04:51 +0000 |
commit | 1b08df18300bbc67dabd12fb35ab6ce1732a1024 (patch) | |
tree | 9773931c8d18709860c9fbc1177e290e7713044e /xfa/fxgraphics/cfx_graphics.cpp | |
parent | ac2e04797b258115b2dc768a56377d7e78038f42 (diff) | |
download | pdfium-1b08df18300bbc67dabd12fb35ab6ce1732a1024.tar.xz |
Convert Get methods to return instead of using out params.
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 <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'xfa/fxgraphics/cfx_graphics.cpp')
-rw-r--r-- | xfa/fxgraphics/cfx_graphics.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
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<FX_FLOAT>(); } 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<CFX_DIBitmap> bmp1 = source->FlipImage(false, true); std::unique_ptr<CFX_DIBitmap> 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<CFX_DIBitmap> bmp2 = bmp1->FlipImage(false, true); std::unique_ptr<CFX_DIBitmap> 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()), |