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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Mar 4 21:42:43 UTC 2019


 vcl/source/gdi/WidgetDefinition.cxx |   38 ++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

New commits:
commit d81a11220d76eeecac80b27b25a4576b6e78210b
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Feb 8 21:49:19 2019 +0100
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Mar 4 22:42:18 2019 +0100

    Simplify code to add a draw command (subclass)
    
    Change-Id: Ie7bd304f80ddfa55dc2ed986fa033b25e845d449
    Reviewed-on: https://gerrit.libreoffice.org/68698
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/source/gdi/WidgetDefinition.cxx b/vcl/source/gdi/WidgetDefinition.cxx
index 8b717a035c91..2cff3aedd36e 100644
--- a/vcl/source/gdi/WidgetDefinition.cxx
+++ b/vcl/source/gdi/WidgetDefinition.cxx
@@ -11,7 +11,6 @@
 #include <widgetdraw/WidgetDefinition.hxx>
 
 #include <sal/config.h>
-#include <tools/stream.hxx>
 #include <unordered_map>
 
 namespace vcl
@@ -92,17 +91,16 @@ void WidgetDefinitionState::addDrawRectangle(Color aStrokeColor, sal_Int32 nStro
                                              Color aFillColor, float fX1, float fY1, float fX2,
                                              float fY2, sal_Int32 nRx, sal_Int32 nRy)
 {
-    std::shared_ptr<DrawCommand> pCommand(std::make_shared<RectangleDrawCommand>());
+    auto pCommand(std::make_shared<RectangleDrawCommand>());
     pCommand->maStrokeColor = aStrokeColor;
     pCommand->maFillColor = aFillColor;
     pCommand->mnStrokeWidth = nStrokeWidth;
-    RectangleDrawCommand& rRectCommand = static_cast<RectangleDrawCommand&>(*pCommand);
-    rRectCommand.mnRx = nRx;
-    rRectCommand.mnRy = nRy;
-    rRectCommand.mfX1 = fX1;
-    rRectCommand.mfY1 = fY1;
-    rRectCommand.mfX2 = fX2;
-    rRectCommand.mfY2 = fY2;
+    pCommand->mnRx = nRx;
+    pCommand->mnRy = nRy;
+    pCommand->mfX1 = fX1;
+    pCommand->mfY1 = fY1;
+    pCommand->mfX2 = fX2;
+    pCommand->mfY2 = fY2;
     mpDrawCommands.push_back(std::move(pCommand));
 }
 
@@ -110,29 +108,27 @@ void WidgetDefinitionState::addDrawCircle(Color aStrokeColor, sal_Int32 nStrokeW
                                           Color aFillColor, float fX1, float fY1, float fX2,
                                           float fY2)
 {
-    std::shared_ptr<DrawCommand> pCommand(std::make_shared<CircleDrawCommand>());
+    auto pCommand(std::make_shared<CircleDrawCommand>());
     pCommand->maStrokeColor = aStrokeColor;
     pCommand->maFillColor = aFillColor;
     pCommand->mnStrokeWidth = nStrokeWidth;
-    CircleDrawCommand& rCircleCommand = static_cast<CircleDrawCommand&>(*pCommand);
-    rCircleCommand.mfX1 = fX1;
-    rCircleCommand.mfY1 = fY1;
-    rCircleCommand.mfX2 = fX2;
-    rCircleCommand.mfY2 = fY2;
+    pCommand->mfX1 = fX1;
+    pCommand->mfY1 = fY1;
+    pCommand->mfX2 = fX2;
+    pCommand->mfY2 = fY2;
     mpDrawCommands.push_back(std::move(pCommand));
 }
 
 void WidgetDefinitionState::addDrawLine(Color aStrokeColor, sal_Int32 nStrokeWidth, float fX1,
                                         float fY1, float fX2, float fY2)
 {
-    std::shared_ptr<DrawCommand> pCommand(std::make_shared<LineDrawCommand>());
+    auto pCommand(std::make_shared<LineDrawCommand>());
     pCommand->maStrokeColor = aStrokeColor;
     pCommand->mnStrokeWidth = nStrokeWidth;
-    LineDrawCommand& rLineCommand = static_cast<LineDrawCommand&>(*pCommand);
-    rLineCommand.mfX1 = fX1;
-    rLineCommand.mfY1 = fY1;
-    rLineCommand.mfX2 = fX2;
-    rLineCommand.mfY2 = fY2;
+    pCommand->mfX1 = fX1;
+    pCommand->mfY1 = fY1;
+    pCommand->mfX2 = fX2;
+    pCommand->mfY2 = fY2;
     mpDrawCommands.push_back(std::move(pCommand));
 }
 


More information about the Libreoffice-commits mailing list