diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-13 16:36:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-13 19:25:02 +0100 |
commit | fb1825bf3f82eb6b69c6534207c9c89cc535f18b (patch) | |
tree | f8b98f5cb17ae087f44117c71efaa4ebfff27ce2 /canvas | |
parent | 724d34d58b437843e40aaa74008d94cac1465cea (diff) |
loplugin:unusedmethods remove unused code from canvas
which my plugin had previously been ignoring. Since that time, the
plugin has gotten a little smarter, and makes less mistakes.
Change-Id: Id791c932fd056ae7da833436c4dd2600b69a0bfa
Reviewed-on: https://gerrit.libreoffice.org/51212
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/source/cairo/cairo_canvashelper.hxx | 2 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_canvashelper.cxx | 34 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_canvashelper.hxx | 4 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_spritedevicehelper.hxx | 2 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_textlayout.cxx | 6 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_textlayout.hxx | 5 | ||||
-rw-r--r-- | canvas/source/tools/surface.hxx | 1 | ||||
-rw-r--r-- | canvas/source/vcl/canvasbitmaphelper.cxx | 67 | ||||
-rw-r--r-- | canvas/source/vcl/canvasbitmaphelper.hxx | 10 | ||||
-rw-r--r-- | canvas/source/vcl/canvashelper.cxx | 189 | ||||
-rw-r--r-- | canvas/source/vcl/canvashelper.hxx | 12 | ||||
-rw-r--r-- | canvas/source/vcl/spritecanvashelper.cxx | 1 |
12 files changed, 0 insertions, 333 deletions
diff --git a/canvas/source/cairo/cairo_canvashelper.hxx b/canvas/source/cairo/cairo_canvashelper.hxx index 36860c0830f7..3e14b672df40 100644 --- a/canvas/source/cairo/cairo_canvashelper.hxx +++ b/canvas/source/cairo/cairo_canvashelper.hxx @@ -211,8 +211,6 @@ namespace cairocanvas css::rendering::IntegerBitmapLayout getMemoryLayout(); - bool hasAlpha() const { return mbHaveAlpha; } - enum ColorType { LINE_COLOR, FILL_COLOR, TEXT_COLOR, IGNORE_COLOR diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx index e7039ea2e7ed..c4bfde0bed8e 100644 --- a/canvas/source/opengl/ogl_canvashelper.cxx +++ b/canvas/source/opengl/ogl_canvashelper.cxx @@ -92,23 +92,6 @@ namespace oglcanvas namespace { - bool lcl_drawPoint( const CanvasHelper& /*rHelper*/, - const ::basegfx::B2DHomMatrix& rTransform, - GLenum eSrcBlend, - GLenum eDstBlend, - const rendering::ARGBColor& rColor, - const geometry::RealPoint2D& rPoint ) - { - TransformationPreserver aPreserver; - setupState(rTransform, eSrcBlend, eDstBlend, rColor); - - glBegin(GL_POINTS); - glVertex2d(rPoint.X, rPoint.Y); - glEnd(); - - return true; - } - bool lcl_drawLine( const CanvasHelper& /*rHelper*/, const ::basegfx::B2DHomMatrix& rTransform, GLenum eSrcBlend, @@ -398,23 +381,6 @@ namespace oglcanvas mpRecordedActions->clear(); } - void CanvasHelper::drawPoint( const rendering::XCanvas* /*pCanvas*/, - const geometry::RealPoint2D& aPoint, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) - { - if( mpDevice ) - { - mpRecordedActions->push_back( Action() ); - Action& rAct=mpRecordedActions->back(); - - setupGraphicsState( rAct, viewState, renderState ); - rAct.maFunction = std::bind(&lcl_drawPoint, - _1,_2,_3,_4,_5, - aPoint); - } - } - void CanvasHelper::drawLine( const rendering::XCanvas* /*pCanvas*/, const geometry::RealPoint2D& aStartPoint, const geometry::RealPoint2D& aEndPoint, diff --git a/canvas/source/opengl/ogl_canvashelper.hxx b/canvas/source/opengl/ogl_canvashelper.hxx index afdceb74458d..2323f0dab1cb 100644 --- a/canvas/source/opengl/ogl_canvashelper.hxx +++ b/canvas/source/opengl/ogl_canvashelper.hxx @@ -58,10 +58,6 @@ namespace oglcanvas // XCanvas (only providing, not implementing the // interface. Also note subtle method parameter differences) void clear(); - void drawPoint( const css::rendering::XCanvas* pCanvas, - const css::geometry::RealPoint2D& aPoint, - const css::rendering::ViewState& viewState, - const css::rendering::RenderState& renderState ); void drawLine( const css::rendering::XCanvas* pCanvas, const css::geometry::RealPoint2D& aStartPoint, const css::geometry::RealPoint2D& aEndPoint, diff --git a/canvas/source/opengl/ogl_spritedevicehelper.hxx b/canvas/source/opengl/ogl_spritedevicehelper.hxx index 6b7bdc328e0c..38053f22100f 100644 --- a/canvas/source/opengl/ogl_spritedevicehelper.hxx +++ b/canvas/source/opengl/ogl_spritedevicehelper.hxx @@ -115,8 +115,6 @@ namespace oglcanvas bool activateWindowContext(); private: - void resize( const ::basegfx::B2IVector& rNewSize ); - /** Phyical output device Deliberately not a refcounted reference, because of diff --git a/canvas/source/opengl/ogl_textlayout.cxx b/canvas/source/opengl/ogl_textlayout.cxx index 1f966d16a9cf..9a0d641b8b53 100644 --- a/canvas/source/opengl/ogl_textlayout.cxx +++ b/canvas/source/opengl/ogl_textlayout.cxx @@ -176,12 +176,6 @@ namespace oglcanvas return maText; } - void TextLayout::draw( const rendering::ViewState& /*rViewState*/, - const rendering::RenderState& /*rRenderState*/, - const uno::Reference< rendering::XGraphicDevice >& /*xGraphicDevice*/ ) const - { - // TODO - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/opengl/ogl_textlayout.hxx b/canvas/source/opengl/ogl_textlayout.hxx index e9c04e1635ea..b92b023d9949 100644 --- a/canvas/source/opengl/ogl_textlayout.hxx +++ b/canvas/source/opengl/ogl_textlayout.hxx @@ -61,11 +61,6 @@ namespace oglcanvas virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL getFont( ) override; virtual css::rendering::StringContext SAL_CALL getText( ) override; - void draw( const css::rendering::ViewState& rViewState, - const css::rendering::RenderState& rRenderState, - const css::uno::Reference< - css::rendering::XGraphicDevice >& xGraphicDevice ) const; - private: css::rendering::StringContext maText; css::uno::Sequence< double > maLogicalAdvancements; diff --git a/canvas/source/tools/surface.hxx b/canvas/source/tools/surface.hxx index 436e96648d78..ac45ea1965f1 100644 --- a/canvas/source/tools/surface.hxx +++ b/canvas/source/tools/surface.hxx @@ -134,7 +134,6 @@ namespace canvas bool mbIsDirty; private: - void refresh( canvas::IColorBuffer& rBuffer ) const; void prepareRendering(); basegfx::B2DRectangle getUVCoords() const; diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx index ac91c7493414..c2003f6a67cf 100644 --- a/canvas/source/vcl/canvasbitmaphelper.cxx +++ b/canvas/source/vcl/canvasbitmaphelper.cxx @@ -48,19 +48,6 @@ namespace vclcanvas { } - void CanvasBitmapHelper::setBitmap( const BitmapEx& rBitmap ) - { - ENSURE_OR_THROW( mpOutDevProvider, - "Invalid reference device" ); - - mpBackBuffer.reset( new BitmapBackBuffer( rBitmap, - mpOutDevProvider->getOutDev() ) ); - - // tell canvas helper about the new target OutDev (don't - // protect state, it's our own VirDev, anyways) - setOutDev( mpBackBuffer, false ); - } - void CanvasBitmapHelper::init( const BitmapEx& rBitmap, rendering::XGraphicDevice& rDevice, const OutDevProviderSharedPtr& rOutDevReference ) @@ -187,60 +174,6 @@ namespace vclcanvas return aRes; } - void CanvasBitmapHelper::setData( const uno::Sequence< sal_Int8 >& data, - const rendering::IntegerBitmapLayout& rLayout, - const geometry::IntegerRectangle2D& rect ) - { - SAL_INFO( "canvas.vcl", "::vclcanvas::CanvasBitmapHelper::setData()" ); - - if( !mpBackBuffer ) - return; // we're disposed - - const rendering::IntegerBitmapLayout aRefLayout( getMemoryLayout() ); - ENSURE_ARG_OR_THROW( aRefLayout.PlaneStride != rLayout.PlaneStride || - aRefLayout.ColorSpace != rLayout.ColorSpace || - aRefLayout.Palette != rLayout.Palette || - aRefLayout.IsMsbFirst != rLayout.IsMsbFirst, - "Mismatching memory layout" ); - - // retrieve local copies from the BitmapEx, which are later - // stored back. Unfortunately, the BitmapEx does not permit - // in-place modifications, as they are necessary here. - - BitmapEx newBitmap = vcl::bitmap::CanvasBitmapHelperSetData(data, rect, mpBackBuffer->getBitmapReference()); - setBitmap( newBitmap ); - } - - void CanvasBitmapHelper::setPixel( const uno::Sequence< sal_Int8 >& color, - const rendering::IntegerBitmapLayout& rLayout, - const geometry::IntegerPoint2D& pos ) - { - SAL_INFO( "canvas.vcl", "::vclcanvas::CanvasBitmapHelper::setPixel()" ); - - if( !mpBackBuffer ) - return; // we're disposed - - const Size aBmpSize( mpBackBuffer->getBitmapReference().GetSizePixel() ); - - ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aBmpSize.Width(), - "X coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aBmpSize.Height(), - "Y coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( color.getLength() > 3, - "not enough color components" ); - - const rendering::IntegerBitmapLayout aRefLayout( getMemoryLayout() ); - ENSURE_ARG_OR_THROW( aRefLayout.PlaneStride != rLayout.PlaneStride || - aRefLayout.ColorSpace != rLayout.ColorSpace || - aRefLayout.Palette != rLayout.Palette || - aRefLayout.IsMsbFirst != rLayout.IsMsbFirst, - "Mismatching memory layout" ); - - - BitmapEx newBitmapEx = vcl::bitmap::CanvasBitmapHelperSetPixel(color, pos, mpBackBuffer->getBitmapReference()); - setBitmap( newBitmapEx ); - } - uno::Sequence< sal_Int8 > CanvasBitmapHelper::getPixel( rendering::IntegerBitmapLayout& rLayout, const geometry::IntegerPoint2D& pos ) { diff --git a/canvas/source/vcl/canvasbitmaphelper.hxx b/canvas/source/vcl/canvasbitmaphelper.hxx index cf6d4519ab07..fe438a00f011 100644 --- a/canvas/source/vcl/canvasbitmaphelper.hxx +++ b/canvas/source/vcl/canvasbitmaphelper.hxx @@ -90,14 +90,6 @@ namespace vclcanvas getData( css::rendering::IntegerBitmapLayout& bitmapLayout, const css::geometry::IntegerRectangle2D& rect ); - void setData( const css::uno::Sequence< sal_Int8 >& data, - const css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerRectangle2D& rect ); - - void setPixel( const css::uno::Sequence< sal_Int8 >& color, - const css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerPoint2D& pos ); - css::uno::Sequence< sal_Int8 > getPixel( css::rendering::IntegerBitmapLayout& bitmapLayout, const css::geometry::IntegerPoint2D& pos ); @@ -109,8 +101,6 @@ namespace vclcanvas private: - void setBitmap( const BitmapEx& rBitmap ); - BitmapBackBufferSharedPtr mpBackBuffer; OutDevProviderSharedPtr mpOutDevReference; }; diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index afc09d47be68..c0dd0717a965 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -189,28 +189,6 @@ namespace vclcanvas } } - void CanvasHelper::drawPoint( const rendering::XCanvas* , - const geometry::RealPoint2D& aPoint, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) - { - // are we disposed? - if( mpOutDevProvider ) - { - // nope, render - tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDevProvider ); - setupOutDevState( viewState, renderState, LINE_COLOR ); - - const Point aOutPoint( tools::mapRealPoint2D( aPoint, - viewState, renderState ) ); - // TODO(F1): alpha - mpOutDevProvider->getOutDev().DrawPixel( aOutPoint ); - - if( mp2ndOutDevProvider ) - mp2ndOutDevProvider->getOutDev().DrawPixel( aOutPoint ); - } - } - void CanvasHelper::drawLine( const rendering::XCanvas* , const geometry::RealPoint2D& aStartRealPoint2D, const geometry::RealPoint2D& aEndRealPoint2D, @@ -987,173 +965,6 @@ namespace vclcanvas return aRes; } - void CanvasHelper::setData( const uno::Sequence< sal_Int8 >& data, - const rendering::IntegerBitmapLayout& aLayout, - const geometry::IntegerRectangle2D& rect ) - { - if( !mpOutDevProvider.get() ) - return; // we're disposed - - const rendering::IntegerBitmapLayout aRefLayout( getMemoryLayout() ); - ENSURE_ARG_OR_THROW( aRefLayout.PlaneStride != aLayout.PlaneStride || - aRefLayout.ColorSpace != aLayout.ColorSpace || - aRefLayout.Palette != aLayout.Palette || - aRefLayout.IsMsbFirst != aLayout.IsMsbFirst, - "Mismatching memory layout" ); - - OutputDevice& rOutDev( mpOutDevProvider->getOutDev() ); - - tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDevProvider ); - rOutDev.EnableMapMode( false ); - rOutDev.SetAntialiasing( AntialiasingFlags::EnableB2dDraw ); - - const ::tools::Rectangle aRect( vcl::unotools::rectangleFromIntegerRectangle2D(rect) ); - const sal_uInt16 nBitCount( std::min( sal_uInt16(24), rOutDev.GetBitCount() ) ); - const BitmapPalette* pPalette = nullptr; - - if( nBitCount <= 8 ) - { - // TODO(Q1): Extract this to a common place, e.g. GraphicDevice - - // try to determine palette from output device (by - // extracting a 1,1 bitmap, and querying it) - const Point aEmptyPoint; - const Size aSize(1,1); - Bitmap aTmpBitmap( rOutDev.GetBitmap( aEmptyPoint, - aSize ) ); - - Bitmap::ScopedReadAccess pReadAccess( aTmpBitmap ); - - pPalette = &pReadAccess->GetPalette(); - } - - // TODO(F2): Support alpha canvas here - Bitmap aBitmap( aRect.GetSize(), nBitCount, pPalette ); - - bool bCopyBack( false ); // only copy something back, if we - // actually changed some pixel - { - Bitmap::ScopedWriteAccess pWriteAccess( aBitmap ); - - ENSURE_OR_THROW( pWriteAccess.get() != nullptr, - "Could not acquire write access to OutDev bitmap" ); - - // for the time being, always read as RGB - const sal_Int32 nWidth( rect.X2 - rect.X1 ); - const sal_Int32 nHeight( rect.Y2 - rect.Y1 ); - int x, y, nCurrPos(0); - for( y=0; y<nHeight; ++y ) - { - switch( pWriteAccess->GetScanlineFormat() ) - { - case ScanlineFormat::N8BitPal: - { - Scanline pScan = pWriteAccess->GetScanline( y ); - - for( x=0; x<nWidth; ++x ) - { - *pScan++ = static_cast<sal_uInt8>(pWriteAccess->GetBestPaletteIndex( - BitmapColor( data[ nCurrPos ], - data[ nCurrPos+1 ], - data[ nCurrPos+2 ] ) )); - - nCurrPos += 4; - } - } - break; - - case ScanlineFormat::N24BitTcBgr: - { - Scanline pScan = pWriteAccess->GetScanline( y ); - - for( x=0; x<nWidth; ++x ) - { - *pScan++ = data[ nCurrPos+2 ]; - *pScan++ = data[ nCurrPos+1 ]; - *pScan++ = data[ nCurrPos ]; - - nCurrPos += 4; - } - } - break; - - case ScanlineFormat::N24BitTcRgb: - { - Scanline pScan = pWriteAccess->GetScanline( y ); - - for( x=0; x<nWidth; ++x ) - { - *pScan++ = data[ nCurrPos ]; - *pScan++ = data[ nCurrPos+1 ]; - *pScan++ = data[ nCurrPos+2 ]; - - nCurrPos += 4; - } - } - break; - - default: - { - Scanline pScan = pWriteAccess->GetScanline( y ); - - for( x=0; x<nWidth; ++x ) - { - pWriteAccess->SetPixelOnData( pScan, x, BitmapColor( data[ nCurrPos ], - data[ nCurrPos+1 ], - data[ nCurrPos+2 ] ) ); - nCurrPos += 4; - } - } - break; - } - } - - bCopyBack = true; - } - - // copy back only here, since the BitmapAccessors must be - // destroyed beforehand - if( bCopyBack ) - { - // TODO(F2): Support alpha canvas here - rOutDev.DrawBitmap(aRect.TopLeft(), aBitmap); - } - } - - void CanvasHelper::setPixel( const uno::Sequence< sal_Int8 >& color, - const rendering::IntegerBitmapLayout& rLayout, - const geometry::IntegerPoint2D& pos ) - { - if( !mpOutDevProvider.get() ) - return; // we're disposed - - OutputDevice& rOutDev( mpOutDevProvider->getOutDev() ); - - tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDevProvider ); - rOutDev.EnableMapMode( false ); - rOutDev.SetAntialiasing( AntialiasingFlags::EnableB2dDraw ); - - const Size aBmpSize( rOutDev.GetOutputSizePixel() ); - - ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aBmpSize.Width(), - "X coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aBmpSize.Height(), - "Y coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( color.getLength() > 3, - "not enough color components" ); - - const rendering::IntegerBitmapLayout aRefLayout( getMemoryLayout() ); - ENSURE_ARG_OR_THROW( aRefLayout.PlaneStride != rLayout.PlaneStride || - aRefLayout.ColorSpace != rLayout.ColorSpace || - aRefLayout.Palette != rLayout.Palette || - aRefLayout.IsMsbFirst != rLayout.IsMsbFirst, - "Mismatching memory layout" ); - - // TODO(F2): Support alpha canvas here - rOutDev.DrawPixel( vcl::unotools::pointFromIntegerPoint2D( pos ), - ::canvas::tools::stdIntSequenceToColor( color )); - } - uno::Sequence< sal_Int8 > CanvasHelper::getPixel( rendering::IntegerBitmapLayout& rLayout, const geometry::IntegerPoint2D& pos ) { diff --git a/canvas/source/vcl/canvashelper.hxx b/canvas/source/vcl/canvashelper.hxx index e48191208482..888b6de3a543 100644 --- a/canvas/source/vcl/canvashelper.hxx +++ b/canvas/source/vcl/canvashelper.hxx @@ -104,10 +104,6 @@ namespace vclcanvas // XCanvas (only providing, not implementing the // interface. Also note subtle method parameter differences) void clear(); - void drawPoint( const css::rendering::XCanvas* rCanvas, - const css::geometry::RealPoint2D& aPoint, - const css::rendering::ViewState& viewState, - const css::rendering::RenderState& renderState ); void drawLine( const css::rendering::XCanvas* rCanvas, const css::geometry::RealPoint2D& aStartPoint, const css::geometry::RealPoint2D& aEndPoint, @@ -243,14 +239,6 @@ namespace vclcanvas getData( css::rendering::IntegerBitmapLayout& bitmapLayout, const css::geometry::IntegerRectangle2D& rect ); - void setData( const css::uno::Sequence< sal_Int8 >& data, - const css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerRectangle2D& rect ); - - void setPixel( const css::uno::Sequence< sal_Int8 >& color, - const css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerPoint2D& pos ); - css::uno::Sequence< sal_Int8 > getPixel( css::rendering::IntegerBitmapLayout& bitmapLayout, const css::geometry::IntegerPoint2D& pos ); diff --git a/canvas/source/vcl/spritecanvashelper.cxx b/canvas/source/vcl/spritecanvashelper.cxx index 18af2752d3d7..ce81635eff22 100644 --- a/canvas/source/vcl/spritecanvashelper.cxx +++ b/canvas/source/vcl/spritecanvashelper.cxx @@ -578,7 +578,6 @@ namespace vclcanvas { } - void operator()() { *mpTarget += mnIncrement; } void operator()( const ::canvas::Sprite::Reference& ) { *mpTarget += mnIncrement; } void operator()( T nIncrement ) { *mpTarget += nIncrement; } |