diff options
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/cairo/cairo_canvashelper.cxx | 21 | ||||
-rw-r--r-- | canvas/source/cairo/cairo_devicehelper.cxx | 15 | ||||
-rw-r--r-- | canvas/source/tools/canvastools.cxx | 24 | ||||
-rw-r--r-- | canvas/source/vcl/devicehelper.cxx | 18 |
4 files changed, 22 insertions, 56 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 7805da9bb56d..32124af830f9 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -41,7 +41,6 @@ #include <com/sun/star/util/Endianness.hpp> #include <comphelper/sequence.hxx> #include <cppuhelper/implbase.hxx> -#include <rtl/instance.hxx> #include <rtl/math.hxx> #include <tools/diagnose_ex.h> #include <vcl/bitmapex.hxx> @@ -1973,22 +1972,16 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: } }; - struct CairoNoAlphaColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>, - CairoNoAlphaColorSpaceHolder> + uno::Reference<rendering::XIntegerBitmapColorSpace>& GetCairoNoAlphaColorSpace() { - uno::Reference<rendering::XIntegerBitmapColorSpace> operator()() - { - return new CairoNoAlphaColorSpace(); - } + static uno::Reference<rendering::XIntegerBitmapColorSpace> SPACE = new CairoNoAlphaColorSpace(); + return SPACE; }; - struct CairoColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>, - CairoColorSpaceHolder> + uno::Reference<rendering::XIntegerBitmapColorSpace>& GetCairoColorSpace() { - uno::Reference<rendering::XIntegerBitmapColorSpace> operator()() - { - return new CairoColorSpace(); - } + static uno::Reference<rendering::XIntegerBitmapColorSpace> SPACE = new CairoColorSpace(); + return SPACE; }; } @@ -2012,7 +2005,7 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: aLayout.ScanLineBytes = nWidth*4; aLayout.ScanLineStride = aLayout.ScanLineBytes; aLayout.PlaneStride = 0; - aLayout.ColorSpace = mbHaveAlpha ? CairoColorSpaceHolder::get() : CairoNoAlphaColorSpaceHolder::get(); + aLayout.ColorSpace = mbHaveAlpha ? GetCairoColorSpace() : GetCairoNoAlphaColorSpace(); aLayout.Palette.clear(); aLayout.IsMsbFirst = false; diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx index e802e79cc2dd..1c44b4225560 100644 --- a/canvas/source/cairo/cairo_devicehelper.cxx +++ b/canvas/source/cairo/cairo_devicehelper.cxx @@ -210,22 +210,11 @@ namespace cairocanvas return uno::Any(); } - namespace - { - struct DeviceColorSpace: public rtl::StaticWithInit<uno::Reference<rendering::XColorSpace>, - DeviceColorSpace> - { - uno::Reference<rendering::XColorSpace> operator()() - { - return vcl::unotools::createStandardColorSpace(); - } - }; - } - uno::Reference<rendering::XColorSpace> const & DeviceHelper::getColorSpace() const { + static uno::Reference<rendering::XColorSpace> SPACE = vcl::unotools::createStandardColorSpace(); // always the same - return DeviceColorSpace::get(); + return SPACE; } void DeviceHelper::dumpScreenContent() const diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 02af4bb333db..b9b6190df18d 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -51,7 +51,6 @@ #include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp> #include <com/sun/star/util/Endianness.hpp> #include <cppuhelper/implbase.hxx> -#include <rtl/instance.hxx> #include <sal/log.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <tools/diagnose_ex.h> @@ -843,33 +842,18 @@ namespace canvas::tools } }; - struct StandardColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>, - StandardColorSpaceHolder> - { - uno::Reference<rendering::XIntegerBitmapColorSpace> operator()() - { - return new StandardColorSpace(); - } - }; - - struct StandardNoAlphaColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>, - StandardNoAlphaColorSpaceHolder> - { - uno::Reference<rendering::XIntegerBitmapColorSpace> operator()() - { - return new StandardNoAlphaColorSpace(); - } - }; } uno::Reference<rendering::XIntegerBitmapColorSpace> const & getStdColorSpace() { - return StandardColorSpaceHolder::get(); + static uno::Reference<rendering::XIntegerBitmapColorSpace> SPACE = new StandardColorSpace(); + return SPACE; } uno::Reference<rendering::XIntegerBitmapColorSpace> const & getStdColorSpaceWithoutAlpha() { - return StandardNoAlphaColorSpaceHolder::get(); + static uno::Reference<rendering::XIntegerBitmapColorSpace> SPACE = new StandardNoAlphaColorSpace(); + return SPACE; } rendering::IntegerBitmapLayout getStdMemoryLayout( const geometry::IntegerSize2D& rBmpSize ) diff --git a/canvas/source/vcl/devicehelper.cxx b/canvas/source/vcl/devicehelper.cxx index b9d4138aade1..a16ede0f5236 100644 --- a/canvas/source/vcl/devicehelper.cxx +++ b/canvas/source/vcl/devicehelper.cxx @@ -22,7 +22,6 @@ #include <basegfx/utils/canvastools.hxx> #include <basegfx/utils/unopolypolygon.hxx> #include <canvas/canvastools.hxx> -#include <rtl/instance.hxx> #include <tools/stream.hxx> #include <vcl/canvastools.hxx> #include <vcl/dibtools.hxx> @@ -174,22 +173,23 @@ namespace vclcanvas namespace { - struct DeviceColorSpace: public rtl::StaticWithInit<uno::Reference<rendering::XColorSpace>, - DeviceColorSpace> + uno::Reference<rendering::XColorSpace>& GetDeviceColorSpace() { - uno::Reference<rendering::XColorSpace> operator()() + static uno::Reference<rendering::XColorSpace> xColorSpace = + []() { - uno::Reference< rendering::XColorSpace > xColorSpace = canvas::tools::getStdColorSpace(); - assert( xColorSpace.is() ); - return xColorSpace; - } + auto xTmp = canvas::tools::getStdColorSpace(); + assert( xTmp.is() ); + return xTmp; + }(); + return xColorSpace; }; } uno::Reference<rendering::XColorSpace> const & DeviceHelper::getColorSpace() const { // always the same - return DeviceColorSpace::get(); + return GetDeviceColorSpace(); } void DeviceHelper::dumpScreenContent() const |