From ba8a70365ef459c967cd8a71a6d48ca53dd341bd Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 20 Feb 2018 16:03:20 +0100 Subject: New loplugin:nestedunnamed Change-Id: Ifb434589ef08428ce609bc7a40b015d4df13224c Reviewed-on: https://gerrit.libreoffice.org/50048 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- .../source/engine/opengl/TransitionerImpl.cxx | 591 ++++++++++----------- slideshow/source/engine/slide/slideimpl.cxx | 45 +- 2 files changed, 313 insertions(+), 323 deletions(-) (limited to 'slideshow/source/engine') diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx index 299dff9862ab..b0ceabef524b 100644 --- a/slideshow/source/engine/opengl/TransitionerImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx @@ -464,358 +464,353 @@ void OGLTransitionerImpl::createTexture( GLuint* texID, CHECK_GL_ERROR(); } -namespace +class OGLColorSpace : public cppu::WeakImplHelper< css::rendering::XIntegerBitmapColorSpace > { - class OGLColorSpace : public cppu::WeakImplHelper< css::rendering::XIntegerBitmapColorSpace > - { - private: - uno::Sequence< sal_Int8 > maComponentTags; - uno::Sequence< sal_Int32 > maBitCounts; +private: + uno::Sequence< sal_Int8 > maComponentTags; + uno::Sequence< sal_Int32 > maBitCounts; - virtual sal_Int8 SAL_CALL getType( ) override + virtual sal_Int8 SAL_CALL getType( ) override + { + return rendering::ColorSpaceType::RGB; + } + virtual uno::Sequence< sal_Int8 > SAL_CALL getComponentTags( ) override + { + return maComponentTags; + } + virtual sal_Int8 SAL_CALL getRenderingIntent( ) override + { + return rendering::RenderingIntent::PERCEPTUAL; + } + virtual uno::Sequence< beans::PropertyValue > SAL_CALL getProperties( ) override + { + return uno::Sequence< beans::PropertyValue >(); + } + virtual uno::Sequence< double > SAL_CALL convertColorSpace( const uno::Sequence< double >& deviceColor, + const uno::Reference< rendering::XColorSpace >& targetColorSpace ) override + { + // TODO(P3): if we know anything about target + // colorspace, this can be greatly sped up + uno::Sequence aIntermediate( + convertToARGB(deviceColor)); + return targetColorSpace->convertFromARGB(aIntermediate); + } + virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) override + { + const double* pIn( deviceColor.getConstArray() ); + const std::size_t nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast(this), 0); + + uno::Sequence< rendering::RGBColor > aRes(nLen/4); + rendering::RGBColor* pOut( aRes.getArray() ); + for( std::size_t i=0; i SAL_CALL getComponentTags( ) override + return aRes; + } + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) override + { + const double* pIn( deviceColor.getConstArray() ); + const std::size_t nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( std::size_t i=0; i SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) override + { + const double* pIn( deviceColor.getConstArray() ); + const std::size_t nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( std::size_t i=0; i SAL_CALL getProperties( ) override + return aRes; + } + virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override + { + const rendering::RGBColor* pIn( rgbColor.getConstArray() ); + const std::size_t nLen( rgbColor.getLength() ); + + uno::Sequence< double > aRes(nLen*4); + double* pColors=aRes.getArray(); + for( std::size_t i=0; i(); + *pColors++ = pIn->Red; + *pColors++ = pIn->Green; + *pColors++ = pIn->Blue; + *pColors++ = 1.0; + ++pIn; } - virtual uno::Sequence< double > SAL_CALL convertColorSpace( const uno::Sequence< double >& deviceColor, - const uno::Reference< rendering::XColorSpace >& targetColorSpace ) override + return aRes; + } + virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override + { + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const std::size_t nLen( rgbColor.getLength() ); + + uno::Sequence< double > aRes(nLen*4); + double* pColors=aRes.getArray(); + for( std::size_t i=0; i aIntermediate( - convertToARGB(deviceColor)); - return targetColorSpace->convertFromARGB(aIntermediate); + *pColors++ = pIn->Red; + *pColors++ = pIn->Green; + *pColors++ = pIn->Blue; + *pColors++ = pIn->Alpha; + ++pIn; } - virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) override - { - const double* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); - ENSURE_ARG_OR_THROW2(nLen%4==0, - "number of channels no multiple of 4", - static_cast(this), 0); + return aRes; + } + virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override + { + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const std::size_t nLen( rgbColor.getLength() ); - uno::Sequence< rendering::RGBColor > aRes(nLen/4); - rendering::RGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) override + uno::Sequence< double > aRes(nLen*4); + double* pColors=aRes.getArray(); + for( std::size_t i=0; i(this), 0); - - uno::Sequence< rendering::ARGBColor > aRes(nLen/4); - rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; iRed/pIn->Alpha; + *pColors++ = pIn->Green/pIn->Alpha; + *pColors++ = pIn->Blue/pIn->Alpha; + *pColors++ = pIn->Alpha; + ++pIn; } - virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) override + return aRes; + } + + // XIntegerBitmapColorSpace + virtual sal_Int32 SAL_CALL getBitsPerPixel( ) override + { + return 32; + } + virtual uno::Sequence< sal_Int32 > SAL_CALL getComponentBitCounts( ) override + { + return maBitCounts; + } + virtual sal_Int8 SAL_CALL getEndianness( ) override + { + return util::Endianness::LITTLE; + } + virtual uno::Sequence SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< sal_Int8 >& deviceColor, + const uno::Reference< rendering::XColorSpace >& targetColorSpace ) override + { + if( dynamic_cast(targetColorSpace.get()) ) { - const double* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); + const sal_Int8* pIn( deviceColor.getConstArray() ); + const std::size_t nLen( deviceColor.getLength() ); ENSURE_ARG_OR_THROW2(nLen%4==0, "number of channels no multiple of 4", static_cast(this), 0); - uno::Sequence< rendering::ARGBColor > aRes(nLen/4); - rendering::ARGBColor* pOut( aRes.getArray() ); + uno::Sequence aRes(nLen); + double* pOut( aRes.getArray() ); for( std::size_t i=0; i SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override + else { - const rendering::RGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< double > aRes(nLen*4); - double* pColors=aRes.getArray(); - for( std::size_t i=0; iRed; - *pColors++ = pIn->Green; - *pColors++ = pIn->Blue; - *pColors++ = 1.0; - ++pIn; - } - return aRes; - } - virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override - { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< double > aRes(nLen*4); - double* pColors=aRes.getArray(); - for( std::size_t i=0; iRed; - *pColors++ = pIn->Green; - *pColors++ = pIn->Blue; - *pColors++ = pIn->Alpha; - ++pIn; - } - return aRes; - } - virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override - { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< double > aRes(nLen*4); - double* pColors=aRes.getArray(); - for( std::size_t i=0; iRed/pIn->Alpha; - *pColors++ = pIn->Green/pIn->Alpha; - *pColors++ = pIn->Blue/pIn->Alpha; - *pColors++ = pIn->Alpha; - ++pIn; - } - return aRes; - } - - // XIntegerBitmapColorSpace - virtual sal_Int32 SAL_CALL getBitsPerPixel( ) override - { - return 32; - } - virtual uno::Sequence< sal_Int32 > SAL_CALL getComponentBitCounts( ) override - { - return maBitCounts; + // TODO(P3): if we know anything about target + // colorspace, this can be greatly sped up + uno::Sequence aIntermediate( + convertIntegerToARGB(deviceColor)); + return targetColorSpace->convertFromARGB(aIntermediate); } - virtual sal_Int8 SAL_CALL getEndianness( ) override + } + virtual uno::Sequence< sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< sal_Int8 >& deviceColor, + const uno::Reference< rendering::XIntegerBitmapColorSpace >& targetColorSpace ) override + { + if( dynamic_cast(targetColorSpace.get()) ) { - return util::Endianness::LITTLE; + // it's us, so simply pass-through the data + return deviceColor; } - virtual uno::Sequence SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< sal_Int8 >& deviceColor, - const uno::Reference< rendering::XColorSpace >& targetColorSpace ) override + else { - if( dynamic_cast(targetColorSpace.get()) ) - { - const sal_Int8* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); - ENSURE_ARG_OR_THROW2(nLen%4==0, - "number of channels no multiple of 4", - static_cast(this), 0); - - uno::Sequence aRes(nLen); - double* pOut( aRes.getArray() ); - for( std::size_t i=0; i aIntermediate( - convertIntegerToARGB(deviceColor)); - return targetColorSpace->convertFromARGB(aIntermediate); - } + // TODO(P3): if we know anything about target + // colorspace, this can be greatly sped up + uno::Sequence aIntermediate( + convertIntegerToARGB(deviceColor)); + return targetColorSpace->convertIntegerFromARGB(aIntermediate); } - virtual uno::Sequence< sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< sal_Int8 >& deviceColor, - const uno::Reference< rendering::XIntegerBitmapColorSpace >& targetColorSpace ) override + } + virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< sal_Int8 >& deviceColor ) override + { + const sal_Int8* pIn( deviceColor.getConstArray() ); + const std::size_t nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast(this), 0); + + uno::Sequence< rendering::RGBColor > aRes(nLen/4); + rendering::RGBColor* pOut( aRes.getArray() ); + for( std::size_t i=0; i(targetColorSpace.get()) ) - { - // it's us, so simply pass-through the data - return deviceColor; - } - else - { - // TODO(P3): if we know anything about target - // colorspace, this can be greatly sped up - uno::Sequence aIntermediate( - convertIntegerToARGB(deviceColor)); - return targetColorSpace->convertIntegerFromARGB(aIntermediate); - } - } - virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< sal_Int8 >& deviceColor ) override - { - const sal_Int8* pIn( deviceColor.getConstArray() ); - const std::size_t nLen( deviceColor.getLength() ); - ENSURE_ARG_OR_THROW2(nLen%4==0, - "number of channels no multiple of 4", - static_cast(this), 0); - - uno::Sequence< rendering::RGBColor > aRes(nLen/4); - rendering::RGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i SAL_CALL convertIntegerToARGB( const uno::Sequence< sal_Int8 >& deviceColor ) override + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const uno::Sequence< sal_Int8 >& deviceColor ) override + { + const sal_Int8* pIn( deviceColor.getConstArray() ); + const std::size_t nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( std::size_t i=0; i(this), 0); - - uno::Sequence< rendering::ARGBColor > aRes(nLen/4); - rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i SAL_CALL convertIntegerToPARGB( const uno::Sequence< sal_Int8 >& deviceColor ) override + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< sal_Int8 >& deviceColor ) override + { + const sal_Int8* pIn( deviceColor.getConstArray() ); + const std::size_t nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( std::size_t i=0; i(this), 0); - - uno::Sequence< rendering::ARGBColor > aRes(nLen/4); - rendering::ARGBColor* pOut( aRes.getArray() ); - for( std::size_t i=0; i SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override - { - const rendering::RGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< sal_Int8 > aRes(nLen*4); - sal_Int8* pColors=aRes.getArray(); - for( std::size_t i=0; iRed); - *pColors++ = vcl::unotools::toByteColor(pIn->Green); - *pColors++ = vcl::unotools::toByteColor(pIn->Blue); - *pColors++ = -1; - ++pIn; - } - return aRes; - } + virtual uno::Sequence< sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) override + { + const rendering::RGBColor* pIn( rgbColor.getConstArray() ); + const std::size_t nLen( rgbColor.getLength() ); - virtual uno::Sequence< sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override + uno::Sequence< sal_Int8 > aRes(nLen*4); + sal_Int8* pColors=aRes.getArray(); + for( std::size_t i=0; i aRes(nLen*4); - sal_Int8* pColors=aRes.getArray(); - for( std::size_t i=0; iRed); - *pColors++ = vcl::unotools::toByteColor(pIn->Green); - *pColors++ = vcl::unotools::toByteColor(pIn->Blue); - *pColors++ = vcl::unotools::toByteColor(pIn->Alpha); - ++pIn; - } - return aRes; + *pColors++ = vcl::unotools::toByteColor(pIn->Red); + *pColors++ = vcl::unotools::toByteColor(pIn->Green); + *pColors++ = vcl::unotools::toByteColor(pIn->Blue); + *pColors++ = -1; + ++pIn; } + return aRes; + } - virtual uno::Sequence< sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override - { - const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); - const std::size_t nLen( rgbColor.getLength() ); - - uno::Sequence< sal_Int8 > aRes(nLen*4); - sal_Int8* pColors=aRes.getArray(); - for( std::size_t i=0; iRed/pIn->Alpha); - *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha); - *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha); - *pColors++ = vcl::unotools::toByteColor(pIn->Alpha); - ++pIn; - } - return aRes; - } + virtual uno::Sequence< sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override + { + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const std::size_t nLen( rgbColor.getLength() ); - public: - OGLColorSpace() : - maComponentTags(4), - maBitCounts(4) + uno::Sequence< sal_Int8 > aRes(nLen*4); + sal_Int8* pColors=aRes.getArray(); + for( std::size_t i=0; iRed); + *pColors++ = vcl::unotools::toByteColor(pIn->Green); + *pColors++ = vcl::unotools::toByteColor(pIn->Blue); + *pColors++ = vcl::unotools::toByteColor(pIn->Alpha); + ++pIn; } - }; + return aRes; + } - struct OGLColorSpaceHolder : public rtl::StaticWithInit, OGLColorSpaceHolder> + virtual uno::Sequence< sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) override { - uno::Reference operator()() + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const std::size_t nLen( rgbColor.getLength() ); + + uno::Sequence< sal_Int8 > aRes(nLen*4); + sal_Int8* pColors=aRes.getArray(); + for( std::size_t i=0; iRed/pIn->Alpha); + *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha); + *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha); + *pColors++ = vcl::unotools::toByteColor(pIn->Alpha); + ++pIn; } - }; + return aRes; + } - uno::Reference const & - getOGLColorSpace() +public: + OGLColorSpace() : + maComponentTags(4), + maBitCounts(4) { - return OGLColorSpaceHolder::get(); + sal_Int8* pTags = maComponentTags.getArray(); + sal_Int32* pBitCounts = maBitCounts.getArray(); + pTags[0] = rendering::ColorComponentTag::RGB_RED; + pTags[1] = rendering::ColorComponentTag::RGB_GREEN; + pTags[2] = rendering::ColorComponentTag::RGB_BLUE; + pTags[3] = rendering::ColorComponentTag::ALPHA; + + pBitCounts[0] = + pBitCounts[1] = + pBitCounts[2] = + pBitCounts[3] = 8; } -} +}; + +struct OGLColorSpaceHolder : public rtl::StaticWithInit, OGLColorSpaceHolder> +{ + uno::Reference operator()() + { + return new OGLColorSpace(); + } +}; -namespace { +uno::Reference const & +getOGLColorSpace() +{ + return OGLColorSpaceHolder::get(); +} void buildMipmaps( GLint internalFormat, GLsizei width, GLsizei height, GLenum format, @@ -838,8 +833,6 @@ void buildMipmaps( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); } -} - void OGLTransitionerImpl::impl_createTexture( bool useMipmap, uno::Sequence& data, diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index c81dfff0d10a..ab1214538af3 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -688,37 +688,34 @@ SlideBitmapSharedPtr SlideImpl::createCurrentSlideBitmap( const UnoViewSharedPtr return std::make_shared( pBitmap ); } -namespace +class MainSequenceSearcher { - class MainSequenceSearcher +public: + MainSequenceSearcher() { - public: - MainSequenceSearcher() - { - maSearchKey.Name = "node-type"; - maSearchKey.Value <<= presentation::EffectNodeType::MAIN_SEQUENCE; - } - - void operator()( const uno::Reference< animations::XAnimationNode >& xChildNode ) - { - uno::Sequence< beans::NamedValue > aUserData( xChildNode->getUserData() ); + maSearchKey.Name = "node-type"; + maSearchKey.Value <<= presentation::EffectNodeType::MAIN_SEQUENCE; + } - if( findNamedValue( aUserData, maSearchKey ) ) - { - maMainSequence = xChildNode; - } - } + void operator()( const uno::Reference< animations::XAnimationNode >& xChildNode ) + { + uno::Sequence< beans::NamedValue > aUserData( xChildNode->getUserData() ); - const uno::Reference< animations::XAnimationNode >& getMainSequence() const + if( findNamedValue( aUserData, maSearchKey ) ) { - return maMainSequence; + maMainSequence = xChildNode; } + } - private: - beans::NamedValue maSearchKey; - uno::Reference< animations::XAnimationNode > maMainSequence; - }; -} + const uno::Reference< animations::XAnimationNode >& getMainSequence() const + { + return maMainSequence; + } + +private: + beans::NamedValue maSearchKey; + uno::Reference< animations::XAnimationNode > maMainSequence; +}; bool SlideImpl::implPrefetchShow() { -- cgit v1.2.3