diff options
author | José Guilherme Vanz <vanz@libreoffice.org> | 2013-10-20 01:43:00 -0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-10-20 12:25:45 +0000 |
commit | 288f0029c69ab0532165877637a146f774d5e740 (patch) | |
tree | bbe152c9f188fc17a75613bb10c00b1ba4c75055 /vcl/source | |
parent | 63f705643ee92421a8bc689fb33190340d8ece6a (diff) |
fdo#52622 - Reduce copy and paste code
This commit removes copy and paste code, creating a constructor for it
Change-Id: I7a66cfda7fc7c11308d155a7a890352fdacfaacc
Reviewed-on: https://gerrit.libreoffice.org/6356
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/image.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index 32bd32466fb9..33fd9192dcea 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -21,6 +21,7 @@ #include <boost/scoped_array.hpp> +#include <osl/file.hxx> #include <tools/debug.hxx> #include <tools/stream.hxx> #include <tools/rc.h> @@ -29,6 +30,7 @@ #include <vcl/settings.hxx> #include <vcl/outdev.hxx> #include <vcl/graph.hxx> +#include <vcl/graphicfilter.hxx> #include <vcl/svapp.hxx> #include <vcl/image.hxx> #include <vcl/imagerepository.hxx> @@ -151,6 +153,20 @@ Image::Image( const uno::Reference< graphic::XGraphic >& rxGraphic ) : ImplInit( aGraphic.GetBitmapEx() ); } +Image::Image( const OUString &rFileUrl ) : + mpImplData( NULL ) +{ + DBG_CTOR( Image, NULL ); + OUString aTmp; + osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); + Graphic aGraphic; + const OUString aFilterName( IMP_PNG ); + if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) ) + { + ImplInit( aGraphic.GetBitmapEx() ); + } +} + Image::~Image() { DBG_DTOR( Image, NULL ); |