summaryrefslogtreecommitdiff
path: root/vcl/source/bitmap
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-23 10:41:45 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-23 11:45:23 +0200
commit6122f6266c61db851d7595aeb824502172b509b2 (patch)
tree2aa0f7fa5c9fb0e9acd5f5602ef0cc5f86824dc7 /vcl/source/bitmap
parent6a068a90bb8b7625aca73e2c7c0a9e14a95b82be (diff)
fix memory management in BitmapConvolutionMatrixFilter
was deleting a stack allocated buffer. Also (*) drop the BitmapConvolutionMatrixFilter default constructor, the current code does not permit mpMatrix to be nullptr (*) declare the mpMatrix field as a reference to a fixed length array, to be more precise (*) pass the array in the constructor so that call sites will be properly type- and length-checked. Change-Id: I650d56cdfac0dae4ea77df7c0c03e19d658c00c8 Reviewed-on: https://gerrit.libreoffice.org/53312 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/bitmap')
-rw-r--r--vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx
index fea2e6dac4f4..bb1a1932c763 100644
--- a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx
+++ b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx
@@ -14,6 +14,7 @@
#include <vcl/bitmapex.hxx>
#include <vcl/bitmapaccess.hxx>
#include <vcl/BitmapConvolutionMatrixFilter.hxx>
+#include <vcl/BitmapSharpenFilter.hxx>
#include <bitmapwriteaccess.hxx>
@@ -53,7 +54,7 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx)
// create LUT of products of matrix value and possible color component values
for (nY = 0; nY < 9; nY++)
{
- for (nX = nTmp = 0, nMatrixVal = mpMatrix[nY]; nX < 256; nX++, nTmp += nMatrixVal)
+ for (nX = nTmp = 0, nMatrixVal = mrMatrix[nY]; nX < 256; nX++, nTmp += nMatrixVal)
{
pKoeff[nY][nX] = nTmp;
}
@@ -196,4 +197,10 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx)
return BitmapEx();
}
+static const long g_SharpenMatrix[] = { -1, -1, -1, -1, 16, -1, -1, -1, -1 };
+
+BitmapSharpenFilter::BitmapSharpenFilter()
+ : BitmapConvolutionMatrixFilter(g_SharpenMatrix)
+{
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */