diff options
37 files changed, 271 insertions, 244 deletions
diff --git a/basegfx/source/tools/canvastools.cxx b/basegfx/source/tools/canvastools.cxx index d388356199a2..70f4787710ad 100644 --- a/basegfx/source/tools/canvastools.cxx +++ b/basegfx/source/tools/canvastools.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/vector/b2dsize.hxx> +#include <basegfx/vector/b2ivector.hxx> #include <basegfx/range/b3drange.hxx> #include <basegfx/range/b2irange.hxx> #include <basegfx/polygon/b2dpolygon.hxx> @@ -427,16 +428,15 @@ namespace basegfx::unotools rRect.Z2); } - geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2IVector& rSize ) + geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2ISize& rSize ) { - return geometry::IntegerSize2D( rSize.getX(), - rSize.getY() ); + return geometry::IntegerSize2D( rSize.getWidth(), + rSize.getHeight() ); } - ::basegfx::B2IVector b2ISizeFromIntegerSize2D( const geometry::IntegerSize2D& rSize ) + basegfx::B2ISize b2ISizeFromIntegerSize2D( const geometry::IntegerSize2D& rSize ) { - return ::basegfx::B2IVector( rSize.Width, - rSize.Height ); + return basegfx::B2ISize(rSize.Width, rSize.Height); } ::basegfx::B2IRange b2IRectangleFromIntegerRectangle2D( const geometry::IntegerRectangle2D& rRectangle ) diff --git a/canvas/source/cairo/cairo_canvasbitmap.cxx b/canvas/source/cairo/cairo_canvasbitmap.cxx index ebf4f26c5321..9f18be80824a 100644 --- a/canvas/source/cairo/cairo_canvasbitmap.cxx +++ b/canvas/source/cairo/cairo_canvasbitmap.cxx @@ -48,7 +48,7 @@ namespace cairocanvas SAL_INFO( "canvas.cairo", - "bitmap size: " << rSize.getX() << "x" << rSize.getY()); + "bitmap size: " << rSize.getWidth() << "x" << rSize.getHeight()); mpBufferSurface = mpSurfaceProvider->createSurface( rSize, bHasAlpha ? CAIRO_CONTENT_COLOR_ALPHA : CAIRO_CONTENT_COLOR ); mpBufferCairo = mpBufferSurface->getCairo(); @@ -119,7 +119,7 @@ namespace cairocanvas break; BitmapEx* pBitmapEx = vcl::bitmap::CreateFromCairoSurface( - ::Size( maSize.getX(), maSize.getY() ), + ::Size( maSize.getWidth(), maSize.getHeight() ), getSurface()->getCairoSurface().get()); if (pBitmapEx) aRV <<= reinterpret_cast<sal_Int64>( pBitmapEx ); diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 14113e89361f..b8c4f26be2ca 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -209,7 +209,7 @@ namespace cairocanvas void CanvasHelper::clear() { - SAL_INFO( "canvas.cairo", "clear whole area: " << maSize.getX() << " x " << maSize.getY() ); + SAL_INFO( "canvas.cairo", "clear whole area: " << maSize.getWidth() << " x " << maSize.getHeight() ); if( !mpCairo ) return; @@ -226,7 +226,7 @@ namespace cairocanvas cairo_set_source_rgb( mpCairo.get(), 1.0, 1.0, 1.0 ); cairo_set_operator( mpCairo.get(), CAIRO_OPERATOR_SOURCE ); - cairo_rectangle( mpCairo.get(), 0, 0, maSize.getX(), maSize.getY() ); + cairo_rectangle( mpCairo.get(), 0, 0, maSize.getWidth(), maSize.getHeight() ); cairo_fill( mpCairo.get() ); cairo_restore( mpCairo.get() ); @@ -1087,7 +1087,7 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: { cairo_save( mpCairo.get() ); - cairo_rectangle( mpCairo.get(), 0, 0, maSize.getX(), maSize.getY() ); + cairo_rectangle( mpCairo.get(), 0, 0, maSize.getWidth(), maSize.getHeight() ); cairo_clip( mpCairo.get() ); useStates( viewState, renderState, true ); @@ -1146,8 +1146,8 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: // in case the bitmap doesn't have alpha and covers whole area // we try to change surface to plain rgb - SAL_INFO( "canvas.cairo","chance to change surface to rgb, " << x << ", " << y << ", " << width << " x " << height << " (" << maSize.getX() << " x " << maSize.getY() << ")" ); - if( x <= 0 && y <= 0 && x + width >= maSize.getX() && y + height >= maSize.getY() ) + SAL_INFO( "canvas.cairo","chance to change surface to rgb, " << x << ", " << y << ", " << width << " x " << height << " (" << maSize.getWidth() << " x " << maSize.getHeight() << ")" ); + if( x <= 0 && y <= 0 && x + width >= maSize.getWidth() && y + height >= maSize.getHeight() ) { SAL_INFO( "canvas.cairo","trying to change surface to rgb"); if( mpSurfaceProvider ) { @@ -2025,7 +2025,7 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: cairo_save( mpCairo.get() ); - cairo_rectangle( mpCairo.get(), 0, 0, maSize.getX(), maSize.getY() ); + cairo_rectangle( mpCairo.get(), 0, 0, maSize.getWidth(), maSize.getHeight() ); cairo_clip( mpCairo.get() ); useStates( viewState, renderState, true ); diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx index 5dacea7ae676..3d3f7ef8301c 100644 --- a/canvas/source/cairo/cairo_devicehelper.cxx +++ b/canvas/source/cairo/cairo_devicehelper.cxx @@ -76,7 +76,7 @@ namespace cairocanvas { SAL_INFO( "canvas.cairo", - "device size " << rSize.getX() << " x " << rSize.getY()); + "device size " << rSize.getWidth() << " x " << rSize.getHeight()); if( !mpRefDevice ) return; // disposed @@ -85,15 +85,15 @@ namespace cairocanvas // X11 only bool bReuseSurface = mpSurface && - mpSurface->Resize(rSize.getX() + pOutDev->GetOutOffXPixel(), - rSize.getY() + pOutDev->GetOutOffYPixel()); + mpSurface->Resize(rSize.getWidth() + pOutDev->GetOutOffXPixel(), + rSize.getHeight() + pOutDev->GetOutOffYPixel()); if (!bReuseSurface) { mpSurface = pOutDev->CreateSurface( pOutDev->GetOutOffXPixel(), pOutDev->GetOutOffYPixel(), - rSize.getX(), rSize.getY() ); + rSize.getWidth(), rSize.getHeight() ); } } @@ -240,7 +240,7 @@ namespace cairocanvas SurfaceSharedPtr DeviceHelper::createSurface( const ::basegfx::B2ISize& rSize, int aContent ) { if( mpSurface ) - return mpSurface->getSimilar( aContent, rSize.getX(), rSize.getY() ); + return mpSurface->getSimilar( aContent, rSize.getWidth(), rSize.getHeight() ); return SurfaceSharedPtr(); } diff --git a/canvas/source/cairo/cairo_spritecanvashelper.cxx b/canvas/source/cairo/cairo_spritecanvashelper.cxx index 3eb41619f388..3fcfd734ab2f 100644 --- a/canvas/source/cairo/cairo_spritecanvashelper.cxx +++ b/canvas/source/cairo/cairo_spritecanvashelper.cxx @@ -185,7 +185,7 @@ namespace cairocanvas // background has changed, so we currently have no choice // but repaint everything (or caller requested that) - cairo_rectangle( pCompositingCairo.get(), 0, 0, rSize.getX(), rSize.getY() ); + cairo_rectangle( pCompositingCairo.get(), 0, 0, rSize.getWidth(), rSize.getHeight() ); cairo_clip( pCompositingCairo.get() ); cairo_save( pCompositingCairo.get() ); cairo_set_source_surface( pCompositingCairo.get(), @@ -203,7 +203,7 @@ namespace cairocanvas ); // flush to screen - cairo_rectangle( pWindowCairo.get(), 0, 0, rSize.getX(), rSize.getY() ); + cairo_rectangle( pWindowCairo.get(), 0, 0, rSize.getWidth(), rSize.getHeight() ); cairo_clip( pWindowCairo.get() ); cairo_set_source_surface( pWindowCairo.get(), pCompositingSurface->getCairoSurface().get(), @@ -245,8 +245,8 @@ namespace cairocanvas const ::basegfx::B2ISize& rSize = mpOwningSpriteCanvas->getSizePixel(); const ::basegfx::B2IRange aOutputBounds( 0,0, - rSize.getX(), - rSize.getY() ); + rSize.getWidth(), + rSize.getHeight() ); SurfaceSharedPtr pCompositingSurface = getCompositingSurface(rSize); SurfaceSharedPtr pWindowSurface = mpOwningSpriteCanvas->getWindowSurface(); @@ -312,7 +312,7 @@ namespace cairocanvas aDestPos.getY() - aSourceUpperLeftPos.getY() ); cairo_rectangle( pScrollCairo.get(), aDestPos.getX(), aDestPos.getY(), - aScrollSize.getX(), aScrollSize.getY() ); + aScrollSize.getWidth(), aScrollSize.getHeight() ); cairo_clip( pScrollCairo.get() ); cairo_set_operator( pScrollCairo.get(), CAIRO_OPERATOR_SOURCE ); cairo_paint( pScrollCairo.get() ); @@ -325,7 +325,7 @@ namespace cairocanvas 0, 0 ); cairo_rectangle( pCompositingCairo.get(), aDestPos.getX(), aDestPos.getY(), - aScrollSize.getX(), aScrollSize.getY() ); + aScrollSize.getWidth(), aScrollSize.getHeight() ); cairo_clip( pCompositingCairo.get() ); cairo_set_operator( pCompositingCairo.get(), CAIRO_OPERATOR_SOURCE ); cairo_paint( pCompositingCairo.get() ); @@ -359,7 +359,7 @@ namespace cairocanvas repaintBackground( pCompositingCairo, mpOwningSpriteCanvas->getBufferSurface(), rArea ); - cairo_rectangle( pWindowCairo.get(), 0, 0, rSize.getX(), rSize.getY() ); + cairo_rectangle( pWindowCairo.get(), 0, 0, rSize.getWidth(), rSize.getHeight() ); cairo_clip( pWindowCairo.get() ); cairo_set_source_surface( pWindowCairo.get(), pCompositingSurface->getCairoSurface().get(), @@ -384,7 +384,7 @@ namespace cairocanvas CairoSharedPtr pCompositingCairo = pCompositingSurface->getCairo(); CairoSharedPtr pWindowCairo = pWindowSurface->getCairo(); - cairo_rectangle( pCompositingCairo.get(), 0, 0, rDeviceSize.getX(), rDeviceSize.getY() ); + cairo_rectangle( pCompositingCairo.get(), 0, 0, rDeviceSize.getWidth(), rDeviceSize.getHeight() ); cairo_clip( pCompositingCairo.get() ); ::basegfx::B2DVector aPos( ceil( rTotalArea.getMinX() ), ceil( rTotalArea.getMinY() ) ); @@ -402,7 +402,7 @@ namespace cairocanvas } // flush to screen - cairo_rectangle( pWindowCairo.get(), 0, 0, rDeviceSize.getX(), rDeviceSize.getY() ); + cairo_rectangle( pWindowCairo.get(), 0, 0, rDeviceSize.getWidth(), rDeviceSize.getHeight() ); cairo_clip( pWindowCairo.get() ); cairo_rectangle( pWindowCairo.get(), aPos.getX(), aPos.getY(), aSize.getX(), aSize.getY() ); cairo_clip( pWindowCairo.get() ); @@ -444,9 +444,9 @@ namespace cairocanvas // fraction of a sprite pixel... Limit size of VDev to output // device's area. const Size aOutputSize( - std::min( rSize.getX(), + std::min( rSize.getWidth(), ::canvas::tools::roundUp( rRequestedArea.getMaxX() - aOutputPosition.X()) ), - std::min( rSize.getY(), + std::min( rSize.getHeight(), ::canvas::tools::roundUp( rRequestedArea.getMaxY() - aOutputPosition.Y()) ) ); cairo_rectangle( pCompositingCairo.get(), aOutputPosition.X(), aOutputPosition.Y(), aOutputSize.Width(), aOutputSize.Height() ); @@ -482,8 +482,8 @@ namespace cairocanvas ::cairo::SurfaceSharedPtr const & SpriteCanvasHelper::getCompositingSurface( const ::basegfx::B2ISize& rNeededSize ) { - if( rNeededSize.getX() > maCompositingSurfaceSize.getX() || - rNeededSize.getY() > maCompositingSurfaceSize.getY() ) + if( rNeededSize.getWidth() > maCompositingSurfaceSize.getWidth() || + rNeededSize.getHeight() > maCompositingSurfaceSize.getHeight() ) { // need to give buffer more size mpCompositingSurface.reset(); @@ -511,7 +511,7 @@ namespace cairocanvas { return mpOwningSpriteCanvas->getWindowSurface()->getSimilar( CAIRO_CONTENT_COLOR, - rNeededSize.getX(), rNeededSize.getY() ); + rNeededSize.getWidth(), rNeededSize.getHeight() ); } } diff --git a/canvas/source/cairo/cairo_spritedevicehelper.cxx b/canvas/source/cairo/cairo_spritedevicehelper.cxx index 6539cf329a40..69a057c9918f 100644 --- a/canvas/source/cairo/cairo_spritedevicehelper.cxx +++ b/canvas/source/cairo/cairo_spritedevicehelper.cxx @@ -90,7 +90,7 @@ namespace cairocanvas { SAL_INFO( "canvas.cairo", - "device size " << rSize.getX() << " x " << rSize.getY()); + "device size " << rSize.getWidth() << " x " << rSize.getHeight()); if( !mpSpriteCanvas ) return; // disposed @@ -102,7 +102,7 @@ namespace cairocanvas if( !mpBufferSurface ) mpBufferSurface = getWindowSurface()->getSimilar( CAIRO_CONTENT_COLOR, - rSize.getX(), rSize.getY() ); + rSize.getWidth(), rSize.getHeight() ); if( maSize != rSize ) maSize = rSize; @@ -124,7 +124,7 @@ namespace cairocanvas SurfaceSharedPtr SpriteDeviceHelper::createSurface( const ::basegfx::B2ISize& rSize, int aContent ) { if( mpBufferSurface ) - return mpBufferSurface->getSimilar( aContent, rSize.getX(), rSize.getY() ); + return mpBufferSurface->getSimilar( aContent, rSize.getWidth(), rSize.getHeight() ); return SurfaceSharedPtr(); } diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index 3ccfc6a61b17..93738b3455cf 100644 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -92,7 +92,7 @@ namespace dxcanvas virtual bool update( const ::basegfx::B2IPoint& rDestPos, const ::basegfx::B2IRange& rSourceRect, ::canvas::IColorBuffer& rSource ) override; - virtual ::basegfx::B2IVector getSize(); + virtual ::basegfx::B2ISize getSize(); private: /// Guard local methods against concurrent access to RenderModule @@ -113,7 +113,7 @@ namespace dxcanvas DXRenderModule& mrRenderModule; sal::systools::COMReference<IDirect3DTexture9> mpTexture; - ::basegfx::B2IVector maSize; + ::basegfx::B2ISize maSize; }; @@ -131,7 +131,7 @@ namespace dxcanvas virtual void unlock() const override { maMutex.release(); } virtual sal::systools::COMReference<IDirect3DSurface9> - createSystemMemorySurface( const ::basegfx::B2IVector& rSize ) override; + createSystemMemorySurface(const ::basegfx::B2ISize& rSize) override; virtual void disposing() override; virtual HWND getHWND() const override { return mhWnd; } virtual void screenShot() override; @@ -172,7 +172,7 @@ namespace dxcanvas sal::systools::COMReference<IDirect3DVertexBuffer9> mpVertexBuffer; std::shared_ptr<canvas::ISurface> mpTexture; VclPtr<SystemChildWindow> mpWindow; - ::basegfx::B2IVector maSize; + ::basegfx::B2ISize maSize; typedef std::vector<canvas::Vertex> vertexCache_t; vertexCache_t maVertexCache; std::size_t mnCount; @@ -225,8 +225,7 @@ namespace dxcanvas DXSurface::DXSurface( DXRenderModule& rRenderModule, const ::basegfx::B2ISize& rSize ) : mrRenderModule(rRenderModule), - mpTexture(nullptr), - maSize() + mpTexture(nullptr) { ImplRenderModuleGuard aGuard( mrRenderModule ); @@ -237,21 +236,21 @@ namespace dxcanvas #endif #ifdef FAKE_MAX_TEXTURE_SIZE - if(rSize.getX() > FAKE_MAX_TEXTURE_SIZE) + if(rSize.getWidth() > FAKE_MAX_TEXTURE_SIZE) return; - if(rSize.getY() > FAKE_MAX_TEXTURE_SIZE) + if(rSize.getHeight() > FAKE_MAX_TEXTURE_SIZE) return; #endif - ENSURE_ARG_OR_THROW(rSize.getX() > 0 && rSize.getY() > 0, + ENSURE_ARG_OR_THROW(rSize.getWidth() > 0 && rSize.getHeight() > 0, "DXSurface::DXSurface(): request for zero-sized surface"); sal::systools::COMReference<IDirect3DDevice9> pDevice(rRenderModule.getDevice()); IDirect3DTexture9 *pTexture(nullptr); if(FAILED(pDevice->CreateTexture( - rSize.getX(), - rSize.getY(), + rSize.getWidth(), + rSize.getHeight(), 1,0,D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &pTexture,nullptr))) @@ -325,12 +324,12 @@ namespace dxcanvas // to avoid interpolation artifacts from other textures, // the surface manager allocates one pixel gap between // them. Clear that to transparent. - rect.right = std::min(maSize.getX(), + rect.right = std::min(maSize.getWidth(), rect.left + sal_Int32(rSourceRect.getWidth()+1)); - rect.bottom = std::min(maSize.getY(), + rect.bottom = std::min(maSize.getHeight(), rect.top + sal_Int32(rSourceRect.getHeight()+1)); - const bool bClearRightColumn( rect.right < maSize.getX() ); - const bool bClearBottomRow( rect.bottom < maSize.getY() ); + const bool bClearRightColumn( rect.right < maSize.getWidth() ); + const bool bClearBottomRow( rect.bottom < maSize.getHeight() ); if(SUCCEEDED(mpTexture->LockRect(0,&aLockedRect,&rect,D3DLOCK_NOSYSLOCK))) { @@ -427,18 +426,11 @@ namespace dxcanvas return true; } - - // DXSurface::getSize - - - ::basegfx::B2IVector DXSurface::getSize() + ::basegfx::B2ISize DXSurface::getSize() { return maSize; } - // DXRenderModule::DXRenderModule - - DXRenderModule::DXRenderModule( const vcl::Window& rWindow ) : mhWnd(nullptr), mpDevice(), @@ -446,14 +438,12 @@ namespace dxcanvas mpSwapChain(), mpVertexBuffer(), mpTexture(), - maSize(), maVertexCache(), mnCount(0), mnBeginSceneCount(0), mbCanUseDynamicTextures(false), mbError( false ), meType( PrimitiveType::Unknown ), - maPageSize(), mad3dpp(), maNumVertices( VERTEX_BUFFER_SIZE ), maWriteIndex(0), @@ -469,10 +459,10 @@ namespace dxcanvas // allocate a single texture surface which can be used later. // we also use this to calibrate the page size. - ::basegfx::B2IVector aPageSize(maPageSize); + basegfx::B2IVector aPageSize(maPageSize); while(true) { - mpTexture = std::make_shared<DXSurface>(*this,aPageSize); + mpTexture = std::make_shared<DXSurface>(*this, basegfx::B2ISize(aPageSize.getX(), aPageSize.getY())); if(mpTexture->isValid()) break; @@ -577,11 +567,11 @@ namespace dxcanvas // remember the size of the parent window, since we // need to use this for our child window. - maSize.setX(static_cast<sal_Int32>(rSizePixel.Width())); - maSize.setY(static_cast<sal_Int32>(rSizePixel.Height())); + maSize.setWidth(sal_Int32(rSizePixel.Width())); + maSize.setHeight(sal_Int32(rSizePixel.Height())); // let the child window cover the same size as the parent window. - mpWindow->setPosSizePixel(0,0,maSize.getX(),maSize.getY()); + mpWindow->setPosSizePixel(0, 0, maSize.getWidth(),maSize.getHeight()); // create a device from the direct3d9 object. if(!(createDevice())) @@ -697,10 +687,8 @@ namespace dxcanvas // a back buffer, and no way of falling back to a // different canvas implementation. ZeroMemory( &mad3dpp, sizeof(mad3dpp) ); - mad3dpp.BackBufferWidth = std::max(maSize.getX(), - sal_Int32(d3ddm.Width)); - mad3dpp.BackBufferHeight = std::max(maSize.getY(), - sal_Int32(d3ddm.Height)); + mad3dpp.BackBufferWidth = std::max(maSize.getWidth(), sal_Int32(d3ddm.Width)); + mad3dpp.BackBufferHeight = std::max(maSize.getHeight(), sal_Int32(d3ddm.Height)); mad3dpp.BackBufferCount = 1; mad3dpp.Windowed = TRUE; mad3dpp.SwapEffect = D3DSWAPEFFECT_COPY; @@ -757,7 +745,7 @@ namespace dxcanvas // DXRenderModule::createSystemMemorySurface - sal::systools::COMReference<IDirect3DSurface9> DXRenderModule::createSystemMemorySurface( const ::basegfx::B2IVector& rSize ) + sal::systools::COMReference<IDirect3DSurface9> DXRenderModule::createSystemMemorySurface(const ::basegfx::B2ISize& rSize) { if(isDisposed()) return sal::systools::COMReference<IDirect3DSurface9>(nullptr); @@ -767,8 +755,8 @@ namespace dxcanvas // other 32bit-format. IDirect3DSurface9 *pSurface(nullptr); if( FAILED(mpDevice->CreateOffscreenPlainSurface( - rSize.getX(), - rSize.getY(), + rSize.getWidth(), + rSize.getHeight(), D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, &pSurface, @@ -868,33 +856,33 @@ namespace dxcanvas return; // don't do anything if the size didn't change. - if(maSize.getX() == static_cast<sal_Int32>(rect.getWidth()) && - maSize.getY() == static_cast<sal_Int32>(rect.getHeight())) + if(maSize.getWidth() == static_cast<sal_Int32>(rect.getWidth()) && + maSize.getHeight() == static_cast<sal_Int32>(rect.getHeight())) return; // TODO(Q2): use numeric cast to prevent overflow - maSize.setX(static_cast<sal_Int32>(rect.getWidth())); - maSize.setY(static_cast<sal_Int32>(rect.getHeight())); + maSize.setWidth(sal_Int32(rect.getWidth())); + maSize.setHeight(sal_Int32(rect.getHeight())); - mpWindow->setPosSizePixel(0,0,maSize.getX(),maSize.getY()); + mpWindow->setPosSizePixel(0, 0, maSize.getWidth(), maSize.getHeight()); // resize back buffer, if necessary // don't attempt to create anything if the // requested size is NULL. - if(!(maSize.getX())) + if(!(maSize.getWidth())) return; - if(!(maSize.getY())) + if(!(maSize.getHeight())) return; // backbuffer too small (might happen, if window is // maximized across multiple monitors) - if( sal_Int32(mad3dpp.BackBufferWidth) < maSize.getX() || - sal_Int32(mad3dpp.BackBufferHeight) < maSize.getY() ) + if( sal_Int32(mad3dpp.BackBufferWidth) < maSize.getWidth() || + sal_Int32(mad3dpp.BackBufferHeight) < maSize.getHeight() ) { - mad3dpp.BackBufferWidth = maSize.getX(); - mad3dpp.BackBufferHeight = maSize.getY(); + mad3dpp.BackBufferWidth = maSize.getWidth(); + mad3dpp.BackBufferHeight = maSize.getHeight(); // clear before, save resources mpSwapChain.clear(); @@ -942,10 +930,10 @@ namespace dxcanvas const ::basegfx::B2IVector& rPageSize( getPageSize() ); ::basegfx::B2ISize aSize(surfaceSize); - if(!(aSize.getX())) - aSize.setX(rPageSize.getX()); - if(!(aSize.getY())) - aSize.setY(rPageSize.getY()); + if(!(aSize.getWidth())) + aSize.setWidth(rPageSize.getX()); + if(!(aSize.getHeight())) + aSize.setHeight(rPageSize.getY()); if(mpTexture.use_count() == 1) return mpTexture; diff --git a/canvas/source/directx/dx_bitmap.cxx b/canvas/source/directx/dx_bitmap.cxx index 880e51e78d56..9e5f2348fa4f 100644 --- a/canvas/source/directx/dx_bitmap.cxx +++ b/canvas/source/directx/dx_bitmap.cxx @@ -47,8 +47,8 @@ namespace dxcanvas { } - DXBitmap::DXBitmap( const ::basegfx::B2IVector& rSize, - bool bWithAlpha ) : + DXBitmap::DXBitmap( const ::basegfx::B2ISize& rSize, + bool bWithAlpha ) : mpGdiPlusUser( GDIPlusUser::createInstance() ), maSize(rSize), mpBitmap(), @@ -59,15 +59,15 @@ namespace dxcanvas if(mbAlpha) { mpBitmap = std::make_shared<Gdiplus::Bitmap>( - maSize.getX(), - maSize.getY(), + maSize.getWidth(), + maSize.getHeight(), PixelFormat32bppARGB); } else { mpBitmap = std::make_shared<Gdiplus::Bitmap>( - maSize.getX(), - maSize.getY(), + maSize.getWidth(), + maSize.getHeight(), PixelFormat24bppRGB); } @@ -84,7 +84,7 @@ namespace dxcanvas return mpGraphics; } - ::basegfx::B2IVector DXBitmap::getSize() const + ::basegfx::B2ISize DXBitmap::getSize() const { return maSize; } @@ -165,7 +165,7 @@ namespace dxcanvas const rendering::IntegerBitmapLayout& /*bitmapLayout*/, const geometry::IntegerPoint2D& pos ) { - const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() ); + const geometry::IntegerSize2D aSize( maSize.getWidth(),maSize.getHeight() ); ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, "CanvasHelper::setPixel: X coordinate out of bounds" ); @@ -184,7 +184,7 @@ namespace dxcanvas uno::Sequence< sal_Int8 > DXBitmap::getPixel( rendering::IntegerBitmapLayout& /*bitmapLayout*/, const geometry::IntegerPoint2D& pos ) { - const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() ); + const geometry::IntegerSize2D aSize( maSize.getWidth(),maSize.getHeight() ); ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, "CanvasHelper::getPixel: X coordinate out of bounds" ); diff --git a/canvas/source/directx/dx_bitmap.hxx b/canvas/source/directx/dx_bitmap.hxx index 127ee5fc5b39..b27da5cfa683 100644 --- a/canvas/source/directx/dx_bitmap.hxx +++ b/canvas/source/directx/dx_bitmap.hxx @@ -35,15 +35,13 @@ namespace dxcanvas class DXBitmap : public IBitmap { public: - DXBitmap( const BitmapSharedPtr& rBitmap, - bool bWithAlpha ); - DXBitmap( const ::basegfx::B2IVector& rSize, - bool bWithAlpha ); + DXBitmap( const BitmapSharedPtr& rBitmap, bool bWithAlpha ); + DXBitmap( const ::basegfx::B2ISize& rSize, bool bWithAlpha ); virtual GraphicsSharedPtr getGraphics() override; virtual BitmapSharedPtr getBitmap() const override; - virtual ::basegfx::B2IVector getSize() const override; + virtual ::basegfx::B2ISize getSize() const override; virtual bool hasAlpha() const override; css::uno::Sequence< sal_Int8 > getData( @@ -69,7 +67,7 @@ namespace dxcanvas GDIPlusUserSharedPtr mpGdiPlusUser; // size of this image in pixels [integral unit] - ::basegfx::B2IVector maSize; + ::basegfx::B2ISize maSize; BitmapSharedPtr mpBitmap; GraphicsSharedPtr mpGraphics; diff --git a/canvas/source/directx/dx_bitmapcanvashelper.cxx b/canvas/source/directx/dx_bitmapcanvashelper.cxx index e9200907a591..f82fa0ac3ad3 100644 --- a/canvas/source/directx/dx_bitmapcanvashelper.cxx +++ b/canvas/source/directx/dx_bitmapcanvashelper.cxx @@ -141,7 +141,6 @@ namespace dxcanvas { if( !mpTarget ) return geometry::IntegerSize2D(1, 1); - return basegfx::unotools::integerSize2DFromB2ISize(mpTarget->getSize()); } diff --git a/canvas/source/directx/dx_canvasbitmap.cxx b/canvas/source/directx/dx_canvasbitmap.cxx index 1c583863f0e5..33dc7859fadb 100644 --- a/canvas/source/directx/dx_canvasbitmap.cxx +++ b/canvas/source/directx/dx_canvasbitmap.cxx @@ -105,18 +105,18 @@ namespace dxcanvas // need to copy&convert the bitmap, since dx // canvas uses inline alpha channel HDC hScreenDC=GetDC(nullptr); - const basegfx::B2IVector aSize(mpBitmap->getSize()); + const basegfx::B2ISize aSize = mpBitmap->getSize(); HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC, - aSize.getX(), - aSize.getY() ); + aSize.getWidth(), + aSize.getHeight() ); if( !hBmpBitmap ) return aRes; BITMAPINFOHEADER aBIH; aBIH.biSize = sizeof( BITMAPINFOHEADER ); - aBIH.biWidth = aSize.getX(); - aBIH.biHeight = -aSize.getY(); + aBIH.biWidth = aSize.getWidth(); + aBIH.biHeight = -aSize.getHeight(); aBIH.biPlanes = 1; aBIH.biBitCount = 32; aBIH.biCompression = BI_RGB; // expects pixel in @@ -129,12 +129,12 @@ namespace dxcanvas aBIH.biClrImportant = 0; Gdiplus::BitmapData aBmpData; - aBmpData.Width = aSize.getX(); - aBmpData.Height = aSize.getY(); + aBmpData.Width = aSize.getWidth(); + aBmpData.Height = aSize.getHeight(); aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; aBmpData.Scan0 = nullptr; - const Gdiplus::Rect aRect( 0,0,aSize.getX(),aSize.getY() ); + const Gdiplus::Rect aRect( 0,0,aSize.getWidth(),aSize.getHeight() ); BitmapSharedPtr pGDIPlusBitmap=mpBitmap->getBitmap(); if( Gdiplus::Ok != pGDIPlusBitmap->LockBits( &aRect, Gdiplus::ImageLockModeRead, @@ -147,7 +147,7 @@ namespace dxcanvas // now aBmpData.Scan0 contains our bits - push // them into HBITMAP, ignoring alpha - SetDIBits( hScreenDC, hBmpBitmap, 0, aSize.getY(), aBmpData.Scan0, reinterpret_cast<PBITMAPINFO>(&aBIH), DIB_RGB_COLORS ); + SetDIBits( hScreenDC, hBmpBitmap, 0, aSize.getHeight(), aBmpData.Scan0, reinterpret_cast<PBITMAPINFO>(&aBIH), DIB_RGB_COLORS ); pGDIPlusBitmap->UnlockBits( &aBmpData ); @@ -170,14 +170,14 @@ namespace dxcanvas // need to copy&convert the bitmap, since dx // canvas uses inline alpha channel HDC hScreenDC=GetDC(nullptr); - const basegfx::B2IVector aSize(mpBitmap->getSize()); - HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC, aSize.getX(), aSize.getY() ); + const basegfx::B2ISize aSize = mpBitmap->getSize(); + HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC, aSize.getWidth(), aSize.getHeight() ); if( !hBmpBitmap ) return aRes; aDIB.bmiHeader.biSize = sizeof( BITMAPINFOHEADER ); - aDIB.bmiHeader.biWidth = aSize.getX(); - aDIB.bmiHeader.biHeight = -aSize.getY(); + aDIB.bmiHeader.biWidth = aSize.getWidth(); + aDIB.bmiHeader.biHeight = -aSize.getHeight(); aDIB.bmiHeader.biPlanes = 1; aDIB.bmiHeader.biBitCount = 8; aDIB.bmiHeader.biCompression = BI_RGB; @@ -188,12 +188,12 @@ namespace dxcanvas aDIB.bmiHeader.biClrImportant = 0; Gdiplus::BitmapData aBmpData; - aBmpData.Width = aSize.getX(); - aBmpData.Height = aSize.getY(); + aBmpData.Width = aSize.getWidth(); + aBmpData.Height = aSize.getHeight(); aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; aBmpData.Scan0 = nullptr; - const Gdiplus::Rect aRect( 0,0,aSize.getX(),aSize.getY() ); + const Gdiplus::Rect aRect( 0,0,aSize.getWidth(),aSize.getHeight() ); BitmapSharedPtr pGDIPlusBitmap=mpBitmap->getBitmap(); if( Gdiplus::Ok != pGDIPlusBitmap->LockBits( &aRect, Gdiplus::ImageLockModeRead, @@ -205,14 +205,14 @@ namespace dxcanvas } // copy only alpha channel to pAlphaBits - const sal_Int32 nScanWidth((aSize.getX() + 3) & ~3); - std::unique_ptr<sal_uInt8[]> pAlphaBits( new sal_uInt8[nScanWidth*aSize.getY()] ); + const sal_Int32 nScanWidth((aSize.getWidth() + 3) & ~3); + std::unique_ptr<sal_uInt8[]> pAlphaBits( new sal_uInt8[nScanWidth*aSize.getHeight()] ); const sal_uInt8* pInBits=static_cast<sal_uInt8*>(aBmpData.Scan0); pInBits+=3; - for( sal_Int32 y=0; y<aSize.getY(); ++y ) + for( sal_Int32 y=0; y<aSize.getHeight(); ++y ) { sal_uInt8* pOutBits=pAlphaBits.get()+y*nScanWidth; - for( sal_Int32 x=0; x<aSize.getX(); ++x ) + for( sal_Int32 x=0; x<aSize.getWidth(); ++x ) { *pOutBits++ = 255-*pInBits; pInBits += 4; @@ -223,7 +223,7 @@ namespace dxcanvas // set bits to newly create HBITMAP SetDIBits( hScreenDC, hBmpBitmap, 0, - aSize.getY(), pAlphaBits.get(), + aSize.getHeight(), pAlphaBits.get(), reinterpret_cast<PBITMAPINFO>(&aDIB), DIB_RGB_COLORS ); uno::Sequence< uno::Any > args{ uno::Any(reinterpret_cast<sal_Int64>(hBmpBitmap)) }; diff --git a/canvas/source/directx/dx_canvascustomsprite.cxx b/canvas/source/directx/dx_canvascustomsprite.cxx index f06de54011f5..b9e79fdc0654 100644 --- a/canvas/source/directx/dx_canvascustomsprite.cxx +++ b/canvas/source/directx/dx_canvascustomsprite.cxx @@ -49,7 +49,7 @@ namespace dxcanvas "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" ); mpSurface = std::make_shared<DXSurfaceBitmap>( - ::basegfx::B2IVector( + ::basegfx::B2ISize( ::canvas::tools::roundUp( rSpriteSize.Width ), ::canvas::tools::roundUp( rSpriteSize.Height )), rSurfaceProxy, diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index 289cb3b59915..1184886784c9 100644 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -735,7 +735,7 @@ namespace dxcanvas if( !maOutputOffset.equalZero() ) { const basegfx::B2DHomMatrix aOutputOffset(basegfx::utils::createTranslateB2DHomMatrix( - maOutputOffset.getX(), maOutputOffset.getY())); + maOutputOffset.getWidth(), maOutputOffset.getHeight())); aTransform = aOutputOffset * aTransform; } @@ -774,7 +774,7 @@ namespace dxcanvas if( !maOutputOffset.equalZero() ) { const basegfx::B2DHomMatrix aOutputOffset(basegfx::utils::createTranslateB2DHomMatrix( - maOutputOffset.getX(), maOutputOffset.getY())); + maOutputOffset.getWidth(), maOutputOffset.getHeight())); aTransform = aOutputOffset * aTransform; } diff --git a/canvas/source/directx/dx_ibitmap.hxx b/canvas/source/directx/dx_ibitmap.hxx index 6d3f4d6f6a0d..0035bbe7d07f 100644 --- a/canvas/source/directx/dx_ibitmap.hxx +++ b/canvas/source/directx/dx_ibitmap.hxx @@ -33,7 +33,7 @@ namespace dxcanvas struct IBitmap : public GraphicsProvider { virtual BitmapSharedPtr getBitmap() const = 0; - virtual ::basegfx::B2IVector getSize() const = 0; + virtual ::basegfx::B2ISize getSize() const = 0; virtual bool hasAlpha() const = 0; virtual css::uno::Sequence< sal_Int8 > getData( diff --git a/canvas/source/directx/dx_rendermodule.hxx b/canvas/source/directx/dx_rendermodule.hxx index 6e8a8fb2aff5..4b13937967a2 100644 --- a/canvas/source/directx/dx_rendermodule.hxx +++ b/canvas/source/directx/dx_rendermodule.hxx @@ -62,7 +62,7 @@ namespace dxcanvas virtual sal::systools::COMReference<surface_type> createSystemMemorySurface( - const ::basegfx::B2IVector& rSize ) = 0; + const ::basegfx::B2ISize& rSize) = 0; virtual void disposing() = 0; virtual HWND getHWND() const = 0; diff --git a/canvas/source/directx/dx_spritedevicehelper.cxx b/canvas/source/directx/dx_spritedevicehelper.cxx index 24d18945bede..622246bc2adc 100644 --- a/canvas/source/directx/dx_spritedevicehelper.cxx +++ b/canvas/source/directx/dx_spritedevicehelper.cxx @@ -88,7 +88,7 @@ namespace dxcanvas // #i60490# ensure backbuffer has sensible minimal size mpBackBuffer = std::make_shared<DXSurfaceBitmap>( - ::basegfx::B2ISize(w,h), + basegfx::B2ISize(w,h), mpSurfaceProxyManager, mpRenderModule, false); diff --git a/canvas/source/directx/dx_surfacebitmap.cxx b/canvas/source/directx/dx_surfacebitmap.cxx index f5899662bdae..5a3992eea221 100644 --- a/canvas/source/directx/dx_surfacebitmap.cxx +++ b/canvas/source/directx/dx_surfacebitmap.cxx @@ -48,7 +48,7 @@ namespace dxcanvas { public: DXColorBuffer( const sal::systools::COMReference<surface_type>& rSurface, - const ::basegfx::B2IVector& rSize ) + const ::basegfx::B2ISize& rSize ) : maSize(rSize) , maLockedRect{} , mpSurface(rSurface) @@ -67,7 +67,7 @@ namespace dxcanvas private: - ::basegfx::B2IVector maSize; + ::basegfx::B2ISize maSize; mutable D3DLOCKED_RECT maLockedRect; sal::systools::COMReference<surface_type> mpSurface; }; @@ -86,12 +86,12 @@ namespace dxcanvas sal_uInt32 DXColorBuffer::getWidth() const { - return maSize.getX(); + return maSize.getWidth(); } sal_uInt32 DXColorBuffer::getHeight() const { - return maSize.getY(); + return maSize.getHeight(); } sal_uInt32 DXColorBuffer::getStride() const @@ -113,7 +113,7 @@ namespace dxcanvas public: GDIColorBuffer( const BitmapSharedPtr& rSurface, - const ::basegfx::B2IVector& rSize ) + const ::basegfx::B2ISize& rSize ) : maSize(rSize) , aBmpData{} , mpGDIPlusBitmap(rSurface) @@ -132,15 +132,15 @@ namespace dxcanvas private: - ::basegfx::B2IVector maSize; + ::basegfx::B2ISize maSize; mutable Gdiplus::BitmapData aBmpData; BitmapSharedPtr mpGDIPlusBitmap; }; sal_uInt8* GDIColorBuffer::lock() const { - aBmpData.Width = maSize.getX(); - aBmpData.Height = maSize.getY(); + aBmpData.Width = maSize.getWidth(); + aBmpData.Height = maSize.getHeight(); aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; aBmpData.Scan0 = nullptr; @@ -163,12 +163,12 @@ namespace dxcanvas sal_uInt32 GDIColorBuffer::getWidth() const { - return maSize.getX(); + return maSize.getWidth(); } sal_uInt32 GDIColorBuffer::getHeight() const { - return maSize.getY(); + return maSize.getHeight(); } sal_uInt32 GDIColorBuffer::getStride() const @@ -186,10 +186,10 @@ namespace dxcanvas // DXSurfaceBitmap::DXSurfaceBitmap - DXSurfaceBitmap::DXSurfaceBitmap( const ::basegfx::B2IVector& rSize, + DXSurfaceBitmap::DXSurfaceBitmap( const ::basegfx::B2ISize& rSize, const std::shared_ptr<canvas::ISurfaceProxyManager>& rMgr, - const IDXRenderModuleSharedPtr& rRenderModule, - bool bWithAlpha ) : + const IDXRenderModuleSharedPtr& rRenderModule, + bool bWithAlpha ) : mpGdiPlusUser( GDIPlusUser::createInstance() ), maSize(rSize), mpRenderModule(rRenderModule), @@ -209,7 +209,7 @@ namespace dxcanvas // DXSurfaceBitmap::getSize - ::basegfx::B2IVector DXSurfaceBitmap::getSize() const + ::basegfx::B2ISize DXSurfaceBitmap::getSize() const { return maSize; } @@ -224,8 +224,8 @@ namespace dxcanvas if(mbAlpha) { mpGDIPlusBitmap = std::make_shared<Gdiplus::Bitmap>( - maSize.getX(), - maSize.getY(), + maSize.getWidth(), + maSize.getHeight(), PixelFormat32bppARGB ); mpGraphics = tools::createGraphicsFromBitmap(mpGDIPlusBitmap); @@ -234,7 +234,7 @@ namespace dxcanvas // wrapper around the directx surface. the colorbuffer is the // interface which is used by the surfaceproxy to support any // kind of underlying structure for the pixel data container. - mpColorBuffer = std::make_shared<GDIColorBuffer>(mpGDIPlusBitmap,maSize); + mpColorBuffer = std::make_shared<GDIColorBuffer>(mpGDIPlusBitmap, maSize); } else { @@ -244,7 +244,7 @@ namespace dxcanvas // wrapper around the directx surface. the colorbuffer is the // interface which is used by the surfaceproxy to support any // kind of underlying structure for the pixel data container. - mpColorBuffer = std::make_shared<DXColorBuffer>(mpSurface,maSize); + mpColorBuffer = std::make_shared<DXColorBuffer>(mpSurface, maSize); } // create a (possibly hardware accelerated) mirror surface. @@ -255,7 +255,7 @@ namespace dxcanvas // DXSurfaceBitmap::resize - bool DXSurfaceBitmap::resize( const ::basegfx::B2IVector& rSize ) + bool DXSurfaceBitmap::resize(const ::basegfx::B2ISize& rSize) { if(maSize != rSize) { @@ -324,7 +324,7 @@ namespace dxcanvas Gdiplus::PixelFormat nFormat = hasAlpha() ? PixelFormat32bppARGB : PixelFormat32bppRGB; // construct a gdi+ bitmap from the raw pixel data. - pResult = std::make_shared<Gdiplus::Bitmap>( maSize.getX(),maSize.getY(), + pResult = std::make_shared<Gdiplus::Bitmap>(maSize.getWidth(), maSize.getHeight(), aLockedRect.Pitch, nFormat, static_cast<BYTE *>(aLockedRect.pBits) ); @@ -568,7 +568,7 @@ namespace dxcanvas { if(hasAlpha()) { - const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() ); + const geometry::IntegerSize2D aSize( maSize.getWidth(), maSize.getHeight() ); ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, "CanvasHelper::setPixel: X coordinate out of bounds" ); @@ -585,9 +585,9 @@ namespace dxcanvas } else { - ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getX(), + ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getWidth(), "CanvasHelper::setPixel: X coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getY(), + ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getHeight(), "CanvasHelper::setPixel: Y coordinate out of bounds" ); ENSURE_ARG_OR_THROW( color.getLength() > 3, "CanvasHelper::setPixel: not enough color components" ); @@ -616,7 +616,7 @@ namespace dxcanvas { if(hasAlpha()) { - const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() ); + const geometry::IntegerSize2D aSize(maSize.getWidth(), maSize.getHeight()); ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, "CanvasHelper::getPixel: X coordinate out of bounds" ); @@ -632,9 +632,9 @@ namespace dxcanvas } else { - ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getX(), + ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getWidth(), "CanvasHelper::getPixel: X coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getY(), + ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getHeight(), "CanvasHelper::getPixel: Y coordinate out of bounds" ); // lock the directx surface to receive the pointer to the surface memory. diff --git a/canvas/source/directx/dx_surfacebitmap.hxx b/canvas/source/directx/dx_surfacebitmap.hxx index ec71f4823e93..f39ebb5b9727 100644 --- a/canvas/source/directx/dx_surfacebitmap.hxx +++ b/canvas/source/directx/dx_surfacebitmap.hxx @@ -31,18 +31,18 @@ namespace dxcanvas class DXSurfaceBitmap : public IBitmap { public: - DXSurfaceBitmap( const ::basegfx::B2IVector& rSize, + DXSurfaceBitmap( const ::basegfx::B2ISize& rSize, const std::shared_ptr<canvas::ISurfaceProxyManager>& rMgr, const IDXRenderModuleSharedPtr& rRenderModule, bool bWithAlpha ); - bool resize( const ::basegfx::B2IVector& rSize ); + bool resize(const ::basegfx::B2ISize& rSize); void clear(); virtual GraphicsSharedPtr getGraphics() override; virtual BitmapSharedPtr getBitmap() const override; - virtual ::basegfx::B2IVector getSize() const override; + virtual ::basegfx::B2ISize getSize() const override; virtual bool hasAlpha() const override; sal::systools::COMReference<surface_type> getSurface() const { return mpSurface; } @@ -88,7 +88,7 @@ namespace dxcanvas GDIPlusUserSharedPtr mpGdiPlusUser; // size of this image in pixels [integral unit] - ::basegfx::B2IVector maSize; + ::basegfx::B2ISize maSize; // pointer to the rendermodule, needed to create surfaces // which are used as container for the actual pixel data. diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index 55956650ed82..fa86cea7bd41 100644 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -157,7 +157,7 @@ namespace dxcanvas if(!rOutputOffset.equalZero()) { - aWorldTransform.translate(rOutputOffset.getX(), rOutputOffset.getY()); + aWorldTransform.translate(rOutputOffset.getWidth(), rOutputOffset.getHeight()); } // set ViewState clipping @@ -169,7 +169,7 @@ namespace dxcanvas if(!rOutputOffset.equalZero()) { - aMatrix.translate(rOutputOffset.getX(), rOutputOffset.getY()); + aMatrix.translate(rOutputOffset.getWidth(), rOutputOffset.getHeight()); } aClipPoly.transform(aMatrix); diff --git a/canvas/source/tools/page.cxx b/canvas/source/tools/page.cxx index 3537fa0b6873..ddf516a926f6 100644 --- a/canvas/source/tools/page.cxx +++ b/canvas/source/tools/page.cxx @@ -18,14 +18,14 @@ */ #include <sal/config.h> - +#include <basegfx/vector/b2ivector.hxx> #include "page.hxx" namespace canvas { Page::Page( const std::shared_ptr<IRenderModule> &rRenderModule ) : mpRenderModule(rRenderModule), - mpSurface(rRenderModule->createSurface(::basegfx::B2ISize())) + mpSurface(rRenderModule->createSurface(::basegfx::B2IVector())) { } @@ -91,8 +91,8 @@ namespace canvas const sal_Int32 y = rect.maPos.getY(); // to avoid interpolation artifacts from other textures, // one pixel gap between them - const sal_Int32 w = rect.maSize.getX()+1; - const sal_Int32 h = rect.maSize.getY()+1; + const sal_Int32 w = rect.maSize.getWidth() + 1; + const sal_Int32 h = rect.maSize.getHeight() + 1; // probe location to the right r.maPos.setX(x+w); @@ -118,7 +118,8 @@ namespace canvas // the rectangle passed as argument has a valid // location if and only if there's no intersection // with existing areas. - SurfaceRect aBoundary(mpRenderModule->getPageSize()); + basegfx::B2ISize aSize(mpRenderModule->getPageSize().getX(), mpRenderModule->getPageSize().getY()); + SurfaceRect aBoundary(aSize); if( !r.inside(aBoundary) ) return false; diff --git a/canvas/source/tools/page.hxx b/canvas/source/tools/page.hxx index 14fa17c53ae0..6af4bf0f6be8 100644 --- a/canvas/source/tools/page.hxx +++ b/canvas/source/tools/page.hxx @@ -20,6 +20,7 @@ #pragma once #include <basegfx/vector/b2isize.hxx> +#include <basegfx/vector/b2ivector.hxx> #include <basegfx/range/b2irectangle.hxx> #include <rendering/icolorbuffer.hxx> #include <rendering/irendermodule.hxx> @@ -132,7 +133,7 @@ namespace canvas return pSurface->update( maRect.maPos, ::basegfx::B2IRectangle( maSourceOffset, - maSourceOffset + maRect.maSize ), + maSourceOffset + basegfx::B2IVector(maRect.maSize.getWidth(), maRect.maSize.getHeight())), *mpBuffer ); } diff --git a/canvas/source/tools/pagemanager.cxx b/canvas/source/tools/pagemanager.cxx index c1e874ca498a..6ffd7ee01b58 100644 --- a/canvas/source/tools/pagemanager.cxx +++ b/canvas/source/tools/pagemanager.cxx @@ -18,7 +18,7 @@ */ #include <sal/config.h> - +#include <basegfx/vector/b2ivector.hxx> #include "pagemanager.hxx" namespace canvas @@ -98,7 +98,7 @@ namespace canvas if( *aCurr && !( ( *aCurr )->isNaked() ) ) { const ::basegfx::B2ISize& rSize( ( *aCurr )->getSize() ); - sal_uInt32 nArea( rSize.getX() * rSize.getY() ); + sal_uInt32 nArea( rSize.getWidth() * rSize.getHeight() ); if( nCurrMaxArea < nArea ) { @@ -145,7 +145,8 @@ namespace canvas ::basegfx::B2ISize PageManager::getPageSize() const { - return mpRenderModule->getPageSize(); + return { mpRenderModule->getPageSize().getX(), + mpRenderModule->getPageSize().getY() }; } } diff --git a/canvas/source/tools/surface.cxx b/canvas/source/tools/surface.cxx index 9dfb0f7c9d36..88d20bbcfed8 100644 --- a/canvas/source/tools/surface.cxx +++ b/canvas/source/tools/surface.cxx @@ -58,12 +58,12 @@ namespace canvas if( mpFragment ) aDestOffset = mpFragment->getPos(); - const double pw( aPageSize.getX() ); - const double ph( aPageSize.getY() ); + const double pw( aPageSize.getWidth() ); + const double ph( aPageSize.getHeight() ); const double ox( aDestOffset.getX() ); const double oy( aDestOffset.getY() ); - const double sx( maSize.getX() ); - const double sy( maSize.getY() ); + const double sx( maSize.getWidth() ); + const double sy( maSize.getHeight() ); return ::basegfx::B2DRectangle( ox/pw, oy/ph, @@ -76,12 +76,12 @@ namespace canvas { ::basegfx::B2ISize aPageSize(mpPageManager->getPageSize()); - const double pw( aPageSize.getX() ); - const double ph( aPageSize.getY() ); + const double pw( aPageSize.getWidth() ); + const double ph( aPageSize.getHeight() ); const double ox( rPos.getX() ); const double oy( rPos.getY() ); - const double sx( rSize.getX() ); - const double sy( rSize.getY() ); + const double sx( rSize.getWidth() ); + const double sy( rSize.getHeight() ); return ::basegfx::B2DRectangle( ox/pw, oy/ph, @@ -145,10 +145,10 @@ namespace canvas ###################################### */ - const ::basegfx::B2DPoint& p0(aTransform * ::basegfx::B2DPoint(maSize.getX(),maSize.getY())); - const ::basegfx::B2DPoint& p1(aTransform * ::basegfx::B2DPoint(0.0,maSize.getY())); + const ::basegfx::B2DPoint& p0(aTransform * ::basegfx::B2DPoint(maSize.getWidth(),maSize.getHeight())); + const ::basegfx::B2DPoint& p1(aTransform * ::basegfx::B2DPoint(0.0,maSize.getHeight())); const ::basegfx::B2DPoint& p2(aTransform * ::basegfx::B2DPoint(0.0,0.0)); - const ::basegfx::B2DPoint& p3(aTransform * ::basegfx::B2DPoint(maSize.getX(),0.0)); + const ::basegfx::B2DPoint& p3(aTransform * ::basegfx::B2DPoint(maSize.getWidth(),0.0)); canvas::Vertex vertex; vertex.r = 1.0f; @@ -208,10 +208,10 @@ namespace canvas ::basegfx::fround(rArea.getMaximum().getY()) ); // clip the positions to the area this surface covers - aPos1.setX(std::max(aPos1.getX(),maSourceOffset.getX())); - aPos1.setY(std::max(aPos1.getY(),maSourceOffset.getY())); - aPos2.setX(std::min(aPos2.getX(),maSourceOffset.getX()+maSize.getX())); - aPos2.setY(std::min(aPos2.getY(),maSourceOffset.getY()+maSize.getY())); + aPos1.setX(std::max(aPos1.getX(), maSourceOffset.getX())); + aPos1.setY(std::max(aPos1.getY(), maSourceOffset.getY())); + aPos2.setX(std::min(aPos2.getX(), maSourceOffset.getX() + maSize.getWidth())); + aPos2.setY(std::min(aPos2.getY(), maSourceOffset.getY() + maSize.getHeight())); // if the resulting area is empty, return immediately ::basegfx::B2IVector aSize(aPos2 - aPos1); @@ -225,7 +225,7 @@ namespace canvas // convert size to normalized device coordinates const ::basegfx::B2DRectangle& rUV( getUVCoords(aPos1 - maSourceOffset + aDestOffset, - aSize) ); + basegfx::B2ISize(aSize.getX(), aSize.getY())) ); const double u1(rUV.getMinX()); const double v1(rUV.getMinY()); const double u2(rUV.getMaxX()); @@ -321,8 +321,8 @@ namespace canvas // the whole image, with non-zero maSourceOffset) const double x1(maSourceOffset.getX()); const double y1(maSourceOffset.getY()); - const double w(maSize.getX()); - const double h(maSize.getY()); + const double w(maSize.getWidth()); + const double h(maSize.getHeight()); const double x2(x1+w); const double y2(y1+h); const ::basegfx::B2DRectangle aSurfaceClipRect(x1,y1,x2,y2); diff --git a/canvas/source/tools/surfaceproxy.cxx b/canvas/source/tools/surfaceproxy.cxx index 3a1bf4fe3f21..af76b8b3c30a 100644 --- a/canvas/source/tools/surfaceproxy.cxx +++ b/canvas/source/tools/surfaceproxy.cxx @@ -36,10 +36,10 @@ namespace canvas { const ::basegfx::B2ISize aImageSize(mpBuffer->getWidth(),mpBuffer->getHeight()); const ::basegfx::B2ISize aPageSize(mpPageManager->getPageSize()); - const sal_Int32 aPageSizeX(aPageSize.getX()); - const sal_Int32 aPageSizeY(aPageSize.getY()); - const sal_Int32 aImageSizeX(aImageSize.getX()); - const sal_Int32 aImageSizeY(aImageSize.getY()); + const sal_Int32 aPageSizeX(aPageSize.getWidth()); + const sal_Int32 aPageSizeY(aPageSize.getHeight()); + const sal_Int32 aImageSizeX(aImageSize.getWidth()); + const sal_Int32 aImageSizeY(aImageSize.getHeight()); // see if the size of the colorbuffer is larger than the size // of a single page. if this is the case we divide the @@ -64,10 +64,10 @@ namespace canvas // the current surface is located at the position [x,y] // and has the size [min(restx,pagesizex),min(resty,pagesizey) ::basegfx::B2IPoint aOffset(x,y); - ::basegfx::B2ISize aSize( std::min( aImageSize.getX()-x, - aPageSize.getX() ), - std::min( aImageSize.getY()-y, - aPageSize.getY() ) ); + ::basegfx::B2ISize aSize( std::min( aImageSize.getWidth()-x, + aPageSize.getWidth() ), + std::min( aImageSize.getHeight()-y, + aPageSize.getHeight() ) ); maSurfaceList.push_back( std::make_shared<Surface>( diff --git a/canvas/source/tools/surfacerect.hxx b/canvas/source/tools/surfacerect.hxx index 808796d6d528..0925fa8e6f4b 100644 --- a/canvas/source/tools/surfacerect.hxx +++ b/canvas/source/tools/surfacerect.hxx @@ -49,8 +49,8 @@ namespace canvas { const sal_Int32 x1(maPos.getX()); const sal_Int32 y1(maPos.getY()); - const sal_Int32 x2(x1 + maSize.getX()); - const sal_Int32 y2(y1 + maSize.getY()); + const sal_Int32 x2(x1 + maSize.getWidth()); + const sal_Int32 y2(y1 + maSize.getHeight()); if(px < x1) return false; if(px >= x2) return false; if(py < y1) return false; @@ -63,13 +63,13 @@ namespace canvas { const sal_Int32 x1(maPos.getX()); const sal_Int32 y1(maPos.getY()); - const sal_Int32 x1w(x1 + maSize.getX() - 1); - const sal_Int32 y1h(y1 + maSize.getY() - 1); + const sal_Int32 x1w(x1 + maSize.getWidth() - 1); + const sal_Int32 y1h(y1 + maSize.getHeight() - 1); const sal_Int32 x2(r.maPos.getX()); const sal_Int32 y2(r.maPos.getY()); - const sal_Int32 x2w(x2 + r.maSize.getX() - 1); - const sal_Int32 y2h(y2 + r.maSize.getY() - 1); + const sal_Int32 x2w(x2 + r.maSize.getWidth() - 1); + const sal_Int32 y2h(y2 + r.maSize.getHeight() - 1); return !((x1w < x2) || (x2w < x1) || (y1h < y2) || (y2h < y1)); } @@ -78,8 +78,8 @@ namespace canvas { const sal_Int32 x1(maPos.getX()); const sal_Int32 y1(maPos.getY()); - const sal_Int32 x2(x1 + maSize.getX() - 1); - const sal_Int32 y2(y1 + maSize.getY() - 1); + const sal_Int32 x2(x1 + maSize.getWidth() - 1); + const sal_Int32 y2(y1 + maSize.getHeight() - 1); if(!(r.pointInside(x1,y1))) return false; if(!(r.pointInside(x2,y2))) return false; return true; diff --git a/include/basegfx/tuple/Size2D.hxx b/include/basegfx/tuple/Size2D.hxx index d4e2a2a784bc..28b967636fe2 100644 --- a/include/basegfx/tuple/Size2D.hxx +++ b/include/basegfx/tuple/Size2D.hxx @@ -76,6 +76,8 @@ public: } Size2D<TYPE> operator-(void) const { return Tuple2D<TYPE>::operator-(); } + + using Tuple2D<TYPE>::equalZero; }; template <typename TYPE> diff --git a/include/basegfx/utils/canvastools.hxx b/include/basegfx/utils/canvastools.hxx index 228a1b0f504a..46466097723d 100644 --- a/include/basegfx/utils/canvastools.hxx +++ b/include/basegfx/utils/canvastools.hxx @@ -61,6 +61,7 @@ namespace basegfx class B2DPolygon; class B2DPolyPolygon; class B2DSize; + class B2ISize; } namespace basegfx::unotools @@ -129,9 +130,9 @@ namespace basegfx::unotools BASEGFX_DLLPUBLIC ::basegfx::B2DRange b2DRectangleFromRealRectangle2D( const css::geometry::RealRectangle2D& ); ::basegfx::B3DRange b3DRectangleFromRealRectangle3D( const css::geometry::RealRectangle3D& ); - BASEGFX_DLLPUBLIC css::geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2IVector& ); + BASEGFX_DLLPUBLIC css::geometry::IntegerSize2D integerSize2DFromB2ISize(basegfx::B2ISize const& rSize); - BASEGFX_DLLPUBLIC ::basegfx::B2IVector b2ISizeFromIntegerSize2D( const css::geometry::IntegerSize2D& ); + BASEGFX_DLLPUBLIC ::basegfx::B2ISize b2ISizeFromIntegerSize2D( const css::geometry::IntegerSize2D& ); BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2IRectangleFromIntegerRectangle2D( const css::geometry::IntegerRectangle2D& ); BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2IRectangleFromAwtRectangle( const css::awt::Rectangle& ); diff --git a/include/basegfx/vector/b2dsize.hxx b/include/basegfx/vector/b2dsize.hxx index e15158fbf9fd..aaffee618888 100644 --- a/include/basegfx/vector/b2dsize.hxx +++ b/include/basegfx/vector/b2dsize.hxx @@ -46,7 +46,7 @@ public: } explicit B2DSize(B2ISize const& rSize) - : Size2D(rSize.getX(), rSize.getY()) + : Size2D(rSize.getWidth(), rSize.getHeight()) { } @@ -81,12 +81,20 @@ public: } }; +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const B2DSize& size) +{ + return stream << "(" << size.getWidth() << "," << size.getHeight() << ")"; +} + inline B2DSize operator*(B2DHomMatrix const& rMatrix, B2DSize const& rSize) { B2DSize aRes(rSize); aRes *= rMatrix; return aRes; } -} + +} // end basegfx /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/vector/b2isize.hxx b/include/basegfx/vector/b2isize.hxx index 926910b4827d..b26429bb434e 100644 --- a/include/basegfx/vector/b2isize.hxx +++ b/include/basegfx/vector/b2isize.hxx @@ -19,15 +19,43 @@ #pragma once -#include <basegfx/vector/b2ivector.hxx> +#include <basegfx/tuple/Size2D.hxx> +#include <basegfx/basegfxdllapi.h> namespace basegfx { -// syntactic sugar: a B2IVector exactly models a Size object, -// thus, for interface clarity, we provide an alias name +class B2ISize : public Size2D<sal_Int32> +{ +public: + B2ISize() + : Size2D(0, 0) + { + } + + B2ISize(sal_Int32 nX, sal_Int32 nY) + : Size2D(nX, nY) + { + } + + B2ISize(Size2D<sal_Int32> const& rSize) + : Size2D(rSize) + { + } -/// Alias name for interface clarity (not everybody is aware of the identity) -typedef B2IVector B2ISize; + using Size2D<sal_Int32>::operator+=; + using Size2D<sal_Int32>::operator-=; + using Size2D<sal_Int32>::operator*=; + using Size2D<sal_Int32>::operator/=; + using Size2D<sal_Int32>::operator-; +}; + +template <typename charT, typename traits> +inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& stream, + const B2ISize& size) +{ + return stream << "(" << size.getWidth() << "," << size.getHeight() << ")"; } +} // end basegfx + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index d550ecfce293..cfa423759202 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -122,7 +122,7 @@ namespace basegfx { class B2DHomMatrix; class B2DPolygon; class B2IVector; - typedef B2IVector B2ISize; + class B2ISize; } namespace com::sun::star::awt { diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index bf07e18acf60..57a76f752767 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -322,7 +322,7 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra xDrawPage)), mpSubsettableShapeManager( mpShapeManager ), mpBox2DWorld( std::make_shared<box2d::utils::box2DWorld>( - basegfx::B2DVector( getSlideSizeImpl() ) ) ), + basegfx::B2DVector(getSlideSizeImpl().getWidth(), getSlideSizeImpl().getHeight()) ) ), maContext( mpSubsettableShapeManager, rEventQueue, rEventMultiplexer, @@ -336,7 +336,7 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra mpBox2DWorld ), mrCursorManager( rCursorManager ), maAnimations( maContext, - basegfx::B2DVector( getSlideSizeImpl() ) ), + basegfx::B2DVector(getSlideSizeImpl().getWidth(), getSlideSizeImpl().getHeight()) ), maPolygons(std::move(rPolyPolygonVector)), maUserPaintColor(aUserPaintColor), mdUserPaintStrokeWidth(dUserPaintStrokeWidth), @@ -569,9 +569,8 @@ SlideBitmapSharedPtr SlideImpl::getCurrentSlideBitmap( const UnoViewSharedPtr& r } SlideBitmapSharedPtr& rBitmap( aIter->second.at( meAnimationState )); - const ::basegfx::B2ISize& rSlideSize( - getSlideSizePixel( ::basegfx::B2DVector( getSlideSize() ), - rView )); + auto aSize = getSlideSizePixel(basegfx::B2DVector(getSlideSize().getWidth(), getSlideSize().getHeight()), rView); + const basegfx::B2ISize rSlideSize(aSize.getX(), aSize.getY()); // is the bitmap valid (actually existent, and of correct // size)? @@ -920,7 +919,7 @@ void SlideImpl::applyShapeAttributes( extractValue( bVisible, rShapeProp.Value, pShape, - basegfx::B2DVector(getSlideSize()) )) + basegfx::B2DVector(getSlideSize().getWidth(), getSlideSize().getHeight()) )) { pAttrShape->setVisibility( bVisible ); } diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 473791bb620f..f02647097ea8 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -881,7 +881,7 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition( 0.0, 0.0, ShapeSharedPtr(), - basegfx::B2DVector( rEnteringSlide->getSlideSize() ) ), + basegfx::B2DVector(rEnteringSlide->getSlideSize().getWidth(), rEnteringSlide->getSlideSize().getHeight()) ), pTransition, true )); } @@ -1360,8 +1360,7 @@ sal_Bool SlideShowImpl::addView( { // set view transformation const basegfx::B2ISize slideSize = mpCurrentSlide->getSlideSize(); - pView->setViewSize( basegfx::B2DSize( slideSize.getX(), - slideSize.getY() ) ); + pView->setViewSize( basegfx::B2DSize(slideSize) ); } // clear view area (since it's newly added, diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index de7030f80778..13cf471a985c 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -686,8 +686,8 @@ namespace slideshow::internal // line will show to the bottom and the right. fillRect( pCanvas, ::basegfx::B2DRectangle( 0.0, 0.0, - rSize.getX(), - rSize.getY() ), + rSize.getWidth(), + rSize.getHeight() ), 0x000000FFU ); // tdf#148884 in dark mode impress's auto text color assumes it will render against @@ -710,8 +710,8 @@ namespace slideshow::internal // thus revealing ugly white pixel to the right and the bottom. fillRect( pCanvas, ::basegfx::B2DRectangle( 0.0, 0.0, - rSize.getX()-1, - rSize.getY()-1 ), + rSize.getWidth()-1, + rSize.getHeight()-1 ), nCanvasColor ); } diff --git a/slideshow/source/engine/transitions/combtransition.cxx b/slideshow/source/engine/transitions/combtransition.cxx index b79046542000..88e5c167e4a0 100644 --- a/slideshow/source/engine/transitions/combtransition.cxx +++ b/slideshow/source/engine/transitions/combtransition.cxx @@ -110,8 +110,8 @@ void CombTransition::renderComb( double t, // TODO(Q2): Use basegfx bitmaps here // TODO(F1): SlideBitmap is not fully portable between different canvases! - const basegfx::B2DVector enteringSizePixel( - getEnteringSlideSizePixel( rViewEntry.mpView) ); + auto aSlideSizePixel = getEnteringSlideSizePixel(rViewEntry.mpView); + const basegfx::B2DVector enteringSizePixel(aSlideSizePixel.getWidth(), aSlideSizePixel.getHeight()); const basegfx::B2DVector aPushDirection( enteringSizePixel * maPushDirectionUnit ); diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx index 6c8a0ec9eef4..03534822f140 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -92,9 +92,9 @@ SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr& // sprite to black. // create empty, black-filled bitmap - const basegfx::B2ISize slideSizePixel( - getSlideSizePixel( basegfx::B2DVector( mpEnteringSlide->getSlideSize() ), - rView )); + auto aSlideSize = mpEnteringSlide->getSlideSize(); + auto aVector = getSlideSizePixel(basegfx::B2DVector(aSlideSize.getWidth(), aSlideSize.getHeight()), rView); + const basegfx::B2ISize slideSizePixel(aVector.getX(), aVector.getY()); cppcanvas::CanvasSharedPtr pCanvas( rView->getCanvas() ); @@ -121,8 +121,8 @@ SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr& // clear bitmap to black fillRect( pBitmapCanvas, ::basegfx::B2DRectangle( 0.0, 0.0, - slideSizePixel.getX(), - slideSizePixel.getY() ), + slideSizePixel.getWidth(), + slideSizePixel.getHeight() ), 0x000000FFU ); pRet = std::make_shared<SlideBitmap>( pBitmap ); @@ -137,8 +137,9 @@ SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr& ::basegfx::B2ISize SlideChangeBase::getEnteringSlideSizePixel( const UnoViewSharedPtr& pView ) const { - return getSlideSizePixel( basegfx::B2DVector(mpEnteringSlide->getSlideSize().getX(), mpEnteringSlide->getSlideSize().getY()), - pView ); + auto aSlideSize = mpEnteringSlide->getSlideSize(); + auto aSlideSizePixel = getSlideSizePixel( basegfx::B2DVector(aSlideSize.getWidth(), aSlideSize.getHeight()), pView); + return {aSlideSizePixel.getX(), aSlideSizePixel.getY() }; } void SlideChangeBase::renderBitmap( @@ -486,9 +487,8 @@ void SlideChangeBase::addSprites( ViewEntry& rEntry ) if( mbCreateEnteringSprites ) { // create entering sprite: - const basegfx::B2ISize enteringSlideSizePixel( - getSlideSizePixel( basegfx::B2DVector( mpEnteringSlide->getSlideSize() ), - rEntry.mpView )); + auto aSlideSizePixel = getSlideSizePixel(basegfx::B2DVector(mpEnteringSlide->getSlideSize().getWidth(), mpEnteringSlide->getSlideSize().getHeight()), rEntry.mpView); + const basegfx::B2ISize enteringSlideSizePixel(aSlideSizePixel.getX(), aSlideSizePixel.getY()); rEntry.mpInSprite = createSprite( rEntry.mpView, basegfx::B2DSize( enteringSlideSizePixel ), diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx index fcee18e262c3..f183fc6d818a 100644 --- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx @@ -616,10 +616,11 @@ void MovingSlideChange::performIn( aViewTransform * basegfx::B2DPoint() ); // move sprite + auto aSlideSizePixel = getEnteringSlideSizePixel(rViewEntry.mpView); rSprite->movePixel( aPageOrigin + ((t - 1.0) * - basegfx::B2DVector( getEnteringSlideSizePixel(rViewEntry.mpView) ) * + basegfx::B2DVector( aSlideSizePixel.getWidth(), aSlideSizePixel.getHeight()) * maEnteringDirection) ); } @@ -648,9 +649,10 @@ void MovingSlideChange::performOut( aViewTransform * basegfx::B2DPoint() ); // move sprite + auto aSlideSizePixel = getEnteringSlideSizePixel(rViewEntry.mpView); rSprite->movePixel( aPageOrigin + (t * - basegfx::B2DVector( getEnteringSlideSizePixel(rViewEntry.mpView) ) * + basegfx::B2DVector(aSlideSizePixel.getWidth(), aSlideSizePixel.getHeight()) * maLeavingDirection) ); } diff --git a/slideshow/source/inc/tools.hxx b/slideshow/source/inc/tools.hxx index edfefe246fe4..b3081d9fff37 100644 --- a/slideshow/source/inc/tools.hxx +++ b/slideshow/source/inc/tools.hxx @@ -45,7 +45,7 @@ namespace basegfx class B2DVector; class B2IVector; class B2DHomMatrix; - typedef B2IVector B2ISize; + class B2ISize; } namespace cppcanvas{ class Canvas; } |