[Libreoffice-commits] core.git: drawinglayer/source include/vcl vcl/source

2023-06-29 Thread Paris Oplopoios (via logerrit)
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |   14 ---
 include/vcl/animate/AnimationFrame.hxx   |   14 +--
 vcl/source/animate/AnimationFrame.cxx|3 ++
 vcl/source/filter/png/PngImageReader.cxx |6 +++-
 4 files changed, 30 insertions(+), 7 deletions(-)

New commits:
commit 8dfde7d69a8bbdc8ce88aefded231b94e30271d6
Author: Paris Oplopoios 
AuthorDate: Sat Jun 24 17:36:09 2023 +0300
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 29 15:19:54 2023 +0200

tdf#104877 Implement APNG blending modes

Change-Id: Ib7ce4d113ccaa4843b8332087ebe52ac3828180e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153556
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index a95df2474744..f3c4cf69911c 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -252,6 +252,15 @@ namespace drawinglayer::primitive2d
 // prepare step
 const AnimationFrame& rAnimationFrame = 
maAnimation.Get(sal_uInt16(mnNextFrameToPrepare));
 
+bool bSourceBlending = rAnimationFrame.meBlend == 
Blend::Source;
+
+if (bSourceBlending)
+{
+tools::Rectangle 
aArea(rAnimationFrame.maPositionPixel, 
rAnimationFrame.maBitmapEx.GetSizePixel());
+maVirtualDevice->Erase(aArea);
+maVirtualDeviceMask->Erase(aArea);
+}
+
 switch (rAnimationFrame.meDisposal)
 {
 case Disposal::Not:
@@ -278,14 +287,13 @@ namespace drawinglayer::primitive2d
 {
 // #i70772# react on no mask, for primitives, too.
 const AlphaMask & 
rMask(rAnimationFrame.maBitmapEx.GetAlphaMask());
-const Bitmap & 
rContent(rAnimationFrame.maBitmapEx.GetBitmap());
 
 maVirtualDeviceMask->Erase();
-
maVirtualDevice->DrawBitmap(rAnimationFrame.maPositionPixel, rContent);
+
maVirtualDevice->DrawBitmapEx(rAnimationFrame.maPositionPixel, 
rAnimationFrame.maBitmapEx);
 
 if (rMask.IsEmpty())
 {
-const ::tools::Rectangle 
aRect(rAnimationFrame.maPositionPixel, rContent.GetSizePixel());
+const ::tools::Rectangle 
aRect(rAnimationFrame.maPositionPixel, 
rAnimationFrame.maBitmapEx.GetSizePixel());
 maVirtualDeviceMask->SetFillColor(COL_BLACK);
 maVirtualDeviceMask->SetLineColor();
 maVirtualDeviceMask->DrawRect(aRect);
diff --git a/include/vcl/animate/AnimationFrame.hxx 
b/include/vcl/animate/AnimationFrame.hxx
index 7aa6f0d54a2b..3e9a4b21d168 100644
--- a/include/vcl/animate/AnimationFrame.hxx
+++ b/include/vcl/animate/AnimationFrame.hxx
@@ -28,6 +28,12 @@ enum class Disposal
 Previous
 };
 
+enum class Blend
+{
+Source,
+Over
+};
+
 struct AnimationFrame
 {
 BitmapEx maBitmapEx;
@@ -35,22 +41,26 @@ struct AnimationFrame
 Size maSizePixel;
 tools::Long mnWait;
 Disposal meDisposal;
+Blend meBlend;
 bool mbUserInput;
 
 AnimationFrame()
 : mnWait(0)
 , meDisposal(Disposal::Not)
+, meBlend(Blend::Over)
 , mbUserInput(false)
 {
 }
 
 AnimationFrame(const BitmapEx& rBitmapEx, const Point& rPositionPixel, 
const Size& rSizePixel,
-   tools::Long nWait = 0, Disposal eDisposal = Disposal::Not)
+   tools::Long nWait = 0, Disposal eDisposal = Disposal::Not,
+   Blend eBlend = Blend::Over)
 : maBitmapEx(rBitmapEx)
 , maPositionPixel(rPositionPixel)
 , maSizePixel(rSizePixel)
 , mnWait(nWait)
 , meDisposal(eDisposal)
+, meBlend(eBlend)
 , mbUserInput(false)
 {
 }
@@ -60,7 +70,7 @@ struct AnimationFrame
 return (rAnimationFrame.maBitmapEx == maBitmapEx
 && rAnimationFrame.maPositionPixel == maPositionPixel
 && rAnimationFrame.maSizePixel == maSizePixel && 
rAnimationFrame.mnWait == mnWait
-&& rAnimationFrame.meDisposal == meDisposal
+&& rAnimationFrame.meDisposal == meDisposal && 
rAnimationFrame.meBlend == meBlend
 && rAnimationFrame.mbUserInput == mbUserInput);
 }
 
diff --git a/vcl/source/animate/AnimationFrame.cxx 
b/vcl/source/animate/AnimationFrame.cxx
index e2f9bae931fb..3593a0ab17e1 100644
--- a/vcl/source/animate/AnimationFra

[Libreoffice-commits] core.git: drawinglayer/source include/vcl vcl/source

2022-11-13 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/tools/converters.cxx |  104 ---
 include/vcl/alpha.hxx|3 
 include/vcl/bitmap.hxx   |   23 ++
 vcl/source/bitmap/alpha.cxx  |   28 
 vcl/source/bitmap/bitmap.cxx |   69 
 5 files changed, 191 insertions(+), 36 deletions(-)

New commits:
commit 651142cbc6305b182a22efbdc4524e614483cf88
Author: Armin Le Grand (allotropia) 
AuthorDate: Thu Nov 10 12:03:55 2022 +0100
Commit: Armin Le Grand 
CommitDate: Sun Nov 13 10:09:20 2022 +0100

Adapted convertToBitmapEx to simpler BitmapEx creation

As long as not all our mechanisms are changed to RGBA
completely, mixing OutDev with Alpha (2x VDev) and RGB
target rendering is just too dangerous and expensive
and may to wrong or deliver bad quality results (see
comments in code for details).

Nonetheless we need a RGBA result for convert to
BitmapEx. Luckily we are able to create a copmplete
and valid AlphaChannel using 'createAlphaMask'.

Based n that we know the content (RGB result from
renderer), alpha (result from createAlphaMask) and
the start condition (content rendered usually
against COL_WHITE). Tht makes it possible to
calculate back the content, quasi 'remove' that
initial blending against COL_WHITE.

That is what the helper Bitmap::RemoveBlendedStartColor
does. Luckily we only need it for convert To BitmapEx,
not in any other rendering.

This gives good results, it is in principle comparable
with the results using pre-multiplied alpha tooling,
also slightly reducing the range of color values where
high alpha vlaues are used, but in areas that are
highly transparent anyways.

Also important is that this will work with RGB-based
system-dependent renderers, too. The method before
could only work with the VCL-based primitive renderers
by principle (only there - by coincidence - OutputDevice
with Alpha worked).

NOTE: Had to re-add usage of *unused* alpha channel
in convertToBitmapEx due to test SdPNGExportTest. It
somehow creates an Alpha in Bitmap size when I *remove*
Alpha in convertToBitmapEx, so I just keep it for now,
it is created anyways, just wanted to make it sleeker.

Change-Id: I12e47327f5793d6ed87e217a2355c608f528246f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142547
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 48a5b404b056..332d91dcc7c4 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -32,9 +32,12 @@
 
 #ifdef DBG_UTIL
 #include 
-#include 
+// #include 
+#include 
 #endif
 
+// #include 
+
 namespace
 {
 bool implPrepareConversion(drawinglayer::primitive2d::Primitive2DContainer& 
rSequence,
@@ -137,39 +140,56 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
sal_uInt32 nDiscreteWidth, sal_uInt32 
nDiscreteHeight,
sal_uInt32 nMaxSquarePixels)
 {
-BitmapEx aRetval;
 drawinglayer::primitive2d::Primitive2DContainer aSequence(std::move(rSeq));
 
 if (!implPrepareConversion(aSequence, nDiscreteWidth, nDiscreteHeight, 
nMaxSquarePixels))
 {
-return aRetval;
+return BitmapEx();
 }
 
 const Point aEmptyPoint;
 const Size aSizePixel(nDiscreteWidth, nDiscreteHeight);
 
-// Create target VirtualDevice. Use a VirtualDevice in the Alpha-mode.
-// This creates the needed alpha channel 'in parallel'. It is not
-// cheaper though since the VDev in that mode internally uses two VDevs,
-// so resource-wise it's more expensive, speed-wise pretty much the same
-// (the former two-path rendering created content & alpha separately in
-// two runs). The former method always created the correct Alpha, but
-// when transparent geometry was involved, the created content was
-// blended against white (COL_WHITE) due to the starting conditions of
-// creation.
-// There are more ways than this to do this correctly, but this is the
-// most simple for now. Due to hoping to be able to render to RGBA in the
-// future anyways there is no need to experiment trying to do the correct
-// thing using an expanded version of the former method.
-ScopedVclPtrInstance 
pContent(*Application::GetDefaultDevice(),
- DeviceFormat::DEFAULT, 
DeviceFormat::DEFAULT);
+// Create target VirtualDevice. Go back to using a simple RGB
+// target version (comared with former version, see history).
+// Reasons are manyfold:
+// - Avoid the RGBA mode for VirtualDevice (two VDevs)
+//   - It's not suggested to be used outside presentation engine
+//   - I

[Libreoffice-commits] core.git: drawinglayer/source include/vcl vcl/source

2022-03-22 Thread Luboš Luňák (via logerrit)
 drawinglayer/source/tools/wmfemfhelper.cxx |   18 
 include/vcl/lineinfo.hxx   |5 +++
 vcl/source/filter/eps/eps.cxx  |4 +-
 vcl/source/gdi/lineinfo.cxx|   42 +
 vcl/source/gdi/pdfwriter_impl.cxx  |   21 --
 vcl/source/outdev/line.cxx |   18 
 6 files changed, 35 insertions(+), 73 deletions(-)

New commits:
commit ff8b9f6fca5784f62427302026642de0cdb1ef11
Author: Luboš Luňák 
AuthorDate: Tue Mar 22 12:14:52 2022 +0100
Commit: Luboš Luňák 
CommitDate: Tue Mar 22 15:17:08 2022 +0100

use dashing info from struct LineInfo in EPS writer (tdf#146804)

It had a random(?) hardcoded '2' as the dashing info. While at it,
I've also made few other places use the common implementation
of creating the dotdash array instead of doing it manually.

Change-Id: Id349ca138c98d08eef47dc0bfe6d162e03fc4a9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131932
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx 
b/drawinglayer/source/tools/wmfemfhelper.cxx
index 7f07e472bef8..592e67bab9a5 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -524,23 +524,7 @@ namespace wmfemfhelper
 
 if(bDashDotUsed)
 {
-std::vector< double > fDotDashArray;
-const double fDashLen(rLineInfo.GetDashLen());
-const double fDotLen(rLineInfo.GetDotLen());
-const double fDistance(rLineInfo.GetDistance());
-
-for(sal_uInt16 a(0); a < rLineInfo.GetDashCount(); a++)
-{
-fDotDashArray.push_back(fDashLen);
-fDotDashArray.push_back(fDistance);
-}
-
-for(sal_uInt16 b(0); b < rLineInfo.GetDotCount(); b++)
-{
-fDotDashArray.push_back(fDotLen);
-fDotDashArray.push_back(fDistance);
-}
-
+std::vector< double > fDotDashArray = 
rLineInfo.GetDotDashArray();
 const double 
fAccumulated(std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0));
 const drawinglayer::attribute::StrokeAttribute 
aStrokeAttribute(
 std::move(fDotDashArray),
diff --git a/include/vcl/lineinfo.hxx b/include/vcl/lineinfo.hxx
index 73ed0d3a5771..0644359954b9 100644
--- a/include/vcl/lineinfo.hxx
+++ b/include/vcl/lineinfo.hxx
@@ -27,6 +27,8 @@
 #include 
 #include 
 
+#include 
+
 class SvStream;
 namespace basegfx { class B2DPolyPolygon; }
 
@@ -84,6 +86,9 @@ public:
 voidSetDistance( double nDistance );
 double  GetDistance() const { return mpImplLineInfo->mnDistance; }
 
+/// Get an array of "on" and "off" lengths for stroke dashing
+std::vector< double > GetDotDashArray() const;
+
 void SetLineJoin(basegfx::B2DLineJoin eLineJoin);
 basegfx::B2DLineJoin GetLineJoin() const { return 
mpImplLineInfo->meLineJoin; }
 
diff --git a/vcl/source/filter/eps/eps.cxx b/vcl/source/filter/eps/eps.cxx
index 1a73c682adf1..374b4c78218b 100644
--- a/vcl/source/filter/eps/eps.cxx
+++ b/vcl/source/filter/eps/eps.cxx
@@ -2300,9 +2300,9 @@ void PSWriter::ImplWriteLineInfo( double fLWidth, double 
fMLimit,
 
 void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo )
 {
-SvtGraphicStroke::DashArray l_aDashArray;
+std::vector< double > l_aDashArray;
 if ( rLineInfo.GetStyle() == LineStyle::Dash )
-l_aDashArray.push_back( 2 );
+l_aDashArray = rLineInfo.GetDotDashArray();
 const double fLWidth(( ( rLineInfo.GetWidth() + 1 ) + ( 
rLineInfo.GetWidth() + 1 ) ) * 0.5);
 SvtGraphicStroke::JoinType aJoinType(SvtGraphicStroke::joinMiter);
 SvtGraphicStroke::CapType aCapType(SvtGraphicStroke::capButt);
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx
index 94ab3b83df65..85e7c041943e 100644
--- a/vcl/source/gdi/lineinfo.cxx
+++ b/vcl/source/gdi/lineinfo.cxx
@@ -204,6 +204,30 @@ SvStream& WriteLineInfo( SvStream& rOStm, const LineInfo& 
rLineInfo )
 return rOStm;
 }
 
+std::vector< double > LineInfo::GetDotDashArray() const
+{
+::std::vector< double > fDotDashArray;
+if ( GetStyle() != LineStyle::Dash )
+return fDotDashArray;
+
+const double fDashLen(GetDashLen());
+const double fDotLen(GetDotLen());
+const double fDistance(GetDistance());
+
+for(sal_uInt16 a(0); a < GetDashCount(); a++)
+{
+fDotDashArray.push_back(fDashLen);
+fDotDashArray.push_back(fDistance);
+}
+
+for(sal_uInt16 b(0); b < GetDotCount(); b++)
+{
+fDotDashArray.push_back(fDotLen);
+fDotDashArray.push_back(fDistance);
+}
+return fDotDashArray;
+}
+
 void LineInfo::applyToB2DPolyPolygon(
 basegfx::B2DPolyPolygon& io_rLinePolyPolyg

[Libreoffice-commits] core.git: drawinglayer/source include/vcl vcl/source

2021-01-16 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx   |2 +-
 drawinglayer/source/processor2d/hittestprocessor2d.cxx |2 +-
 include/vcl/bitmapex.hxx   |8 
 vcl/source/bitmap/BitmapEx.cxx |   16 
 4 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit ef7f98ff3c73182528995057a3f691a6d1aefdd5
Author: Noel Grandin 
AuthorDate: Fri Jan 15 20:49:05 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 16 09:00:25 2021 +0100

transparency->alpha in BitmapEx

Change-Id: I631f4ca5a2bdcb8c7691a9a8c71d3de15377213b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109390
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx 
b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
index fa35085e0f1f..b96cca222e7f 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -557,7 +557,7 @@ namespace drawinglayer::primitive2d
 const sal_Int32 nY(basegfx::fround(fRelativeY * 
aBitmapSizePixel.Height()));
 
 // try to get a statement about transparency in that pixel
-o_rResult = (0xff != 
maOldRenderedBitmap.GetTransparency(nX, nY));
+o_rResult = (0 != maOldRenderedBitmap.GetAlpha(nX, nY));
 return true;
 }
 }
diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx 
b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
index 65a03548cb1c..04505489c6f2 100644
--- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
@@ -452,7 +452,7 @@ namespace drawinglayer::processor2d
 const sal_Int32 
nX(basegfx::fround(aRelativePoint.getX() * rSizePixel.Width()));
 const sal_Int32 
nY(basegfx::fround(aRelativePoint.getY() * rSizePixel.Height()));
 
-mbHit = (0xff != 
aBitmapEx.GetTransparency(nX, nY));
+mbHit = (0 != aBitmapEx.GetAlpha(nX, nY));
 }
 }
 else
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 14bbee535485..75e605cb96a9 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -359,7 +359,7 @@ public:
 bool bInvert = false,
 bool msoBrightness = false );
 
-/** Get transparency at given position
+/** Get alpha at given position
 
 @param nX
 integer X-Position in Bitmap
@@ -367,10 +367,10 @@ public:
 @param nY
 integer Y-Position in Bitmap
 
-@return transparency value in the range of [0 .. 255] where
-0 is not transparent, 255 is fully transparent
+@return alpha value in the range of [0 .. 255] where
+0 is fully transparent, 255 is not transparent
  */
-sal_uInt8   GetTransparency(
+sal_uInt8   GetAlpha(
 sal_Int32 nX,
 sal_Int32 nY) const;
 
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 1f5da07218c4..65698b6bbad9 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -675,22 +675,22 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx const & 
aBitmap, const tools::Long
 return aRet;
 }
 
-sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const
+sal_uInt8 BitmapEx::GetAlpha(sal_Int32 nX, sal_Int32 nY) const
 {
-sal_uInt8 nTransparency(0xff);
+sal_uInt8 nAlpha(0);
 
 if(!maBitmap.IsEmpty())
 {
 if (nX >= 0 && nX < GetSizePixel().Width() && nY >= 0 && nY < 
GetSizePixel().Height())
 {
 if (maBitmap.GetBitCount() == 32)
-return 255 - GetPixelColor(nX, nY).GetAlpha();
+return GetPixelColor(nX, nY).GetAlpha();
 switch(meTransparent)
 {
 case TransparentType::NONE:
 {
 // Not transparent, ergo all covered
-nTransparency = 0x00;
+nAlpha = 255;
 break;
 }
 case TransparentType::Color:
@@ -704,7 +704,7 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 
nY) const
 
 // If color is not equal to TransparentColor, we are 
not transparent
 if (aBmpColor != maTransparentColor)
-nTransparency = 0x00;
+nAlpha = 255;
 
 }
 break;
@@ -722,13 +722,13 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, 
sal_Int32 nY) co

[Libreoffice-commits] core.git: drawinglayer/source include/vcl vcl/source

2020-08-13 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |   65 +++---
 drawinglayer/source/processor2d/vclhelperbufferdevice.hxx |4 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx   |9 -
 drawinglayer/source/processor2d/vclprocessor2d.cxx|8 -
 include/vcl/outdev.hxx|2 
 vcl/source/outdev/wallpaper.cxx   |   13 ++
 6 files changed, 37 insertions(+), 64 deletions(-)

New commits:
commit bf021c369f2306ee507da9bd3cc4cd10ac5d234c
Author: Mike Kaganski 
AuthorDate: Thu Aug 13 18:12:37 2020 +0300
Commit: Mike Kaganski 
CommitDate: Fri Aug 14 01:00:04 2020 +0200

tdf#135500: always use transparent and clear content vdev in impBufferDevice

This removes the only place that hadn't used transparent impBufferDevice
yet - in VclProcessor2D::RenderMaskPrimitive2DPixel. Not clearing the vdev
made it draw on whatever garbage was left there from previous paints when
the buffer was taken from maFreeBuffers in VDevBuffer::alloc, so since this
was also the only place left that didn't clear the buffer explicitly, this
makes the clear unconditional in impBufferDevice ctor.

Also this makes sure to clear proper rectangle in VDevBuffer::alloc, and to
clear mpAlphaVDev in OutputDevice::Erase.

Change-Id: I7c1c0cc510a92628f19020b3faf0c0cd81f5a599
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100674
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 647825959108..d2101cc9952f 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -68,8 +68,8 @@ public:
 VDevBuffer();
 virtual ~VDevBuffer() override;
 
-VclPtr alloc(OutputDevice& rOutDev, const Size& rSizePixel, 
bool bClear,
-bool bMonoChrome, bool bTransparent);
+VclPtr alloc(OutputDevice& rOutDev, const Size& rSizePixel, 
bool bMonoChrome,
+bool bTransparent);
 void free(VirtualDevice& rDevice);
 
 // Timer virtuals
@@ -103,7 +103,7 @@ VDevBuffer::~VDevBuffer()
 }
 }
 
