vcl/backendtest/VisualBackendTest.cxx | 11 +++++++++-- vcl/backendtest/outputdevice/bitmap.cxx | 23 ++++++++++++++++++++++- vcl/inc/test/outputdevice.hxx | 2 ++ 3 files changed, 33 insertions(+), 3 deletions(-)
New commits: commit 08179f207efdcc47dd62d14649ddae3e45343cd5 Author: Tomaž Vajngerl <[email protected]> Date: Tue Nov 8 14:45:52 2016 +0100 backend bitmap test for 32-bit bitmap Change-Id: I64223910cef1a44d616faa1f0a8982acc4344657 diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx index ced23d9..fb617f8 100644 --- a/vcl/backendtest/VisualBackendTest.cxx +++ b/vcl/backendtest/VisualBackendTest.cxx @@ -343,7 +343,7 @@ public: Rectangle aRectangle; size_t index = 0; - std::vector<Rectangle> aRegions = setupRegions(2, 2, nWidth, nHeight); + std::vector<Rectangle> aRegions = setupRegions(2, 3, nWidth, nHeight); aRectangle = aRegions[index++]; { @@ -363,7 +363,7 @@ public: { vcl::test::OutputDeviceTestBitmap aOutDevTest; Bitmap aBitmap = aOutDevTest.setupDrawBitmapExWithAlpha(); - assertAndSetBackground(vcl::test::OutputDeviceTestBitmap::checkBitmapExWithAlpha(aBitmap), aRectangle, rRenderContext); + assertAndSetBackground(vcl::test::OutputDeviceTestBitmap::checkAlphaBitmap(aBitmap), aRectangle, rRenderContext); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); } aRectangle = aRegions[index++]; @@ -373,6 +373,13 @@ public: assertAndSetBackground(vcl::test::OutputDeviceTestBitmap::checkMask(aBitmap), aRectangle, rRenderContext); drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); } + aRectangle = aRegions[index++]; + { + vcl::test::OutputDeviceTestBitmap aOutDevTest; + Bitmap aBitmap = aOutDevTest.setupDrawNativeBitmapWithAlpha(); + assertAndSetBackground(vcl::test::OutputDeviceTestBitmap::checkAlphaBitmap(aBitmap), aRectangle, rRenderContext); + drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext); + } } virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/) override diff --git a/vcl/backendtest/outputdevice/bitmap.cxx b/vcl/backendtest/outputdevice/bitmap.cxx index 351dfa2..fc7f022 100644 --- a/vcl/backendtest/outputdevice/bitmap.cxx +++ b/vcl/backendtest/outputdevice/bitmap.cxx @@ -111,6 +111,27 @@ Bitmap OutputDeviceTestBitmap::setupDrawMask() return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize()); } +Bitmap OutputDeviceTestBitmap::setupDrawNativeBitmapWithAlpha() +{ + Size aBitmapSize(9, 9); + Bitmap aBitmap(aBitmapSize, 32); + { + Bitmap::ScopedWriteAccess aWriteAccess(aBitmap); + aWriteAccess->Erase(COL_TRANSPARENT); + aWriteAccess->SetLineColor(Color(0x44, 0xFF, 0xFF, 0x00)); + aWriteAccess->DrawRect(Rectangle(0, 0, 8, 8)); + aWriteAccess->DrawRect(Rectangle(3, 3, 5, 5)); + } + + initialSetup(13, 13, constBackgroundColor); + + Point aPoint(alignToCenter(maVDRectangle, Rectangle(Point(), aBitmapSize)).TopLeft()); + + mpVirtualDevice->DrawBitmap(aPoint, aBitmap); + + return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize()); +} + TestResult OutputDeviceTestBitmap::checkBitmap(Bitmap& rBitmap) { std::vector<Color> aExpected @@ -131,7 +152,7 @@ TestResult OutputDeviceTestBitmap::checkTransformedBitmap(Bitmap& rBitmap) return checkRectangles(rBitmap, aExpected); } -TestResult OutputDeviceTestBitmap::checkBitmapExWithAlpha(Bitmap& rBitmap) +TestResult OutputDeviceTestBitmap::checkAlphaBitmap(Bitmap& rBitmap) { const Color aBlendedColor(0xEE, 0xEE, 0x33); diff --git a/vcl/inc/test/outputdevice.hxx b/vcl/inc/test/outputdevice.hxx index cc90b00..53b17bc 100644 --- a/vcl/inc/test/outputdevice.hxx +++ b/vcl/inc/test/outputdevice.hxx @@ -77,11 +77,13 @@ public: Bitmap setupDrawBitmap(); Bitmap setupDrawBitmapExWithAlpha(); Bitmap setupDrawMask(); + Bitmap setupDrawNativeBitmapWithAlpha(); static TestResult checkBitmap(Bitmap& rBitmap); static TestResult checkTransformedBitmap(Bitmap& rBitmap); static TestResult checkBitmapExWithAlpha(Bitmap& rBitmap); static TestResult checkMask(Bitmap& rBitmap); + static TestResult checkAlphaBitmap(Bitmap& rBitmap); }; class VCL_DLLPUBLIC OutputDeviceTestAnotherOutDev : public OutputDeviceTestCommon
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
