diff options
author | Anton Kudryavtsev <anton.kudryavtsev@corp.mail.ru> | 2018-10-12 12:43:22 +0300 |
---|---|---|
committer | Anton Kudryavtsev <antkudr@mail.ru> | 2018-10-16 15:27:34 +0000 |
commit | 5ab94518461328212b4c461532a0757231187ac8 (patch) | |
tree | 28451a2cc5dd2438431d58c99c3a3cde85932061 | |
parent | eb4d39ada0e69daa63b127fabd4457c284d78eff (diff) |
QPixmapFilter: some cleanup
Use unique_ptr instead of plain array. No need to call 'delete'.
Change-Id: Ia77f4f209b1fd83391428d8b82b7acbba48781b9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r-- | src/widgets/effects/qpixmapfilter.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index 211c09ee71..b330afebed 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -54,6 +54,8 @@ #include "private/qmemrotate_p.h" #include "private/qdrawhelper_p.h" +#include <memory> + QT_BEGIN_NAMESPACE class QPixmapFilterPrivate : public QObjectPrivate @@ -319,7 +321,7 @@ static void convolute( const QImage processImage = (srcImage.format() != QImage::Format_ARGB32_Premultiplied ) ? srcImage.convertToFormat(QImage::Format_ARGB32_Premultiplied) : srcImage; // TODO: support also other formats directly without copying - int *fixedKernel = new int[kernelWidth*kernelHeight]; + std::unique_ptr<int[]> fixedKernel(new int[kernelWidth * kernelHeight]); for(int i = 0; i < kernelWidth*kernelHeight; i++) { fixedKernel[i] = (int)(65536 * kernel[i]); @@ -403,7 +405,6 @@ static void convolute( } yk++; } - delete[] fixedKernel; } /*! |