vcl/inc/graphic/UnoGraphic.hxx            |    5 +----
 vcl/inc/graphic/UnoGraphicDescriptor.hxx  |    3 ++-
 vcl/source/gdi/graph.cxx                  |    4 +---
 vcl/source/graphic/UnoGraphic.cxx         |   10 +++-------
 vcl/source/graphic/UnoGraphicProvider.cxx |   16 ++++++++--------
 5 files changed, 15 insertions(+), 23 deletions(-)

New commits:
commit d60e206a29829aca66917a576f5137bf9f813ab7
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Oct 2 12:44:39 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Oct 4 13:42:27 2025 +0200

    No need to use vector of known size, just to convert to Sequence
    
    The conversion has to copy contained references. Just use Sequence
    from start.
    
    Change-Id: Ib209dcfdaae9752ef2476eb1afb84ca6989ff678
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191849
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx 
b/vcl/source/graphic/UnoGraphicProvider.cxx
index 0892bd55316f..a53e8b54838a 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -441,14 +441,14 @@ uno::Sequence< uno::Reference<graphic::XGraphic> > 
SAL_CALL GraphicProvider::que
     std::vector<std::shared_ptr<Graphic>> aGraphics = 
rFilter.ImportGraphics(std::move(aStreams));
 
     // Returning: graphics to UNO objects.
-    std::vector< uno::Reference<graphic::XGraphic> > aRet;
-    for (const auto& pGraphic : aGraphics)
-    {
-        assert(pGraphic);
-        aRet.push_back(pGraphic->GetXGraphic());
-    }
-
-    return comphelper::containerToSequence(aRet);
+    uno::Sequence<uno::Reference<graphic::XGraphic>> aRet(aGraphics.size());
+    std::transform(aGraphics.begin(), aGraphics.end(), aRet.getArray(),
+                   [](const auto& pGraphic)
+                   {
+                       assert(pGraphic);
+                       return pGraphic->GetXGraphic();
+                   });
+    return aRet;
 }
 
 void ImplCalculateCropRect( ::Graphic const & rGraphic, const 
text::GraphicCrop& rGraphicCropLogic, tools::Rectangle& rGraphicCropPixel )
commit 572da82de4a60b7bb12a1b62ac7b1dfa2887eccd
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Oct 2 12:42:42 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Oct 4 13:42:17 2025 +0200

    Simplify unographic::Graphic construction
    
    There is no need for a separate init() call - it can be merged into ctor.
    
    Change-Id: Ibb7bb33f489081bfebe1a5c233e99fd5a92ece4d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191848
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/graphic/UnoGraphic.hxx b/vcl/inc/graphic/UnoGraphic.hxx
index 66169352aa6b..760e8209c071 100644
--- a/vcl/inc/graphic/UnoGraphic.hxx
+++ b/vcl/inc/graphic/UnoGraphic.hxx
@@ -35,12 +35,9 @@ class Graphic final : public css::graphic::XGraphic,
                 public ::unographic::GraphicDescriptor
 {
 public:
-    Graphic();
+    Graphic(const ::Graphic& rGraphic);
     virtual ~Graphic() noexcept override;
 
-    using ::unographic::GraphicDescriptor::init;
-    void init(const ::Graphic& rGraphic);
-
     const ::Graphic& GetGraphic() const { return maGraphic; }
 
     // XInterface
diff --git a/vcl/inc/graphic/UnoGraphicDescriptor.hxx 
b/vcl/inc/graphic/UnoGraphicDescriptor.hxx
index 883282c4f6b3..e4d4352799dc 100644
--- a/vcl/inc/graphic/UnoGraphicDescriptor.hxx
+++ b/vcl/inc/graphic/UnoGraphicDescriptor.hxx
@@ -69,7 +69,6 @@ public:
     GraphicDescriptor();
     virtual ~GraphicDescriptor() noexcept override;
 
-    void init( const ::Graphic& rGraphic );
     void init( const OUString& rURL );
     void init( const css::uno::Reference< css::io::XInputStream >& rxIStm, 
const OUString& rURL );
 
@@ -81,6 +80,8 @@ public:
     virtual void SAL_CALL release() noexcept override;
 
 protected:
+    void init( const ::Graphic& rGraphic );
+
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index b99614a4f55d..1108761a0719 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -351,9 +351,7 @@ uno::Reference<css::graphic::XGraphic> 
Graphic::GetXGraphic() const
     if (GetType() == GraphicType::NONE)
         return nullptr;
 
-    rtl::Reference<unographic::Graphic> pUnoGraphic = new unographic::Graphic;
-    pUnoGraphic->init(*this);
-    return pUnoGraphic;
+    return new unographic::Graphic(*this);
 }
 
 Size Graphic::GetPrefSize() const
diff --git a/vcl/source/graphic/UnoGraphic.cxx 
b/vcl/source/graphic/UnoGraphic.cxx
index 36451a028787..719e0a6d13bd 100644
--- a/vcl/source/graphic/UnoGraphic.cxx
+++ b/vcl/source/graphic/UnoGraphic.cxx
@@ -39,20 +39,16 @@ using namespace com::sun::star;
 
 namespace unographic {
 
-Graphic::Graphic()
+Graphic::Graphic(const ::Graphic& rGraphic)
+    : maGraphic(rGraphic)
 {
+    unographic::GraphicDescriptor::init(maGraphic);
 }
 
 Graphic::~Graphic() noexcept
 {
 }
 
-void Graphic::init(const ::Graphic& rGraphic)
-{
-    maGraphic = rGraphic;
-    unographic::GraphicDescriptor::init(maGraphic);
-}
-
 uno::Any SAL_CALL Graphic::queryInterface( const uno::Type & rType )
 {
     uno::Any aAny;

Reply via email to