-VclPtr VDevBuffer::alloc(OutputDevice& rOutDev, const Size& 
rSizePixel, bool bClear,
+VclPtr VDevBuffer::alloc(OutputDevice& rOutDev, const Size& 
rSizePixel,
 bool bMonoChrome, bool bTransparent)
 {
 ::osl::MutexGuard aGuard(m_aMutex);
@@ -192,15 +192,12 @@ VclPtr VDevBuffer::alloc(OutputDevice& 
rOutDev, const Size& rSize
 {
 if (bOkay)
 {
-if (bClear)
-{
-pRetval->Erase(
-::tools::Rectangle(0, 0, rSizePixel.getWidth(), 
rSizePixel.getHeight()));
-}
+pRetval->Erase(pRetval->PixelToLogic(
+tools::Rectangle(0, 0, rSizePixel.getWidth(), 
rSizePixel.getHeight(;
 }
 else
 {
-pRetval->SetOutputSizePixel(rSizePixel, bClear);
+pRetval->SetOutputSizePixel(rSizePixel, true);
 }
 }
 }
@@ -212,7 +209,7 @@ VclPtr VDevBuffer::alloc(OutputDevice& 
rOutDev, const Size& rSize
 rOutDev, bMonoChrome ? DeviceFormat::BITMASK : 
DeviceFormat::DEFAULT,
 bTransparent ? DeviceFormat::DEFAULT : DeviceFormat::NONE);
 maDeviceTemplates[pRetval] = &rOutDev;
-pRetval->SetOutputSizePixel(rSizePixel, bClear);
+pRetval->SetOutputSizePixel(rSizePixel, true);
 }
 else
 {
@@ -273,13 +270,11 @@ VDevBuffer& getVDevBuffer()
 return *aVDevBuffer.get();
 }
 
-impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const 
basegfx::B2DRange& rRange,
- bool bContentTransparent)
+impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const 
basegfx::B2DRange& rRange)
 : mrOutDev(rOutDev)
 , mpContent(nullptr)
 , mpMask(nullptr)
 , mpAlpha(nullptr)
-, mbContentTransparent(bContentTransparent)
 {
 basegfx::B2DRange aRangePixel(rRange);
 aRangePixel.transform(mrOutDev.GetViewTransformation());
@@ -294,29 +289,13 @@ impBufferDevice::impBufferDevice(OutputDevice& rOutDev, 
const basegfx::B2DRange&
 if (!isVisible())
 return;
 
-#ifdef IOS
-// Exact mechanism unknown, but for some reason SmartArt
-// rendering, especially shadows, is broken on iOS unless
-// we pass 'true' here. Are virtual devices always de
-// facto cleared when created on other platforms?
-mpContent
-= getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, false, 
bContentTransparent);
-#else
-mpContent
-= getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), false, false, 
bContentTransparent);
-#endif
+mpContent = getVDevBuffer

[Libreoffice-commits] core.git: drawinglayer/source include/vcl vcl/source

2017-09-28 Thread Noel Grandin
 drawinglayer/source/primitive2d/epsprimitive2d.cxx |2 +-
 include/vcl/gfxlink.hxx|2 +-
 vcl/source/gdi/gfxlink.cxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit ce301dadcbbf8d0f0a71c7eaebca9bfad2e08801
Author: Noel Grandin 
Date:   Thu Sep 28 11:28:15 2017 +0200

convert GfxLink::IsEqual to operator==

exactly one use site

Change-Id: Id0a75d46c459be213e81b47aa6c1194c87aec848
Reviewed-on: https://gerrit.libreoffice.org/42891
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/drawinglayer/source/primitive2d/epsprimitive2d.cxx 
b/drawinglayer/source/primitive2d/epsprimitive2d.cxx
index 197a0b1d9032..533cdb30ce52 100644
--- a/drawinglayer/source/primitive2d/epsprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/epsprimitive2d.cxx
@@ -60,7 +60,7 @@ namespace drawinglayer
 const EpsPrimitive2D& rCompare = static_cast(rPrimitive);
 
 return (getEpsTransform() == rCompare.getEpsTransform()
-&& getGfxLink().IsEqual(rCompare.getGfxLink())
+&& getGfxLink() == rCompare.getGfxLink()
 && getMetaFile() == rCompare.getMetaFile());
 }
 
diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
index 3632b66d23f3..d8eef9e3ce3a 100644
--- a/include/vcl/gfxlink.hxx
+++ b/include/vcl/gfxlink.hxx
@@ -83,7 +83,7 @@ public:
 // pBuff = The Graphic data. This class takes 
ownership of this
 GfxLink( std::unique_ptr pBuf, sal_uInt32 
nBufSize, GfxLinkType nType );
 
-boolIsEqual( const GfxLink& ) const;
+booloperator==( const GfxLink& ) const;
 
 GfxLinkType GetType() const { return meType;}
 
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
index 135ba2dbb69f..a7a33ad1c862 100644
--- a/vcl/source/gdi/gfxlink.cxx
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -41,7 +41,7 @@ GfxLink::GfxLink( std::unique_ptr pBuf, 
sal_uInt32 nSize, GfxLinkTy
 mpSwapInData = std::shared_ptr(pBuf.release(), 
pBuf.get_deleter());  // std::move(pBuf) does not compile on Jenkins MacOSX (24 
May 2016)
 }
 
