include/vcl/image.hxx | 36 +++++++++++++++++++++--------------- vcl/source/image/Image.cxx | 10 ++++++---- 2 files changed, 27 insertions(+), 19 deletions(-)
New commits: commit 578a4dedaa1f296f78ca5408abf2d889830ae149 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Jan 23 21:55:40 2019 +0100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Jan 24 11:36:48 2019 +0100 Cleanup and simplify Image.{cxx,hxx} no functional change Change-Id: I8d7171913d14ccb81b88c82362cfa997f9b9964a Reviewed-on: https://gerrit.libreoffice.org/66823 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx index c115a676102d..b2f64c138bac 100644 --- a/include/vcl/image.hxx +++ b/include/vcl/image.hxx @@ -28,8 +28,9 @@ #include <memory> struct ImplImage; -namespace com { namespace sun { namespace star { namespace graphic { class XGraphic;} } } } -namespace com { namespace sun { namespace star { namespace uno { template <class interface_type> class Reference; } } } } + +namespace com::sun::star::graphic { class XGraphic; } +namespace com::sun::star::uno { template <class interface_type> class Reference; } namespace vcl { @@ -43,7 +44,7 @@ namespace vcl }; } -#define IMAGELIST_IMAGE_NOTFOUND (sal_uInt16(0xFFFF)) +#define IMAGELIST_IMAGE_NOTFOUND (sal_uInt16(0xFFFF)) enum class StockImage { Yes }; @@ -52,19 +53,24 @@ class SAL_WARN_UNUSED VCL_DLLPUBLIC Image friend class ::OutputDevice; public: - Image(); - explicit Image( const BitmapEx& rBitmapEx ); - explicit Image( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic ); - explicit Image( const OUString &rPNGFileUrl ); - explicit Image( StockImage, const OUString &rPNGFilePath ); - - Size GetSizePixel() const; + Image(); + explicit Image(BitmapEx const & rBitmapEx); + explicit Image(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic); + explicit Image(OUString const & rPNGFileUrl); + explicit Image(StockImage , OUString const & rPNGFilePath); - BitmapEx GetBitmapEx() const; + Size GetSizePixel() const; + BitmapEx GetBitmapEx() const; - bool operator!() const { return !mpImplData; } - bool operator==( const Image& rImage ) const; - bool operator!=( const Image& rImage ) const { return !(Image::operator==( rImage )); } + bool operator!() const + { + return !mpImplData; + } + bool operator==(const Image& rImage) const; + bool operator!=(const Image& rImage) const + { + return !(Image::operator==(rImage)); + } void Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize = nullptr); @@ -72,7 +78,7 @@ private: std::shared_ptr<ImplImage> mpImplData; - SAL_DLLPRIVATE void ImplInit( const BitmapEx& rBmpEx ); + SAL_DLLPRIVATE void ImplInit(BitmapEx const & rBmpEx); }; #endif // INCLUDED_VCL_IMAGE_HXX diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx index e22f5f814304..af0b0eae0176 100644 --- a/vcl/source/image/Image.cxx +++ b/vcl/source/image/Image.cxx @@ -38,6 +38,8 @@ #include <rtl/strbuf.hxx> #endif +using namespace css; + Image::Image() { } @@ -47,7 +49,7 @@ Image::Image(const BitmapEx& rBitmapEx) ImplInit(rBitmapEx); } -Image::Image(const css::uno::Reference< css::graphic::XGraphic >& rxGraphic) +Image::Image(uno::Reference<graphic::XGraphic> const & rxGraphic) { const Graphic aGraphic(rxGraphic); ImplInit(aGraphic.GetBitmapEx()); @@ -58,7 +60,7 @@ Image::Image(const OUString & rFileUrl) sal_Int32 nIndex = 0; if (rFileUrl.getToken( 0, '/', nIndex ) == "private:graphicrepository") { - mpImplData.reset(new ImplImage(rFileUrl.copy(nIndex))); + mpImplData = std::make_shared<ImplImage>(rFileUrl.copy(nIndex)); } else { @@ -71,14 +73,14 @@ Image::Image(const OUString & rFileUrl) } Image::Image(StockImage, const OUString & rFileUrl) - : mpImplData(new ImplImage(rFileUrl)) + : mpImplData(std::make_shared<ImplImage>(rFileUrl)) { } void Image::ImplInit(const BitmapEx& rBitmapEx) { if (!rBitmapEx.IsEmpty()) - mpImplData.reset(new ImplImage(rBitmapEx)); + mpImplData = std::make_shared<ImplImage>(rBitmapEx); } Size Image::GetSizePixel() const _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits