/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_CPPCANVAS_RENDERER_HXX #define INCLUDED_CPPCANVAS_RENDERER_HXX #include #include #include #include #include #include #include namespace basegfx { class B2DRange; } /* Definition of Renderer interface */ namespace cppcanvas { class Renderer : public virtual CanvasGraphic { public: /** Render subset of metafile to given canvas This method renders the given subset of the content to the associated canvas. @param nStartIndex The index of the first action to be rendered (the indices correspond roughly to the action indices of the originating GDIMetaFile. Note, although, that certain actions, e.g. text, accounts for more than one index: a text produces as many addressable indices as it has characters). @param nEndIndex The index of the first action _not_ painted anymore, i.e. the action after the last action rendered (the indices correspond roughly to the action indices of the originating GDIMetaFile. Note, although, that certain actions, e.g. text, accounts for more than one index: a text produces as many addressable indices as it has characters). @return whether the rendering finished successfully. */ virtual bool drawSubset( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const = 0; /** Query bounding box of metafile subset This method queries the actual bounding box of the given subset, when rendered on the associated canvas. @param nStartIndex The index of the first action to be rendered (the indices correspond roughly to the action indices of the originating GDIMetaFile. Note, although, that certain actions, e.g. text, accounts for more than one index: a text produces as many addressable indices as it has characters). @param nEndIndex The index of the first action _not_ painted anymore, i.e. the action after the last action rendered (the indices correspond roughly to the action indices of the originating GDIMetaFile. Note, although, that certain actions, e.g. text, accounts for more than one index: a text produces as many addressable indices as it has characters). @return the bounding box of the specified subset */ virtual ::basegfx::B2DRange getSubsetArea( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const = 0; /** Parameters for the Renderer */ struct Parameters { /// Optionally forces the fill color attribute for all actions ::std::optional< IntSRGBA > maFillColor; /// Optionally forces the line color attribute for all actions ::std::optional< IntSRGBA > maLineColor; /// Optionally forces the text color attribute for all actions ::std::optional< IntSRGBA > maTextColor; /// Optionally forces the given fontname for all text actions ::std::optional< OUString > maFontName; /** Optionally transforms all text output actions with the given matrix (in addition to the overall canvas transformation). Note that the matrix given here is applied to the unit rect coordinate system, i.e. the metafile is assumed to be contained in the unit rect. */ ::std::optional< ::basegfx::B2DHomMatrix > maTextTransformation; /// Optionally forces the given font weight for all text actions ::std::optional< sal_Int8 > maFontWeight; /// Optionally forces the given font letter form (italics etc.) for all text actions ::std::optional< sal_Int8 > maFontLetterForm; /// Optionally forces underlining for all text actions ::std::optional< bool > maFontUnderline; }; }; typedef std::shared_ptr< ::cppcanvas::Renderer > RendererSharedPtr; } #endif // INCLUDED_CPPCANVAS_RENDERER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ n value='distro/collabora/lov-6.4'>distro/collabora/lov-6.4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-01-18silence use-after-free warning in mdds for gcc12.3 in optimized buildAron Budea
Follow-up to e7c4166f1e150b10bc2ac52e93f8ad7503db09dc as GCC 12.3 seems to be affected, too. Change-Id: I8e5ba9be64625ffd21d43e627996a9ea8602ce9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162181 Tested-by: Jenkins Reviewed-by: Aron Budea <aron.budea@collabora.com>
2024-01-15cid#1546160 COPY_INSTEAD_OF_MOVECaolán McNamara
and cid#1545547 COPY_INSTEAD_OF_MOVE cid#1545642 COPY_INSTEAD_OF_MOVE cid#1557206 COPY_INSTEAD_OF_MOVE Change-Id: I7a1bd4fcd065d4546917deb5d279691c8450f456 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162061 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-07-31silence use-after-free warning in mdds for gcc12 in optimized buildChristian Lohmaier
Change-Id: I15385718dd705128e9e02541f33e46069dec5251 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154890 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2023-01-26Upgrade mdds and orcus to 2.1.0 and 0.18.0, respectivelyKohei Yoshida
Change-Id: I288b5b54bd07d951bcc68afda7514bde730193dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146107 Tested-by: Jenkins Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2022-09-05tdf#150749 Find and replace on very large sheetNoel Grandin
This requires 2 fixes (*) First, we are deleting from the front of a block in the mdds storage, so apply a similar patch to mdds to the previous improvement, (*) Then, we end up with an O(n^2) situation in ScRangesList::Join. But we are only displaying this data, and in fact, we only display the first 1000 ranges anyway, so just clamp the list to 1000 entries, and pass a flag up to the dialog so that we can report that we stopped counting. (*) I had to tweak the testSharedStringPool unit test, since we are not actually clearing the underlying mdds storage, the reference counts do not drop until we have removed all the elements in that block of mdds storage (because then the entire block is destructed, including the not-yet destructed elements) Change-Id: I2c998f81dfb46453a48fce1254fd253d299d12b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139400 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-21tdf#126109 calc slow when replacing string to numberNoel Grandin
Normally, the answer to repeated erase(begin()) is to walk backwards through the array. However, sometimes (like here), doing so will mean that we end up inserting at the front of a different array, which means we don't gain anything. So, store an extra field in the mdds block, which implements a kind of very simple approximation of a circular array. This gives me a 50% speedup for this bug. This is the simplest possible thing that could work. It could probably be made a lot more sophisticated in terms of not wasting space. Change-Id: I036349786896f28b617dfd0924f5743db6a57695 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135896 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-27external/mdds: Avoid -Werror=use-after-free (GCC 12 trunk)Stephan Bergmann
> In file included from workdir/UnpackedTarball/mdds/include/mdds/flat_segment_tree.hpp:37, > from sc/inc/columnspanset.hxx:16, > from sc/source/core/data/columnspanset.cxx:10: > In function ‘void mdds::__st::intrusive_ptr_add_ref(node<T>*) [with T = mdds::flat_segment_tree<int, bool>]’, > inlined from ‘boost::intrusive_ptr<T>::intrusive_ptr(const boost::intrusive_ptr<T>&) [with T = mdds::__st::node<mdds::flat_segment_tree<int, bool> >]’ at workdir/UnpackedTarball/boost/boost/smart_ptr/intrusive_ptr.hpp:93:44, > inlined from ‘boost::intrusive_ptr<T>& boost::intrusive_ptr<T>::operator=(const boost::intrusive_ptr<T>&) [with T = mdds::__st::node<mdds::flat_segment_tree<int, bool> >]’ at workdir/UnpackedTarball/boost/boost/smart_ptr/intrusive_ptr.hpp:154:9, > inlined from ‘mdds::flat_segment_tree<_Key, _Value>::flat_segment_tree(const mdds::flat_segment_tree<_Key, _Value>&) [with _Key = int; _Value = bool]’ at workdir/UnpackedTarball/mdds/include/mdds/flat_segment_tree_def.inl:88:25: > workdir/UnpackedTarball/mdds/include/mdds/node.hpp:244:10: error: pointer used after ‘void operator delete(void*, std::size_t)’ [-Werror=use-after-free] > 244 | ++p->refcount; > | ~~~^~~~~~~~ > In function ‘void mdds::__st::intrusive_ptr_release(node<T>*) [with T = mdds::flat_segment_tree<int, bool>]’, > inlined from ‘void mdds::__st::intrusive_ptr_release(node<T>*) [with T = mdds::flat_segment_tree<int, bool>]’ at workdir/UnpackedTarball/mdds/include/mdds/node.hpp:248:13, > inlined from ‘boost::intrusive_ptr<T>::~intrusive_ptr() [with T = mdds::__st::node<mdds::flat_segment_tree<int, bool> >]’ at workdir/UnpackedTarball/boost/boost/smart_ptr/intrusive_ptr.hpp:98:44, > inlined from ‘boost::intrusive_ptr<T>& boost::intrusive_ptr<T>::operator=(const boost::intrusive_ptr<T>&) [with T = mdds::__st::node<mdds::flat_segment_tree<int, bool> >]’ at workdir/UnpackedTarball/boost/boost/smart_ptr/intrusive_ptr.hpp:154:9, > inlined from ‘mdds::flat_segment_tree<_Key, _Value>::flat_segment_tree(const mdds::flat_segment_tree<_Key, _Value>&) [with _Key = int; _Value = bool]’ at workdir/UnpackedTarball/mdds/include/mdds/flat_segment_tree_def.inl:87:19: > workdir/UnpackedTarball/mdds/include/mdds/node.hpp:252:9: note: call to ‘void operator delete(void*, std::size_t)’ here > 252 | delete p; > | ^~~~~~~~ etc. The warning is apparently new in GCC 12 trunk (see <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=671a283636de75f7ed638ee6b01ed2d44361b8b6> "Add -Wuse-after-free [PR80532]"), and I'm not entirely sure whether this is a true or false positive, but the fix looks somewhat plausible, and at least also my (Clang) ASan+UBSan build does a successful `make check` with (and without) this change. Change-Id: I63fafceba8d1b4e0ddd7cf2e58403a3bc763e53c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129008 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-12-14Update mdds to 2.0.1.Kohei Yoshida
Change-Id: I7d5e5432d75caf671434977b48b415839cbf90b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126795 Tested-by: Jenkins Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2021-11-03Upgrade mdds and liborcus to 2.0.0 and 0.17.0, respectively.Kohei Yoshida
Change-Id: I9e856fc2d61f1789a6f1702514837860539a0f49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124573 Tested-by: Jenkins Tested-by: René Engelhard <rene@debian.org> Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2021-06-10external/mdds: Mark patch as upstreamedStephan Bergmann
Change-Id: Id61fbaafb575a8c745e5b3cc5b2ff8ae4526d94c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116960 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-09external/mdds: -Werror,-Wunused-but-set-variable (Clang 13 trunk)Stephan Bergmann
> In file included from svl/source/misc/gridprinter.cxx:16: > In file included from workdir/UnpackedTarball/mdds/include/mdds/multi_type_matrix.hpp:37: > In file included from workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector.hpp:1358: > workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector_def.inl:851:15: error: variable 'start_pos' set but not used [-Werror,-Wunused-but-set-variable] > size_type start_pos = m_cur_size; > ^ > workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector_def.inl:3926:15: error: variable 'start_row_itr' set but not used [-Werror,-Wunused-but-set-variable] > size_type start_row_itr = start_row_in_block1; > ^ Change-Id: I1f5e7e1f6a2b8457eb6d65dbd65336d3684c2b89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116808 Tested-by: Jenkins Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2020-09-10Upgrade mdds to 1.7.0.Kohei Yoshida
Change-Id: I2a66017fb5f93ecd39dbf980aa04798dbd33b3e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102343 Tested-by: Jenkins Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2020-02-09Update mdds to 1.6.0.Kohei Yoshida
Change-Id: Iff350b47d5d237e0bb3ffcce0e80ce867c74191d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88191 Tested-by: Kohei Yoshida <kohei@libreoffice.org> Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2019-11-26Mark external/mdds/Wdeprecated-copy.patch as upstreamedStephan Bergmann
Change-Id: Idfcf192dd93df3809b5da195356747a7d3ae3d3d Reviewed-on: https://gerrit.libreoffice.org/83761 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-26external/mdds: -Werror,-Wdeprecated-copyStephan Bergmann
> In file included from sc/source/core/data/cellvalues.cxx:12: > In file included from sc/inc/column.hxx:28: > In file included from sc/inc/mtvelements.hxx:30: > In file included from workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector.hpp:33: > workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector_itr.hpp:74:9: error: definition of implicit copy assignment operator for 'private_data' is deprecated because it has a user-declared copy constructor [-Werror,-Wdeprecated-copy] > private_data(const private_data& other) : > ^ > workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector_itr.hpp:44:8: note: in implicit copy assignment operator for 'mdds::detail::mtv::iterator_value_node<unsigned long, mdds::mtv::base_element_block>::private_data' first required here > struct iterator_value_node > ^ > workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector_itr.hpp:219:20: note: in implicit copy assignment operator for 'mdds::detail::mtv::iterator_value_node<unsigned long, mdds::mtv::base_element_block>' first required here > m_cur_node = other.m_cur_node; > ^ > workdir/UnpackedTarball/mdds/include/mdds/multi_type_vector_itr.hpp:238:7: note: in instantiation of member function 'mdds::detail::mtv::iterator_common_base<mdds::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreEvent>::iterator_trait>::operator=' requested here > class iterator_base : public iterator_common_base<_Trait> > ^ with recent Clang 10 trunk, similar to <https://gerrit.libreoffice.org/#/c/83698/> "Remove some redundantly user-declared copy ctors and assignment ops" Change-Id: I156674bad367ca68404c3c75d61ec72b401c6305 Reviewed-on: https://gerrit.libreoffice.org/83700 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-15Correctly pack mdds 1.5.0.Kohei Yoshida
Turns out the earlier mdds 1.5.0 package was not correctly packaged. I've fixed that now, and re-published the 1.5.0 package, which does contain the patch from Lubos. Change-Id: I1ff7d6568568860f7cccd3be3bc29aaaebe7fd73 Reviewed-on: https://gerrit.libreoffice.org/77483 Tested-by: Jenkins Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
2019-05-20cache mdds positions during ScDocument::CopyBlockFromClip() (tdf#112000)Luboš Luňák
Make RefUpdateContext and ScColumn::UpdateReferenceOnCopy() use the same sc::ColumnBlockPositionSet that CopyFromClipContext uses. Without it pathological cases like in tdf#112000 trigger quadratic cost because of repeated mdds searches from the start. Includes also an mdds patch that allows it to search backwards from a position hint. Without it, this would be very difficult to fix otherwise, as CopyFromClip() in ScDocument::CopyBlockFromClip() moves the position hint past the area that UpdateReferenceOnCopy() would use. It also just plain makes sense to try to go backwards in an std::vector. Change-Id: I985e3a40e4abf1a824e55c76d82579882fa75cc2 Reviewed-on: https://gerrit.libreoffice.org/72424 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>