-bool GfxLink::IsEqual( const GfxLink& rGfxLink ) const
+bool GfxLink::operator==( const GfxLink& rGfxLink ) const
 {
 bool bIsEqual = false;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: drawinglayer/source include/vcl vcl/source

2014-11-01 Thread Chris Sherlock
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |7 -
 include/vcl/outdev.hxx  |4 -
 vcl/source/outdev/polyline.cxx  |   61 ++--
 3 files changed, 29 insertions(+), 43 deletions(-)

New commits:
commit 498a40f33908791c3b2409a1ccb4b3c81ea1e032
Author: Chris Sherlock 
Date:   Sun Nov 2 13:10:13 2014 +1100

vcl: Refactor OutputDevice::TryDrawPolyLineDirect()

I've renamed TryDrawPolyLineDirect() to DrawPolyLineDirect() and also
renamed TryDrawPolyLineDirectNoAACheck() to drawPolyLineDirectNoAACheck().
However, at the same time I feel that there is no need to call on
drawPolyLineDirectNoAACheck in most instances, because DrawPolyLineDirect
does an AA check before it can continue anyway. There is one instance where
constantly checking the AA check is inefficient because it's in a loop, in
that case then we call directly on drawPolyLineDirectNoAACheck, but this is
the only case it is necessary.

Change-Id: Ie0320bfc45b5c0e1ac6ce35912da3e2897af9429
Reviewed-on: https://gerrit.libreoffice.org/12190
Reviewed-by: Chris Sherlock 
Tested-by: Chris Sherlock 

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index ddd6d33..d287739 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -173,10 +173,7 @@ namespace drawinglayer
 aLocalPolygon.transform(maCurrentTransformation);
 
 // try drawing; if it did not work, use standard fallback
-if(mpOutputDevice->TryDrawPolyLineDirect(
-aLocalPolygon,
-0.0,
-fTransparency))
+if(mpOutputDevice->DrawPolyLineDirect( aLocalPolygon, 0.0, 
fTransparency))
 {
 return true;
 }
@@ -258,7 +255,7 @@ namespace drawinglayer
 {
 bHasPoints = true;
 
-if(mpOutputDevice->TryDrawPolyLineDirect(
+if(mpOutputDevice->DrawPolyLineDirect(
 aSingle,
 fLineWidth,
 fTransparency,
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 161342f..f505f04 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -726,7 +726,7 @@ public:
 voidDrawPolyLine( const Polygon& rPoly,
   const LineInfo& rLineInfo );
 
-boolTryDrawPolyLineDirect(
+boolDrawPolyLineDirect(
 const basegfx::B2DPolygon& rB2DPolygon,
 double fLineWidth = 0.0,
 double fTransparency = 0.0,
@@ -742,7 +742,7 @@ private:
 
 // #i101491#
 // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's 
bool. Contains no AA check.
-SAL_DLLPRIVATE bool TryDrawPolyLineDirectNoAACheck(
+SAL_DLLPRIVATE bool drawPolyLineDirectNoAACheck(
 const basegfx::B2DPolygon& rB2DPolygon,
 double fLineWidth = 0.0,
 double fTransparency = 0.0,
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index 89e27c7..d896bd1 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -52,33 +52,25 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly )
 if ( mbInitLineColor )
 InitLineColor();
 
-const bool bTryAA( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) &&
-   mpGraphics->supportsOperation(OutDevSupport_B2DDraw) &&
-   ROP_OVERPAINT == GetRasterOp() &&
-   IsLineColor());
-
 // use b2dpolygon drawing if possible
-if(bTryAA)
+if ( DrawPolyLineDirect( rPoly.getB2DPolygon() ) )
 {
-if ( TryDrawPolyLineDirectNoAACheck( rPoly.getB2DPolygon() ) )
-{
-basegfx::B2DPolygon aB2DPolyLine(rPoly.getB2DPolygon());
-const ::basegfx::B2DHomMatrix aTransform = 
ImplGetDeviceTransformation();
-const ::basegfx::B2DVector aB2DLineWidth( 1.0, 1.0 );
+basegfx::B2DPolygon aB2DPolyLine(rPoly.getB2DPolygon());
+const ::basegfx::B2DHomMatrix aTransform = 
ImplGetDeviceTransformation();
+const ::basegfx::B2DVector aB2DLineWidth( 1.0, 1.0 );
 
-// transform the polygon
-aB2DPolyLine.transform( aTransform );
+// transform the polygon
+aB2DPolyLine.transform( aTransform );
 
-if(mnAntialiasing & ANTIALIASING_PIXELSNAPHAIRLINE)
-{
-aB2DPolyLine = 
basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine);
-