From 1a1d7648d3e338b756e464cebb2ae1a815359afa Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 6 Dec 2016 06:29:28 -0800 Subject: 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 --- core/fxge/dib/fx_dib_transform.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'core/fxge/dib/fx_dib_transform.cpp') 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_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_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, -- cgit v1.2.3