diff options
author | tsepez <tsepez@chromium.org> | 2016-12-06 06:29:28 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-06 06:29:28 -0800 |
commit | 1a1d7648d3e338b756e464cebb2ae1a815359afa (patch) | |
tree | defa2de6d2cb61efd95ef212eb3e89e1a5811032 /core/fxge/dib/fx_dib_transform.cpp | |
parent | 7341149c634e0ab9a619898826440f6e952cf0aa (diff) | |
download | pdfium-1a1d7648d3e338b756e464cebb2ae1a815359afa.tar.xz |
Return unique_ptrs from CFX_DIBitmap::Clone().
Because that's what clone does. Perform immediate release
in some spots to avoid disrupting too much at once.
Review-Url: https://codereview.chromium.org/2534953004
Diffstat (limited to 'core/fxge/dib/fx_dib_transform.cpp')
-rw-r--r-- | core/fxge/dib/fx_dib_transform.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp index b938d648a8..dacc0aa393 100644 --- a/core/fxge/dib/fx_dib_transform.cpp +++ b/core/fxge/dib/fx_dib_transform.cpp @@ -301,23 +301,25 @@ FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, return rect; } -CFX_DIBitmap* CFX_DIBSource::TransformTo(const CFX_Matrix* pDestMatrix, - int& result_left, - int& result_top, - uint32_t flags, - const FX_RECT* pDestClip) const { +std::unique_ptr<CFX_DIBitmap> CFX_DIBSource::TransformTo( + const CFX_Matrix* pDestMatrix, + int& result_left, + int& result_top, + uint32_t flags, + const FX_RECT* pDestClip) const { CFX_ImageTransformer transformer(this, pDestMatrix, flags, pDestClip); transformer.Start(); transformer.Continue(nullptr); result_left = transformer.result().left; result_top = transformer.result().top; - return transformer.DetachBitmap().release(); + return transformer.DetachBitmap(); } -CFX_DIBitmap* CFX_DIBSource::StretchTo(int dest_width, - int dest_height, - uint32_t flags, - const FX_RECT* pClip) const { +std::unique_ptr<CFX_DIBitmap> CFX_DIBSource::StretchTo( + int dest_width, + int dest_height, + uint32_t flags, + const FX_RECT* pClip) const { FX_RECT clip_rect(0, 0, FXSYS_abs(dest_width), FXSYS_abs(dest_height)); if (pClip) clip_rect.Intersect(*pClip); @@ -333,7 +335,8 @@ CFX_DIBitmap* CFX_DIBSource::StretchTo(int dest_width, clip_rect, flags); if (stretcher.Start()) stretcher.Continue(nullptr); - return storer.Detach().release(); + + return storer.Detach(); } CFX_ImageTransformer::CFX_ImageTransformer(const CFX_DIBSource* pSrc, |