[Libreoffice-commits] core.git: Branch 'feature/gengalr' - 2 commits - solenv/gbuild svx/source vcl/qa vcl/source
Michael Meeks
michael.meeks at suse.com
Mon May 13 14:34:09 PDT 2013
solenv/gbuild/Package.mk | 1 -
svx/source/gallery2/galobj.cxx | 3 ---
vcl/qa/cppunit/graphicfilter/filters-test.cxx | 20 ++++++++++++++++++++
vcl/source/gdi/bitmap3.cxx | 19 ++++++++++++++-----
4 files changed, 34 insertions(+), 9 deletions(-)
New commits:
commit bee63e77faa01368c116d76faaa239e7c8c3154d
Author: Michael Meeks <michael.meeks at suse.com>
Date: Mon May 13 22:33:03 2013 +0100
gallery: cleanup scaling code.
Change-Id: I783b0fe54c6273ce3d78996a02da02dc51944606
diff --git a/solenv/gbuild/Package.mk b/solenv/gbuild/Package.mk
index f2b1c34..a5ecf37 100644
--- a/solenv/gbuild/Package.mk
+++ b/solenv/gbuild/Package.mk
@@ -126,7 +126,6 @@ gb_Package_OUTDIR_$(1) := $(2)
endef
define gb_Package_add_file
-$(info gb_Package_add_file,$(1), $(2), $(3), $(4))
$(call gb_Package__check,$(1))
$(if $(strip $(3)),,$(call gb_Output_error,gb_Package_add_file requires 3 arguments))
$(call gb_Package_get_target,$(1)) : $$(gb_Package_OUTDIR_$(1))/$(2)
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index 29791da..573dcf6 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -66,8 +66,6 @@ sal_Bool SgaObject::CreateThumb( const Graphic& rGraphic )
if( aBmpSize.Width() && aBmpSize.Height() )
{
- const Color aWhite( COL_WHITE );
-
if( aBmpEx.GetPrefMapMode().GetMapUnit() != MAP_PIXEL &&
aBmpEx.GetPrefSize().Width() > 0 &&
aBmpEx.GetPrefSize().Height() > 0 )
@@ -101,7 +99,6 @@ sal_Bool SgaObject::CreateThumb( const Graphic& rGraphic )
const float fFactor = (float) aBmpSize.Width() / aBmpSize.Height();
const Size aNewSize( std::max( (long) (fFactor < 1. ? S_THUMB * fFactor : S_THUMB), 8L ),
std::max( (long) (fFactor < 1. ? S_THUMB : S_THUMB / fFactor), 8L ) );
-
if(aThumbBmp.Scale(
(double) aNewSize.Width() / aBmpSize.Width(),
(double) aNewSize.Height() / aBmpSize.Height(),
commit 80145fe50994ccc3c2b090d365a888d9f7cedd71
Author: Michael Meeks <michael.meeks at suse.com>
Date: Mon May 13 22:32:32 2013 +0100
vcl: attempt to fix high quality scaling to get aspect ratio right.
Change-Id: Ic62c6a16c39dd4e4e19bf9a96503ecf6ac50f292
diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
index 23f2978..b4b11ee 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
@@ -38,8 +38,12 @@ public:
*/
void testCVEs();
+ /// test scaling
+ void testScaling();
+
CPPUNIT_TEST_SUITE(VclFiltersTest);
CPPUNIT_TEST(testCVEs);
+ CPPUNIT_TEST(testScaling);
CPPUNIT_TEST_SUITE_END();
};
@@ -53,6 +57,22 @@ bool VclFiltersTest::load(const OUString &,
return aGraphicFilter.ImportGraphic(aGraphic, rURL, aFileStream) == 0;
}
+void VclFiltersTest::testScaling()
+{
+ for (unsigned int i = BMP_SCALE_FAST; i <= BMP_SCALE_BOX; i++)
+ {
+ Bitmap aBitmap( Size( 413, 409 ), 24 );
+ BitmapEx aBitmapEx( aBitmap );
+
+ fprintf( stderr, "scale with type %d\n", i );
+ CPPUNIT_ASSERT( aBitmapEx.Scale( 0.1937046, 0.193154, i ) );
+ Size aAfter( aBitmapEx.GetSizePixel() );
+ fprintf( stderr, "size %ld, %ld\n", (long)aAfter.Width(),
+ aAfter.Height() );
+ CPPUNIT_ASSERT( fabs (aAfter.Height() - aAfter.Width()) <= 1 );
+ }
+}
+
void VclFiltersTest::testCVEs()
{
#ifndef DISABLE_CVE_TESTS
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index e639b36..5b56ae4 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -2368,7 +2368,7 @@ namespace
}
// #i121233# Added BMP_SCALE_LANCZOS, BMP_SCALE_BICUBIC, BMP_SCALE_BILINEAR and
-// BMP_SCALE_BOX derived from the original commit from Toma Vajngerl (see
+// BMP_SCALE_BOX derived from the original commit from Tomas Vajngerl (see
// bugzilla task for deitails) Thanks!
sal_Bool Bitmap::ImplScaleConvolution(
const double& rScaleX,
@@ -2426,29 +2426,38 @@ sal_Bool Bitmap::ImplScaleConvolution(
const sal_uInt32 nInBetweenSizeHorFirst(nHeight * nNewWidth);
const sal_uInt32 nInBetweenSizeVerFirst(nNewHeight * nWidth);
+ Bitmap aInterm;
if(nInBetweenSizeHorFirst < nInBetweenSizeVerFirst)
{
if(bScaleHor)
{
- bResult = ImplScaleConvolutionHor(*this, aResult, fScaleX, aKernel);
+ bResult = ImplScaleConvolutionHor(*this, aInterm, fScaleX, aKernel);
}
+ else
+ aInterm = *this;
if(bResult && bScaleVer)
{
- bResult = ImplScaleConvolutionVer(*this, aResult, fScaleY, aKernel);
+ bResult = ImplScaleConvolutionVer(aInterm, aResult, fScaleY, aKernel);
}
+ else
+ aResult = aInterm;
}
else
{
if(bScaleVer)
{
- bResult = ImplScaleConvolutionVer(*this, aResult, fScaleY, aKernel);
+ bResult = ImplScaleConvolutionVer(*this, aInterm, fScaleY, aKernel);
}
+ else
+ aInterm = *this;
if(bResult && bScaleHor)
{
- bResult = ImplScaleConvolutionHor(*this, aResult, fScaleX, aKernel);
+ bResult = ImplScaleConvolutionHor(aInterm, aResult, fScaleX, aKernel);
}
+ else
+ aResult = aInterm;
}
}
More information about the Libreoffice-commits
mailing list