include/vcl/bitmap.hxx | 13 +++++++------ vcl/source/gdi/bitmap3.cxx | 18 +++++++++++------- 2 files changed, 18 insertions(+), 13 deletions(-)
New commits: commit 9fd53538f9ecd2c6a935be1958b9f8dafeab8740 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Tue Jul 2 17:11:57 2019 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Wed Jul 17 14:25:57 2019 +0200 vcl: make it possible to select specific scaling algorithm Default, Fast, BestQuality scaling flags are used for selecting the best sclaing algorithm for a specific task, but not all specialized sclaing algorithms have its own flag (Super, NearestNeighbor) and are just selectable using one of the above. This adds the missing flags so it's possible to select a specific algorithm. Change-Id: Ied41f27a21a4fcc799537396f9077a9c77cc1c60 Reviewed-on: https://gerrit.libreoffice.org/75759 Reviewed-by: Chris Sherlock <chris.sherloc...@gmail.com> Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index dcc862ed7779..59c6c9ac28d6 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -39,26 +39,27 @@ enum class BmpMirrorFlags Horizontal = 0x01, Vertical = 0x02, }; + namespace o3tl { template<> struct typed_flags<BmpMirrorFlags> : is_typed_flags<BmpMirrorFlags, 0x03> {}; } - enum class BmpScaleFlag { // Try to preferably use these. - Default = 1, + Default, Fast, BestQuality, -// Specific algorithms, use only if you really need to. - Interpolate, +// Specific algorithms, use only if you really need to (mainly used for tests) + NearestNeighbor, + Interpolate, // fast, integer bilinear Lanczos, BiCubic, - BiLinear + BiLinear, + Super // bilinear interpolation when supersampling and averaging when subsampling under certain scale }; - #define BMP_COL_TRANS Color( 252, 3, 251 ) enum class BmpConversion diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 71a3bc468876..a3b22ffa3f5c 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -776,7 +776,15 @@ bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag n switch(nScaleFlag) { + case BmpScaleFlag::Default: + if (GetSizePixel().Width() < 2 || GetSizePixel().Height() < 2) + bRetval = BitmapFilter::Filter(aBmpEx, BitmapFastScaleFilter(rScaleX, rScaleY)); + else + bRetval = BitmapFilter::Filter(aBmpEx, BitmapScaleSuperFilter(rScaleX, rScaleY)); + break; + case BmpScaleFlag::Fast: + case BmpScaleFlag::NearestNeighbor: bRetval = BitmapFilter::Filter(aBmpEx, BitmapFastScaleFilter(rScaleX, rScaleY)); break; @@ -784,15 +792,11 @@ bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag n bRetval = BitmapFilter::Filter(aBmpEx, BitmapInterpolateScaleFilter(rScaleX, rScaleY)); break; - case BmpScaleFlag::Default: - if (GetSizePixel().Width() < 2 || GetSizePixel().Height() < 2) - bRetval = BitmapFilter::Filter(aBmpEx, BitmapFastScaleFilter(rScaleX, rScaleY)); - else - bRetval = BitmapFilter::Filter(aBmpEx, BitmapScaleSuperFilter(rScaleX, rScaleY)); + case BmpScaleFlag::Super: + bRetval = BitmapFilter::Filter(aBmpEx, BitmapScaleSuperFilter(rScaleX, rScaleY)); break; - - case BmpScaleFlag::Lanczos: case BmpScaleFlag::BestQuality: + case BmpScaleFlag::Lanczos: bRetval = BitmapFilter::Filter(aBmpEx, vcl::BitmapScaleLanczos3Filter(rScaleX, rScaleY)); break; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits