vcl/source/gdi/FileDefinitionWidgetDraw.cxx   |   74 +++++++++++---------------
 vcl/uiconfig/theme_definitions/definition.xml |    2 
 2 files changed, 35 insertions(+), 41 deletions(-)

New commits:
commit 212a40aaf7ec3316d5209b688f5f79821f99fbdc
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Mon Mar 11 17:08:18 2019 +0100
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Mon Mar 11 23:09:18 2019 +0100

    widget theme: change the tab item height to (min) 32 px
    
    Change-Id: I1919300071a06242fe832880b46c944989daa4b6
    Reviewed-on: https://gerrit.libreoffice.org/69057
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx 
b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index 213547cc2d3a..64ef751c7476 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -776,10 +776,12 @@ bool FileDefinitionWidgetDraw::getNativeControlRegion(
             if (!pPart)
                 return false;
 
-            rNativeBoundingRegion = tools::Rectangle(
-                rBoundingControlRegion.TopLeft(),
-                Size(rBoundingControlRegion.GetWidth() + pPart->mnMarginWidth,
-                     rBoundingControlRegion.GetHeight() + 
pPart->mnMarginHeight));
+            long nWidth = std::max(rBoundingControlRegion.GetWidth() + 
pPart->mnMarginWidth,
+                                   long(pPart->mnWidth));
+            long nHeight = std::max(rBoundingControlRegion.GetHeight() + 
pPart->mnMarginHeight,
+                                    long(pPart->mnHeight));
+
+            rNativeBoundingRegion = tools::Rectangle(aLocation, Size(nWidth, 
nHeight));
             rNativeContentRegion = rNativeBoundingRegion;
             return true;
         }
diff --git a/vcl/uiconfig/theme_definitions/definition.xml 
b/vcl/uiconfig/theme_definitions/definition.xml
index e91953109554..5a4be114ea97 100644
--- a/vcl/uiconfig/theme_definitions/definition.xml
+++ b/vcl/uiconfig/theme_definitions/definition.xml
@@ -320,7 +320,7 @@
     </progress>
 
     <tabitem>
-        <part value="Entire" margin-width="20" margin-height="6">
+        <part value="Entire" margin-width="8" height="32">
             <state selected="false" extra="first">
                 <external source="tabitem-first.svgx" />
             </state>
commit 897f6f6252f38e93764aa0e72135768ab1ec3679
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Mon Mar 11 16:52:37 2019 +0100
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Mon Mar 11 23:09:08 2019 +0100

    better adjustment algorithm for dynamic sized widgets
    
    A algorithm that gives better results for dynamically sized
    widgets is to increase proportionally only the points in shapes
    that are over the half of the widget width (or height, when
    adjusting the other dimension). This preserves the margins and
    doesn't distort the shape of the paths, which is especially
    visible when the source needs to be largely resized in one
    dimension only.
    
    Change-Id: I2cceb249063387c0f7400ef8d75adb5899aa8c23
    Reviewed-on: https://gerrit.libreoffice.org/69056
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx 
b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index 3c0ad43c99b7..213547cc2d3a 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -165,24 +165,18 @@ void drawFromDrawCommands(gfx::DrawRoot const& rDrawRoot, 
SalGraphics& rGraphics
 
                 basegfx::B2DRange aInputRectangle(rRectangle.maRectangle);
 
+                double fDeltaX = aTargetSurface.getWidth() - 
aSVGRect.getWidth();
+                double fDeltaY = aTargetSurface.getHeight() - 
aSVGRect.getHeight();
+
                 basegfx::B2DRange aFinalRectangle(
-                    aTargetSurface.getMinX() + aInputRectangle.getMinX(),
-                    aTargetSurface.getMinY() + aInputRectangle.getMinY(),
-                    aTargetSurface.getMaxX() - (aSVGRect.getMaxX() - 
aInputRectangle.getMaxX()),
-                    aTargetSurface.getMaxY() - (aSVGRect.getMaxY() - 
aInputRectangle.getMaxY()));
-
-                
aInputRectangle.transform(basegfx::utils::createTranslateB2DHomMatrix(
-                    -aInputRectangle.getMinX(), -aInputRectangle.getMinY()));
-                
aInputRectangle.transform(basegfx::utils::createScaleB2DHomMatrix(
-                    aFinalRectangle.getWidth() / aInputRectangle.getWidth(),
-                    aFinalRectangle.getHeight() / 
aInputRectangle.getHeight()));
-                
aInputRectangle.transform(basegfx::utils::createTranslateB2DHomMatrix(
-                    aFinalRectangle.getMinX() - 0.5,
-                    aFinalRectangle.getMinY()
-                        - 0.5)); // compensate 0.5 for different 
interpretation of where the center of a pixel is
+                    aInputRectangle.getMinX(), aInputRectangle.getMinY(),
+                    aInputRectangle.getMaxX() + fDeltaX, 
aInputRectangle.getMaxY() + fDeltaY);
+
+                
aFinalRectangle.transform(basegfx::utils::createTranslateB2DHomMatrix(
+                    aTargetSurface.getMinX() - 0.5, aTargetSurface.getMinY() - 
0.5));
 
                 basegfx::B2DPolygon aB2DPolygon = 
basegfx::utils::createPolygonFromRect(
-                    aInputRectangle, rRectangle.mnRx / 
aFinalRectangle.getWidth() * 2.0,
+                    aFinalRectangle, rRectangle.mnRx / 
aFinalRectangle.getWidth() * 2.0,
                     rRectangle.mnRy / aFinalRectangle.getHeight() * 2.0);
 
                 if (rRectangle.mpFillColor)
@@ -208,29 +202,27 @@ void drawFromDrawCommands(gfx::DrawRoot const& rDrawRoot, 
SalGraphics& rGraphics
             {
                 auto const& rPath = static_cast<gfx::DrawPath 
const&>(*pDrawBase);
 
-                basegfx::B2DRange 
aPolyPolygonRange(rPath.maPolyPolygon.getB2DRange());
-                basegfx::B2DPolyPolygon aPolyPolygon(rPath.maPolyPolygon);
-
-                basegfx::B2DRange aFinalRectangle(
-                    aTargetSurface.getMinX() + aPolyPolygonRange.getMinX(),
-                    aTargetSurface.getMinY() + aPolyPolygonRange.getMinY(),
-                    aTargetSurface.getMaxX() - (aSVGRect.getMaxX() - 
aPolyPolygonRange.getMaxX()),
-                    aTargetSurface.getMaxY() - (aSVGRect.getMaxY() - 
aPolyPolygonRange.getMaxY()));
-
-                
aPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix(
-                    -aPolyPolygonRange.getMinX(), 
-aPolyPolygonRange.getMinY()));
-
-                double fScaleX = 1.0;
-                double fScaleY = 1.0;
-                if (aPolyPolygonRange.getWidth() > 0.0)
-                    fScaleX = aFinalRectangle.getWidth() / 
aPolyPolygonRange.getWidth();
-                if (aPolyPolygonRange.getHeight() > 0.0)
-                    fScaleY = aFinalRectangle.getHeight() / 
aPolyPolygonRange.getHeight();
-
-                
aPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fScaleX, 
fScaleY));
+                double fDeltaX = aTargetSurface.getWidth() - 
aSVGRect.getWidth();
+                double fDeltaY = aTargetSurface.getHeight() - 
aSVGRect.getHeight();
 
+                basegfx::B2DPolyPolygon aPolyPolygon(rPath.maPolyPolygon);
+                for (auto& rPolygon : aPolyPolygon)
+                {
+                    for (size_t i = 0; i < rPolygon.count(); ++i)
+                    {
+                        auto& rPoint = rPolygon.getB2DPoint(i);
+                        double x = rPoint.getX();
+                        double y = rPoint.getY();
+
+                        if (x > aSVGRect.getCenterX())
+                            x = x + fDeltaX;
+                        if (y > aSVGRect.getCenterY())
+                            y = y + fDeltaY;
+                        rPolygon.setB2DPoint(i, basegfx::B2DPoint(x, y));
+                    }
+                }
                 
aPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix(
-                    aFinalRectangle.getMinX() - 0.5, aFinalRectangle.getMinY() 
- 0.5));
+                    aTargetSurface.getMinX() - 0.5, aTargetSurface.getMinY() - 
0.5));
 
                 if (rPath.mpFillColor)
                 {
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to