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

2020-05-28 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   21 +---
 vcl/source/outdev/outdev.cxx|   12 +++--
 2 files changed, 23 insertions(+), 10 deletions(-)

New commits:
commit 541e5a9e84c42fbf20158b01a4feaa0f226e9ed0
Author: Mike Kaganski 
AuthorDate: Thu May 14 14:42:24 2020 +0300
Commit: Mike Kaganski 
CommitDate: Fri May 29 06:23:26 2020 +0200

tdf#49247, tdf#101181: Fix effect bounds

This will avoid cutting rightmost and bottommost pixels from the effects,
caused by casting of range dimensions to integers.

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

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 131e51f34913..32afe33e6147 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -993,8 +993,11 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const 
primitive2d::GlowPrimitiv
 // glow primitive.
 mpOutputDevice->Erase();
 process(rCandidate);
-Bitmap bitmap = mpOutputDevice->GetBitmap(Point(aRange.getMinX(), 
aRange.getMinY()),
-  Size(aRange.getWidth(), 
aRange.getHeight()));
+const tools::Rectangle 
aRect(static_cast(std::floor(aRange.getMinX())),
+ 
static_cast(std::floor(aRange.getMinY())),
+ 
static_cast(std::ceil(aRange.getMaxX())),
+ 
static_cast(std::ceil(aRange.getMaxY(;
+Bitmap bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), 
aRect.GetSize());
 
 AlphaMask mask = ProcessAndBlurAlphaMask(bitmap, fBlurRadius, 
fBlurRadius, nTransparency);
 
@@ -1007,7 +1010,7 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const 
primitive2d::GlowPrimitiv
 
 // back to old OutDev
 mpOutputDevice = pLastOutputDevice;
-mpOutputDevice->DrawBitmapEx(Point(aRange.getMinX(), 
aRange.getMinY()), result);
+mpOutputDevice->DrawBitmapEx(aRect.TopLeft(), result);
 }
 else
 SAL_WARN("drawinglayer", "Temporary buffered virtual device is not 
visible");
@@ -1036,8 +1039,11 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D(
 rCandidate.setMaskGeneration();
 process(rCandidate);
 rCandidate.setMaskGeneration(false);
-Bitmap bitmap = mpOutputDevice->GetBitmap(Point(aRange.getMinX(), 
aRange.getMinY()),
-  Size(aRange.getWidth(), 
aRange.getHeight()));
+const tools::Rectangle 
aRect(static_cast(std::floor(aRange.getMinX())),
+ 
static_cast(std::floor(aRange.getMinY())),
+ 
static_cast(std::ceil(aRange.getMaxX())),
+ 
static_cast(std::ceil(aRange.getMaxY(;
+Bitmap bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), 
aRect.GetSize());
 
 AlphaMask mask = ProcessAndBlurAlphaMask(bitmap, -fBlurRadius, 
fBlurRadius, 0);
 
@@ -1045,15 +1051,14 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D(
 
 mpOutputDevice->Erase();
 process(rCandidate);
-bitmap = mpOutputDevice->GetBitmap(Point(aRange.getMinX(), 
aRange.getMinY()),
-   Size(aRange.getWidth(), 
aRange.getHeight()));
+bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), aRect.GetSize());
 
 // alpha mask will be scaled up automatically to match bitmap
 BitmapEx result(bitmap, mask);
 
 // back to old OutDev
 mpOutputDevice = pLastOutputDevice;
-mpOutputDevice->DrawBitmapEx(Point(aRange.getMinX(), 
aRange.getMinY()), result);
+mpOutputDevice->DrawBitmapEx(aRect.TopLeft(), result);
 }
 else
 SAL_WARN("drawinglayer", "Temporary buffered virtual device is not 
visible");
commit 946b01e2d4a41b06415f6371b7b52dca090e7b86
Author: Mike Kaganski 
AuthorDate: Thu May 14 14:42:24 2020 +0300
Commit: Mike Kaganski 
CommitDate: Fri May 29 06:23:16 2020 +0200

Consider mpAlphaVDev when processing metafile in OutputDevice::DrawOutDev

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

diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 18f273b8185a..020a57a6a40c 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -415,8 +415,16 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const 
Size& rDestSize,
 
 if ( mpMetaFile )
 {
-const Bitmap aBmp( rOutDev.GetBitmap( rSrcPt, rSrcSize ) );
- 

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

2014-04-26 Thread Tomaž Vajngerl
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   10 +++
 vcl/source/filter/wmf/winmtf.cxx|   22 +++-
 vcl/source/filter/wmf/winmtf.hxx|2 +
 3 files changed, 28 insertions(+), 6 deletions(-)

New commits:
commit 17ca93a6e592d3109e47c756fcfe8ac975acae5f
Author: Tomaž Vajngerl tomaz.vajng...@collabora.com
Date:   Sat Apr 26 19:20:22 2014 +0200

fdo#74336 need to transform dash length / dot length / distance

Dash length, dot length and distance also need to be world
transformed to be compatible with device metrics.

Change-Id: I57c04f5010006aaf8c1c32e0949cb39b7f2bc67d

diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 7aa7337..7c4b01d 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -473,6 +473,20 @@ void WinMtfOutput::ImplMap( Font rFont )
 rFont.SetOrientation( 3600 - rFont.GetOrientation() );
 }
 
+sal_Int32 WinMtfOutput::ImplConvertWidth(const sal_Int32 aWidth)
+{
+Size aSize(aWidth, 0);
+return ImplMap(aSize).Width();
+}
+
+void WinMtfOutput::ImplMap(LineInfo rLineInfo)
+{
+rLineInfo.SetWidth(ImplConvertWidth(rLineInfo.GetWidth()));
+rLineInfo.SetDashLen(ImplConvertWidth(rLineInfo.GetDashLen()));
+rLineInfo.SetDotLen(ImplConvertWidth(rLineInfo.GetDotLen()));
+rLineInfo.SetDistance(ImplConvertWidth(rLineInfo.GetDistance()));
+}
+
 Polygon WinMtfOutput::ImplMap( Polygon rPolygon )
 {
 sal_uInt16 nPoints = rPolygon.GetSize();
@@ -682,9 +696,7 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* 
pStyle )
 else if ( eType == GDI_PEN )
 {
 WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle;
-Size aSize(pLineStyle-aLineInfo.GetWidth(), 0);
-aSize = ImplMap(aSize);
-pLineStyle-aLineInfo.SetWidth(aSize.Width());
+ImplMap(pLineStyle-aLineInfo);
 }
 }
 sal_uInt32 nIndex;
@@ -716,9 +728,7 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, 
GDIObjectType eType, void* pS
 else if ( eType == GDI_PEN )
 {
 WinMtfLineStyle* pLineStyle = (WinMtfLineStyle*) pStyle;
-Size aSize(pLineStyle-aLineInfo.GetWidth(), 0);
-aSize = ImplMap(aSize);
-pLineStyle-aLineInfo.SetWidth(aSize.Width());
+ImplMap(pLineStyle-aLineInfo);
 }
 }
 if ( (sal_uInt32)nIndex = vGDIObj.size() )
diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx
index 035686c..52b1848 100644
--- a/vcl/source/filter/wmf/winmtf.hxx
+++ b/vcl/source/filter/wmf/winmtf.hxx
@@ -619,6 +619,8 @@ class WinMtfOutput
 SizeImplMap( const Size rSz );
 Rectangle   ImplMap( const Rectangle rRectangle );
 voidImplMap( Font rFont );
+sal_Int32   ImplConvertWidth(const sal_Int32 aWidth);
+voidImplMap(LineInfo rLineInfo);
 PolygonImplMap( Polygon rPolygon );
 PolyPolygonImplMap( PolyPolygon rPolyPolygon );
 PolygonImplScale( Polygon rPolygon );
commit 6d0005d95f20a326fe308a7c59dd2801f0d0b241
Author: Tomaž Vajngerl tomaz.vajng...@collabora.com
Date:   Sat Apr 26 19:13:31 2014 +0200

fdo#74336 draw hairline if line width is small

RenderPolygonStrokePrimitive2D draws a simple hairline if the
line width is less than 1.0 (and less than 1.5 if no AA is used)
so in tryDrawPolygonStrokePrimitive2DDirect we need to reflect
this behaviour - otherwise the lines are drawn too small.

Change-Id: Icd3d8f35a00346b1d624b6df010f43ed21968d04

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 73d12f3..1a4db95 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -237,6 +237,16 @@ namespace drawinglayer
 fLineWidth = aLineWidth.getLength();
 }
 
+// draw simple hairline for small line widths
+// see also RenderPolygonStrokePrimitive2D which is used if this 
try fails
+bool bIsAntiAliasing = getOptionsDrawinglayer().IsAntiAliasing();
+if (   (basegfx::fTools::lessOrEqual(fLineWidth, 1.0)  
bIsAntiAliasing)
+|| (basegfx::fTools::lessOrEqual(fLineWidth, 1.5)  
!bIsAntiAliasing))
+{
+// draw simple hairline
+fLineWidth = 0.0;
+}
+
 bool bHasPoints(false);
 bool bTryWorked(false);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-04-24 Thread Armin Le Grand
 drawinglayer/source/primitive2d/metafileprimitive2d.cxx |7 ++-
 vcl/source/gdi/font.cxx |6 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 7cf38082fd797b316d0f8b3e8227244362755efd
Author: Armin Le Grand a...@apache.org
Date:   Wed Apr 23 16:20:16 2014 +

Resolves: #i124686# reuse already set font for interpreting...

the MetaFile action META_TEXTRECT_ACTION correctly

(cherry picked from commit 7ce0a0a7680255159beae7726ec63d539ef0c7f9)

Change-Id: If802a58ae0fb38292d5a875d85448cc2c3967066

diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx 
b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index ab098ad..46d4467 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -2116,8 +2116,13 @@ namespace
 drawinglayer::primitive2d::Primitive2DSequence 
xSubContent;
 {
 rTargetHolders.Push();
-// #i# for sub-Mteafile contents, do start 
with new, default render state
+
+// for sub-Mteafile contents, do start with 
new, default render state
+// #i124686# ...but copy font, this is already 
set accordingly
+const Font rTargetFont = 
rPropertyHolders.Current().getFont();
 rPropertyHolders.PushDefault();
+
rPropertyHolders.Current().setFont(rTargetFont);
+
 interpretMetafile(aGDIMetaFile, 
rTargetHolders, rPropertyHolders, rViewInformation);
 xSubContent = 
rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current());
 rPropertyHolders.Pop();
commit 121aac37673c1a8142db01e26e50be6de7b36987
Author: Armin Le Grand a...@apache.org
Date:   Wed Apr 23 16:19:30 2014 +

Related: #i124686# give empty constructed default font a default height

(cherry picked from commit 4a7c54e07713f02a5658471e4aa9163de53f7460)

Change-Id: Iaff17eb95d1ad1e1b9bca4388b03703899d9a0db

diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
index 489304e..60230e3 100644
--- a/vcl/source/gdi/font.cxx
+++ b/vcl/source/gdi/font.cxx
@@ -63,6 +63,12 @@ Impl_Font::Impl_Font() :
 mbVertical  = false;
 mbTransparent   = true;
 mbConfigLookup  = false;
+
+// #i124686# the Size is defaulted to (0,0) when default constructed,
+// this is not useful for a default font. Init it to a useful default
+// so that the Font::Font() constructor which uses a 'naked' static
+// Impl_Font instance (aStaticImplFont) creates a useful default font
+maSize = Size(0, 16);
 }
 
 Impl_Font::Impl_Font( const Impl_Font rImplFont )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits