diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-09-21 12:17:00 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-07-13 13:19:00 +0200 |
commit | f896bbcffeccd27248f908d2628d03dddf83ea94 (patch) | |
tree | ffbf0300461780c94e897cad2ad29906695ac91d /canvas/source/directx | |
parent | 6086d896183a529d4a0b83d4862970c8f320b0aa (diff) |
basegfx: replace typedef with a class B2ISize based on Size2D
Change-Id: Iaf7d02bb236f81a38a67a1430a718b6c3c78efae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139708
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'canvas/source/directx')
-rw-r--r-- | canvas/source/directx/dx_9rm.cxx | 92 | ||||
-rw-r--r-- | canvas/source/directx/dx_bitmap.cxx | 18 | ||||
-rw-r--r-- | canvas/source/directx/dx_bitmap.hxx | 10 | ||||
-rw-r--r-- | canvas/source/directx/dx_bitmapcanvashelper.cxx | 1 | ||||
-rw-r--r-- | canvas/source/directx/dx_canvasbitmap.cxx | 42 | ||||
-rw-r--r-- | canvas/source/directx/dx_canvascustomsprite.cxx | 2 | ||||
-rw-r--r-- | canvas/source/directx/dx_canvashelper.cxx | 4 | ||||
-rw-r--r-- | canvas/source/directx/dx_ibitmap.hxx | 2 | ||||
-rw-r--r-- | canvas/source/directx/dx_rendermodule.hxx | 2 | ||||
-rw-r--r-- | canvas/source/directx/dx_spritedevicehelper.cxx | 2 | ||||
-rw-r--r-- | canvas/source/directx/dx_surfacebitmap.cxx | 52 | ||||
-rw-r--r-- | canvas/source/directx/dx_surfacebitmap.hxx | 8 | ||||
-rw-r--r-- | canvas/source/directx/dx_textlayout_drawhelper.cxx | 4 |
13 files changed, 112 insertions, 127 deletions
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); |