From 29eb4f122bab9ba7280945d0c8a15588b1d46895 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 14 Oct 2016 16:59:02 +0200 Subject: clang-cl loplugin: canvas Change-Id: I3e4f9ccbe608a98759f2a9e312839eb909e6b575 Reviewed-on: https://gerrit.libreoffice.org/29878 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- canvas/source/directx/dx_9rm.cxx | 109 ++++++++++----------- canvas/source/directx/dx_bitmap.cxx | 5 +- canvas/source/directx/dx_bitmap.hxx | 16 +-- canvas/source/directx/dx_bitmapcanvashelper.cxx | 2 +- canvas/source/directx/dx_canvas.cxx | 10 +- canvas/source/directx/dx_canvasbitmap.cxx | 16 +-- canvas/source/directx/dx_canvasfont.cxx | 4 +- canvas/source/directx/dx_canvasfont.hxx | 18 ++-- canvas/source/directx/dx_canvashelper.cxx | 30 +++--- canvas/source/directx/dx_canvashelper.hxx | 2 +- .../source/directx/dx_canvashelper_texturefill.cxx | 4 +- canvas/source/directx/dx_config.hxx | 4 +- canvas/source/directx/dx_devicehelper.cxx | 12 +-- canvas/source/directx/dx_gdiplususer.cxx | 2 +- canvas/source/directx/dx_impltools.cxx | 28 +----- canvas/source/directx/dx_impltools.hxx | 3 +- canvas/source/directx/dx_spritecanvas.cxx | 8 +- canvas/source/directx/dx_spritecanvashelper.cxx | 8 +- canvas/source/directx/dx_spritedevicehelper.cxx | 14 +-- canvas/source/directx/dx_spritedevicehelper.hxx | 4 +- canvas/source/directx/dx_spritehelper.cxx | 2 +- canvas/source/directx/dx_spritehelper.hxx | 2 +- canvas/source/directx/dx_surfacebitmap.cxx | 60 ++++++------ canvas/source/directx/dx_surfacebitmap.hxx | 16 +-- canvas/source/directx/dx_textlayout.hxx | 44 ++++----- canvas/source/directx/dx_textlayout_drawhelper.cxx | 8 +- canvas/source/directx/dx_vcltools.cxx | 21 ++-- canvas/source/directx/dx_winstuff.hxx | 10 +- 28 files changed, 217 insertions(+), 245 deletions(-) (limited to 'canvas/source/directx') diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index 2dcebf36521c..1f58f2bd8349 100644 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -74,7 +74,7 @@ namespace dxcanvas monitorSupport() : mhLibrary(LoadLibrary("user32.dll")), - mpMonitorFromWindow(NULL) + mpMonitorFromWindow(nullptr) { if(mhLibrary) mpMonitorFromWindow = reinterpret_cast( @@ -86,14 +86,14 @@ namespace dxcanvas { if(mhLibrary) FreeLibrary(mhLibrary); - mhLibrary=0; + mhLibrary=nullptr; } HMONITOR MonitorFromWindow( HWND hwnd ) { // return adapter_default in case something went wrong... if(!(mpMonitorFromWindow)) - return HMONITOR(0); + return HMONITOR(nullptr); // MONITOR_DEFAULTTONEAREST const DWORD dwFlags(0x00000002); return mpMonitorFromWindow(hwnd,dwFlags); @@ -127,15 +127,14 @@ namespace dxcanvas public: DXSurface( DXRenderModule& rRenderModule, const ::basegfx::B2ISize& rSize ); - ~DXSurface(); + ~DXSurface() override; - virtual bool selectTexture(); - virtual bool isValid(); + virtual bool selectTexture() override; + virtual bool isValid() override; virtual bool update( const ::basegfx::B2IPoint& rDestPos, const ::basegfx::B2IRange& rSourceRect, - ::canvas::IColorBuffer& rSource ); + ::canvas::IColorBuffer& rSource ) override; virtual ::basegfx::B2IVector getSize(); - COMReference getTexture() const; private: /// Guard local methods against concurrent access to RenderModule @@ -168,27 +167,27 @@ namespace dxcanvas { public: explicit DXRenderModule( const vcl::Window& rWindow ); - ~DXRenderModule(); + ~DXRenderModule() override; - virtual void lock() const { maMutex.acquire(); } - virtual void unlock() const { maMutex.release(); } + virtual void lock() const override { maMutex.acquire(); } + virtual void unlock() const override { maMutex.release(); } virtual COMReference - createSystemMemorySurface( const ::basegfx::B2IVector& rSize ); - virtual void disposing(); - virtual HWND getHWND() const { return mhWnd; } - virtual void screenShot(); + createSystemMemorySurface( const ::basegfx::B2IVector& rSize ) override; + virtual void disposing() override; + virtual HWND getHWND() const override { return mhWnd; } + virtual void screenShot() override; virtual bool flip( const ::basegfx::B2IRectangle& rUpdateArea, - const ::basegfx::B2IRectangle& rCurrWindowArea ); + const ::basegfx::B2IRectangle& rCurrWindowArea ) override; - virtual void resize( const ::basegfx::B2IRange& rect ); - virtual ::basegfx::B2IVector getPageSize(); - virtual ::std::shared_ptr createSurface( const ::basegfx::B2IVector& surfaceSize ); - virtual void beginPrimitive( PrimitiveType eType ); - virtual void endPrimitive(); - virtual void pushVertex( const ::canvas::Vertex& vertex ); - virtual bool isError(); + virtual void resize( const ::basegfx::B2IRange& rect ) override; + virtual ::basegfx::B2IVector getPageSize() override; + virtual ::std::shared_ptr createSurface( const ::basegfx::B2IVector& surfaceSize ) override; + virtual void beginPrimitive( PrimitiveType eType ) override; + virtual void endPrimitive() override; + virtual void pushVertex( const ::canvas::Vertex& vertex ) override; + virtual bool isError() override; COMReference getDevice() { return mpDevice; } @@ -226,7 +225,7 @@ namespace dxcanvas ::basegfx::B2IVector maPageSize; D3DPRESENT_PARAMETERS mad3dpp; - inline bool isDisposed() const { return (mhWnd==NULL); } + inline bool isDisposed() const { return (mhWnd==nullptr); } struct dxvertex { @@ -268,7 +267,7 @@ namespace dxcanvas DXSurface::DXSurface( DXRenderModule& rRenderModule, const ::basegfx::B2ISize& rSize ) : mrRenderModule(rRenderModule), - mpTexture(NULL), + mpTexture(nullptr), maSize() { ImplRenderModuleGuard aGuard( mrRenderModule ); @@ -291,13 +290,13 @@ namespace dxcanvas COMReference pDevice(rRenderModule.getDevice()); - IDirect3DTexture9 *pTexture(NULL); + IDirect3DTexture9 *pTexture(nullptr); if(FAILED(pDevice->CreateTexture( rSize.getX(), rSize.getY(), 1,0,D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, - &pTexture,NULL))) + &pTexture,nullptr))) return; mpTexture=COMReference(pTexture); @@ -389,7 +388,7 @@ namespace dxcanvas pImage += rSourceRect.getMinX()*nSourceBytesPerPixel; // calculate the destination memory address - sal_uInt8 *pDst = (sal_uInt8*)aLockedRect.pBits; + sal_uInt8 *pDst = static_cast(aLockedRect.pBits); const sal_uInt32 nNumBytesToCopy( static_cast( @@ -397,7 +396,7 @@ namespace dxcanvas nSourceBytesPerPixel); const sal_uInt64 nNumLines(rSourceRect.getHeight()); - for(sal_uInt32 i=0; i(aLockedRect.pBits); const sal_Int32 nNumLines( sal::static_int_cast(rSourceRect.getHeight())); @@ -479,17 +478,11 @@ namespace dxcanvas return maSize; } - COMReference DXSurface::getTexture() const - { - return mpTexture; - } - - // DXRenderModule::DXRenderModule DXRenderModule::DXRenderModule( const vcl::Window& rWindow ) : - mhWnd(0), + mhWnd(nullptr), mpDevice(), mpDirect3D9(), mpSwapChain(), @@ -537,14 +530,14 @@ namespace dxcanvas } maPageSize=aPageSize; - IDirect3DVertexBuffer9 *pVB(NULL); + IDirect3DVertexBuffer9 *pVB(nullptr); DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1); if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, aFVF, D3DPOOL_DEFAULT, &pVB, - NULL)) ) + nullptr)) ) { throw lang::NoSupportException( "Could not create DirectX device - out of memory!" ); @@ -573,7 +566,7 @@ namespace dxcanvas mpTexture.reset(); mpWindow.disposeAndClear(); - mhWnd=NULL; + mhWnd=nullptr; // refrain from releasing the DX9 objects. We're the only // ones holding references to them, and it might be @@ -603,14 +596,14 @@ namespace dxcanvas mpWindow->SetParentClipMode(ParentClipMode::NoClip); // the system child window must not clear its background - mpWindow->EnableEraseBackground( sal_False ); + mpWindow->EnableEraseBackground( false ); mpWindow->SetControlForeground(); mpWindow->SetControlBackground(); const SystemEnvData *pData = mpWindow->GetSystemData(); const HWND hwnd(reinterpret_cast(pData->hWnd)); - mhWnd = const_cast(hwnd); + mhWnd = hwnd; ENSURE_OR_THROW( IsWindow( reinterpret_cast(mhWnd) ), "DXRenderModule::create() No valid HWND given." ); @@ -760,7 +753,7 @@ namespace dxcanvas // now create the device, first try hardware vertex processing, // then software vertex processing. if both queries fail, we give up // and indicate failure. - IDirect3DDevice9 *pDevice(NULL); + IDirect3DDevice9 *pDevice(nullptr); if(FAILED(mpDirect3D9->CreateDevice(aAdapter, D3DDEVTYPE_HAL, mhWnd, @@ -781,7 +774,7 @@ namespace dxcanvas mpDevice=COMReference(pDevice); // After CreateDevice, the first swap chain already exists, so just get it... - IDirect3DSwapChain9 *pSwapChain(NULL); + IDirect3DSwapChain9 *pSwapChain(nullptr); pDevice->GetSwapChain(0,&pSwapChain); mpSwapChain=COMReference(pSwapChain); if( !mpSwapChain.is() ) @@ -792,10 +785,10 @@ namespace dxcanvas // please note that this is only possible since we created the // backbuffer with copy semantics [the content is preserved after // calls to Present()], which is an unnecessarily expensive operation. - LPDIRECT3DSURFACE9 pBackBuffer = NULL; + LPDIRECT3DSURFACE9 pBackBuffer = nullptr; mpSwapChain->GetBackBuffer(0,D3DBACKBUFFER_TYPE_MONO,&pBackBuffer); mpDevice->SetRenderTarget( 0, pBackBuffer ); - mpDevice->Clear(0,NULL,D3DCLEAR_TARGET,0,1.0f,0); + mpDevice->Clear(0,nullptr,D3DCLEAR_TARGET,0,1.0f,0); pBackBuffer->Release(); return true; @@ -808,19 +801,19 @@ namespace dxcanvas COMReference DXRenderModule::createSystemMemorySurface( const ::basegfx::B2IVector& rSize ) { if(isDisposed()) - return COMReference(NULL); + return COMReference(nullptr); // please note that D3DFMT_X8R8G8B8 is the only format we're // able to choose here, since GetDC() doesn't support any // other 32bit-format. - IDirect3DSurface9 *pSurface(NULL); + IDirect3DSurface9 *pSurface(nullptr); if( FAILED(mpDevice->CreateOffscreenPlainSurface( rSize.getX(), rSize.getY(), D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, &pSurface, - NULL)) ) + nullptr)) ) { throw lang::NoSupportException( "Could not create offscreen surface - out of mem!" ); @@ -852,7 +845,7 @@ namespace dxcanvas rUpdateArea.getMaxX(), rUpdateArea.getMaxY() }; - HRESULT hr(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0)); + HRESULT hr(mpSwapChain->Present(&aRect,&aRect,nullptr,nullptr,0)); if(FAILED(hr)) { if(hr != D3DERR_DEVICELOST) @@ -867,14 +860,14 @@ namespace dxcanvas hr = mpDevice->Reset(&mad3dpp); if(SUCCEEDED(hr)) { - IDirect3DVertexBuffer9 *pVB(NULL); + IDirect3DVertexBuffer9 *pVB(nullptr); DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1); if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, aFVF, D3DPOOL_DEFAULT, &pVB, - NULL)) ) + nullptr)) ) { throw lang::NoSupportException( "Could not create DirectX device - out of memory!" ); @@ -882,7 +875,7 @@ namespace dxcanvas mpVertexBuffer=COMReference(pVB); // retry after the restore - if(SUCCEEDED(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0))) + if(SUCCEEDED(mpSwapChain->Present(&aRect,&aRect,nullptr,nullptr,0))) return true; } @@ -951,7 +944,7 @@ namespace dxcanvas // clear before, save resources mpSwapChain.reset(); - IDirect3DSwapChain9 *pSwapChain(NULL); + IDirect3DSwapChain9 *pSwapChain(nullptr); if(FAILED(mpDevice->CreateAdditionalSwapChain(&mad3dpp,&pSwapChain))) return; mpSwapChain=COMReference(pSwapChain); @@ -961,10 +954,10 @@ namespace dxcanvas // please note that this is only possible since we created the // backbuffer with copy semantics [the content is preserved after // calls to Present()], which is an unnecessarily expensive operation. - LPDIRECT3DSURFACE9 pBackBuffer = NULL; + LPDIRECT3DSURFACE9 pBackBuffer = nullptr; mpSwapChain->GetBackBuffer(0,D3DBACKBUFFER_TYPE_MONO,&pBackBuffer); mpDevice->SetRenderTarget( 0, pBackBuffer ); - mpDevice->Clear(0,NULL,D3DCLEAR_TARGET,0,1.0f,0); + mpDevice->Clear(0,nullptr,D3DCLEAR_TARGET,0,1.0f,0); pBackBuffer->Release(); } } @@ -1214,13 +1207,13 @@ namespace dxcanvas maReadIndex = 0; } - dxvertex *vertices(NULL); + dxvertex *vertices(nullptr); const std::size_t nNumVertices( std::min(maNumVertices - maWriteIndex, nSize)); if(FAILED(mpVertexBuffer->Lock(maWriteIndex*nVertexStride, nNumVertices*nVertexStride, - (void **)&vertices, + reinterpret_cast(&vertices), dwLockFlags))) return; diff --git a/canvas/source/directx/dx_bitmap.cxx b/canvas/source/directx/dx_bitmap.cxx index a5561b79cdbd..a9192e05e2dc 100644 --- a/canvas/source/directx/dx_bitmap.cxx +++ b/canvas/source/directx/dx_bitmap.cxx @@ -139,7 +139,10 @@ namespace dxcanvas aBmpData.Height = rect.Y2-rect.Y1; aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = (void*)data.getConstArray(); + aBmpData.Scan0 = const_cast(data.getConstArray()); + // const_cast is safe, "Gdiplus::ImageLockModeWrite + // | Gdiplus::ImageLockModeUserInputBuf makes the data go from + // BitmapData into Bitmap", says Thorsten // TODO(F1): Support more pixel formats natively diff --git a/canvas/source/directx/dx_bitmap.hxx b/canvas/source/directx/dx_bitmap.hxx index b17c7f5364a1..f9e3470f0d5f 100644 --- a/canvas/source/directx/dx_bitmap.hxx +++ b/canvas/source/directx/dx_bitmap.hxx @@ -41,29 +41,29 @@ namespace dxcanvas DXBitmap( const ::basegfx::B2IVector& rSize, bool bWithAlpha ); - virtual GraphicsSharedPtr getGraphics(); + virtual GraphicsSharedPtr getGraphics() override; - virtual BitmapSharedPtr getBitmap() const; - virtual ::basegfx::B2IVector getSize() const; - virtual bool hasAlpha() const; + virtual BitmapSharedPtr getBitmap() const override; + virtual ::basegfx::B2IVector getSize() const override; + virtual bool hasAlpha() const override; css::uno::Sequence< sal_Int8 > getData( css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerRectangle2D& rect ); + const css::geometry::IntegerRectangle2D& rect ) override; void setData( const css::uno::Sequence< sal_Int8 >& data, const css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerRectangle2D& rect ); + const css::geometry::IntegerRectangle2D& rect ) override; void setPixel( const css::uno::Sequence< sal_Int8 >& color, const css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerPoint2D& pos ); + const css::geometry::IntegerPoint2D& pos ) override; css::uno::Sequence< sal_Int8 > getPixel( css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerPoint2D& pos ); + const css::geometry::IntegerPoint2D& pos ) override; private: // Refcounted global GDI+ state container diff --git a/canvas/source/directx/dx_bitmapcanvashelper.cxx b/canvas/source/directx/dx_bitmapcanvashelper.cxx index 09f4f5170a64..d2c4fa7b7736 100644 --- a/canvas/source/directx/dx_bitmapcanvashelper.cxx +++ b/canvas/source/directx/dx_bitmapcanvashelper.cxx @@ -122,7 +122,7 @@ namespace dxcanvas mpTarget->hasAlpha() ); } - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } void BitmapCanvasHelper::copyRect( const rendering::XCanvas* /*pCanvas*/, diff --git a/canvas/source/directx/dx_canvas.cxx b/canvas/source/directx/dx_canvas.cxx index 854d38628993..8f806a5acedd 100644 --- a/canvas/source/directx/dx_canvas.cxx +++ b/canvas/source/directx/dx_canvas.cxx @@ -65,7 +65,7 @@ namespace dxcanvas GraphicsSharedPtr mpGraphics; public: explicit GraphicsProviderImpl( Gdiplus::Graphics* pGraphics ) : mpGraphics( pGraphics ) {} - virtual GraphicsSharedPtr getGraphics() { return mpGraphics; } + virtual GraphicsSharedPtr getGraphics() override { return mpGraphics; } }; Canvas::Canvas( const uno::Sequence< uno::Any >& aArguments, @@ -103,7 +103,7 @@ namespace dxcanvas sal_Int64 nPtr = 0; maArguments[0] >>= nPtr; OutputDevice* pOutDev = reinterpret_cast(nPtr); - ENSURE_ARG_OR_THROW( pOutDev != NULL,"Canvas::initialize: invalid OutDev pointer" ); + ENSURE_ARG_OR_THROW( pOutDev != nullptr,"Canvas::initialize: invalid OutDev pointer" ); // setup helper maDeviceHelper.init( pSysData->hDC, pOutDev, *this ); @@ -164,7 +164,7 @@ namespace dxcanvas sal_Int64 nPtr = 0; maArguments[0] >>= nPtr; OutputDevice* pOutDev = reinterpret_cast(nPtr); - ENSURE_ARG_OR_THROW( pOutDev != NULL,"Canvas::initialize: invalid OutDev pointer" ); + ENSURE_ARG_OR_THROW( pOutDev != nullptr,"Canvas::initialize: invalid OutDev pointer" ); // setup helper maDeviceHelper.init( pSysData->hDC, pOutDev, *this ); @@ -174,7 +174,7 @@ namespace dxcanvas // here. for this, check whether the HDC has a bitmap // selected. HBITMAP hBmp; - hBmp=(HBITMAP)GetCurrentObject(pSysData->hDC, OBJ_BITMAP); + hBmp=static_cast(GetCurrentObject(pSysData->hDC, OBJ_BITMAP)); if( !hBmp || GetObjectType(pSysData->hDC) != OBJ_MEMDC ) { throw lang::NoSupportException( "Passed HDC is no mem DC/has no bitmap selected!"); @@ -183,7 +183,7 @@ namespace dxcanvas mpTarget.reset( new DXBitmap( BitmapSharedPtr( Gdiplus::Bitmap::FromHBITMAP( - hBmp, 0) ), + hBmp, nullptr) ), false )); maCanvasHelper.setTarget( mpTarget ); diff --git a/canvas/source/directx/dx_canvasbitmap.cxx b/canvas/source/directx/dx_canvasbitmap.cxx index f492637990fd..1b86f9c98f0e 100644 --- a/canvas/source/directx/dx_canvasbitmap.cxx +++ b/canvas/source/directx/dx_canvasbitmap.cxx @@ -84,7 +84,7 @@ namespace dxcanvas { // sorry, no BitmapEx here... case 0: - aRes = css::uno::Any( reinterpret_cast( (BitmapEx*) NULL ) ); + aRes = css::uno::Any( reinterpret_cast( nullptr ) ); break; case 1: @@ -103,7 +103,7 @@ namespace dxcanvas { // need to copy&convert the bitmap, since dx // canvas uses inline alpha channel - HDC hScreenDC=GetDC(NULL); + HDC hScreenDC=GetDC(nullptr); const basegfx::B2IVector aSize(mpBitmap->getSize()); HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC, aSize.getX(), @@ -132,7 +132,7 @@ namespace dxcanvas aBmpData.Height = aSize.getY(); aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = NULL; + aBmpData.Scan0 = nullptr; const Gdiplus::Rect aRect( 0,0,aSize.getX(),aSize.getY() ); BitmapSharedPtr pGDIPlusBitmap=mpBitmap->getBitmap(); if( Gdiplus::Ok != pGDIPlusBitmap->LockBits( &aRect, @@ -146,7 +146,7 @@ namespace dxcanvas // now aBmpData.Scan0 contains our bits - push // them into HBITMAP, ignoring alpha - SetDIBits( hScreenDC, hBmpBitmap, 0, aSize.getY(), aBmpData.Scan0, (PBITMAPINFO)&aBIH, DIB_RGB_COLORS ); + SetDIBits( hScreenDC, hBmpBitmap, 0, aSize.getY(), aBmpData.Scan0, reinterpret_cast(&aBIH), DIB_RGB_COLORS ); pGDIPlusBitmap->UnlockBits( &aBmpData ); @@ -170,7 +170,7 @@ namespace dxcanvas // need to copy&convert the bitmap, since dx // canvas uses inline alpha channel - HDC hScreenDC=GetDC(NULL); + HDC hScreenDC=GetDC(nullptr); const basegfx::B2IVector aSize(mpBitmap->getSize()); HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC, aSize.getX(), aSize.getY() ); if( !hBmpBitmap ) @@ -193,7 +193,7 @@ namespace dxcanvas aBmpData.Height = aSize.getY(); aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = NULL; + aBmpData.Scan0 = nullptr; const Gdiplus::Rect aRect( 0,0,aSize.getX(),aSize.getY() ); BitmapSharedPtr pGDIPlusBitmap=mpBitmap->getBitmap(); if( Gdiplus::Ok != pGDIPlusBitmap->LockBits( &aRect, @@ -208,7 +208,7 @@ namespace dxcanvas // copy only alpha channel to pAlphaBits const sal_Int32 nScanWidth((aSize.getX() + 3) & ~3); std::unique_ptr pAlphaBits( new sal_uInt8[nScanWidth*aSize.getY()] ); - const sal_uInt8* pInBits=(sal_uInt8*)aBmpData.Scan0; + const sal_uInt8* pInBits=static_cast(aBmpData.Scan0); pInBits+=3; for( sal_Int32 y=0; y(&aDIB), DIB_RGB_COLORS ); uno::Sequence< uno::Any > args(1); args[0] = uno::Any( sal_Int64(hBmpBitmap) ); diff --git a/canvas/source/directx/dx_canvasfont.cxx b/canvas/source/directx/dx_canvasfont.cxx index a7f268eb55bc..8b73195f437c 100644 --- a/canvas/source/directx/dx_canvasfont.cxx +++ b/canvas/source/directx/dx_canvasfont.cxx @@ -63,9 +63,9 @@ namespace dxcanvas std::vector< sal_Unicode > pStrBuf(nLen+1,0); std::copy(pStr,pStr+nLen,&pStrBuf[0]); - mpFontFamily.reset( new Gdiplus::FontFamily(reinterpret_cast(&pStrBuf[0]),NULL) ); + mpFontFamily.reset( new Gdiplus::FontFamily(reinterpret_cast(&pStrBuf[0]),nullptr) ); if( !mpFontFamily->IsAvailable() ) - mpFontFamily.reset( new Gdiplus::FontFamily(L"Arial",NULL) ); + mpFontFamily.reset( new Gdiplus::FontFamily(L"Arial",nullptr) ); mpFont.reset( new Gdiplus::Font( mpFontFamily.get(), static_cast(rFontRequest.CellSize), diff --git a/canvas/source/directx/dx_canvasfont.hxx b/canvas/source/directx/dx_canvasfont.hxx index 4083ea479b11..533f78c5eebb 100644 --- a/canvas/source/directx/dx_canvasfont.hxx +++ b/canvas/source/directx/dx_canvasfont.hxx @@ -59,19 +59,19 @@ namespace dxcanvas const css::geometry::Matrix2D& fontMatrix ); /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void SAL_CALL disposing() override; // XCanvasFont - virtual css::uno::Reference< css::rendering::XTextLayout > SAL_CALL createTextLayout( const css::rendering::StringContext& aText, sal_Int8 nDirection, sal_Int64 nRandomSeed ) throw (css::uno::RuntimeException); - virtual css::rendering::FontRequest SAL_CALL getFontRequest( ) throw (css::uno::RuntimeException); - virtual css::rendering::FontMetrics SAL_CALL getFontMetrics( ) throw (css::uno::RuntimeException); - virtual css::uno::Sequence< double > SAL_CALL getAvailableSizes( ) throw (css::uno::RuntimeException); - virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getExtraFontProperties( ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::rendering::XTextLayout > SAL_CALL createTextLayout( const css::rendering::StringContext& aText, sal_Int8 nDirection, sal_Int64 nRandomSeed ) throw (css::uno::RuntimeException) override; + virtual css::rendering::FontRequest SAL_CALL getFontRequest( ) throw (css::uno::RuntimeException) override; + virtual css::rendering::FontMetrics SAL_CALL getFontMetrics( ) throw (css::uno::RuntimeException) override; + virtual css::uno::Sequence< double > SAL_CALL getAvailableSizes( ) throw (css::uno::RuntimeException) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getExtraFontProperties( ) throw (css::uno::RuntimeException) override; // XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ); - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ) override; double getCellAscent() const; double getEmHeight() const; diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index 8ca63ecc4238..c319239808b8 100644 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -100,7 +100,7 @@ namespace dxcanvas CanvasHelper::CanvasHelper() : mpGdiPlusUser( GDIPlusUser::createInstance() ), - mpDevice( NULL ), + mpDevice( nullptr ), mpGraphicsProvider(), maOutputOffset() { @@ -109,7 +109,7 @@ namespace dxcanvas void CanvasHelper::disposing() { mpGraphicsProvider.reset(); - mpDevice = NULL; + mpDevice = nullptr; mpGdiPlusUser.reset(); } @@ -316,7 +316,7 @@ namespace dxcanvas } // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokePolyPolygon( const rendering::XCanvas* /*pCanvas*/, @@ -385,7 +385,7 @@ namespace dxcanvas } // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTexturedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, @@ -396,7 +396,7 @@ namespace dxcanvas const rendering::StrokeAttributes& /*strokeAttributes*/ ) { // TODO - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTextureMappedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, @@ -408,7 +408,7 @@ namespace dxcanvas const rendering::StrokeAttributes& /*strokeAttributes*/ ) { // TODO - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } uno::Reference< rendering::XPolyPolygon2D > CanvasHelper::queryStrokeShapes( const rendering::XCanvas* /*pCanvas*/, @@ -418,7 +418,7 @@ namespace dxcanvas const rendering::StrokeAttributes& /*strokeAttributes*/ ) { // TODO - return uno::Reference< rendering::XPolyPolygon2D >(NULL); + return uno::Reference< rendering::XPolyPolygon2D >(nullptr); } uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillPolyPolygon( const rendering::XCanvas* /*pCanvas*/, @@ -446,7 +446,7 @@ namespace dxcanvas } // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTextureMappedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, @@ -457,7 +457,7 @@ namespace dxcanvas const uno::Reference< geometry::XMapping2D >& /*xMapping*/ ) { // TODO - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } uno::Reference< rendering::XCanvasFont > CanvasHelper::createFont( const rendering::XCanvas* /*pCanvas*/, @@ -531,7 +531,7 @@ namespace dxcanvas "CanvasHelper::drawText(): GDI+ call failed" ); } - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawTextLayout( const rendering::XCanvas* /*pCanvas*/, @@ -558,7 +558,7 @@ namespace dxcanvas false ); } - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmap( const rendering::XCanvas* /*pCanvas*/, @@ -595,7 +595,7 @@ namespace dxcanvas } // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* pCanvas, @@ -640,14 +640,12 @@ namespace dxcanvas pBitmap->GetWidth(), pBitmap->GetHeight(), Gdiplus::UnitPixel, - &aImgAttr, - NULL, - NULL ), + &aImgAttr ), "CanvasHelper::drawBitmapModulated(): GDI+ call failed" ); } // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } uno::Reference< rendering::XGraphicDevice > CanvasHelper::getDevice() diff --git a/canvas/source/directx/dx_canvashelper.hxx b/canvas/source/directx/dx_canvashelper.hxx index 650caa3906f5..0696231aadb3 100644 --- a/canvas/source/directx/dx_canvashelper.hxx +++ b/canvas/source/directx/dx_canvashelper.hxx @@ -236,7 +236,7 @@ namespace dxcanvas /// Provides the Gdiplus::Graphics to render into GraphicsProviderSharedPtr mpGraphicsProvider; - bool needOutput() const { return mpGraphicsProvider.get() != NULL; }; + bool needOutput() const { return mpGraphicsProvider.get() != nullptr; }; // returns transparency of color void setupGraphicsState( GraphicsSharedPtr& rGraphics, diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index 0e9eb4d90d9a..c9853cf4a36e 100644 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -98,7 +98,7 @@ namespace dxcanvas aRightBottom*= aTextureTransform; Gdiplus::RectF aBounds; - rFillPath->GetBounds( &aBounds, NULL, NULL ); + rFillPath->GetBounds( &aBounds ); // now, we potentially have to enlarge our gradient area // atop and below the transformed [0,1]x[0,1] unit rect, @@ -602,7 +602,7 @@ namespace dxcanvas } // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); + return uno::Reference< rendering::XCachedPrimitive >(nullptr); } } diff --git a/canvas/source/directx/dx_config.hxx b/canvas/source/directx/dx_config.hxx index 77984d74b0f0..e93ef28d60ca 100644 --- a/canvas/source/directx/dx_config.hxx +++ b/canvas/source/directx/dx_config.hxx @@ -56,11 +56,11 @@ namespace dxcanvas (nDriverId != rRHS.nDriverId ? nDriverId < rRHS.nDriverId : (nDriverVersion != rRHS.nDriverVersion ? nDriverVersion < rRHS.nDriverVersion : (nDriverSubVersion != rRHS.nDriverSubVersion ? nDriverSubVersion < rRHS.nDriverSubVersion : - (nDriverBuildId != rRHS.nDriverBuildId ? nDriverBuildId < rRHS.nDriverBuildId : false))))))); + (nDriverBuildId != rRHS.nDriverBuildId && nDriverBuildId < rRHS.nDriverBuildId))))))); } }; - ~DXCanvasItem(); + ~DXCanvasItem() override; bool isDeviceUsable( const DeviceInfo& rDeviceInfo ) const; bool isBlacklistCurrentDevice() const; diff --git a/canvas/source/directx/dx_devicehelper.cxx b/canvas/source/directx/dx_devicehelper.cxx index f6a04057e420..e46951f6caeb 100644 --- a/canvas/source/directx/dx_devicehelper.cxx +++ b/canvas/source/directx/dx_devicehelper.cxx @@ -44,9 +44,9 @@ using namespace ::com::sun::star; namespace dxcanvas { DeviceHelper::DeviceHelper() : - mpDevice( NULL ), - mnHDC(0), - mpOutDev(0) + mpDevice( nullptr ), + mnHDC(nullptr), + mpOutDev(nullptr) { } @@ -65,9 +65,9 @@ namespace dxcanvas void DeviceHelper::disposing() { // release all references - mnHDC = 0; - mpDevice = NULL; - mpOutDev = 0; + mnHDC = nullptr; + mpDevice = nullptr; + mpOutDev = nullptr; } geometry::RealSize2D DeviceHelper::getPhysicalResolution() diff --git a/canvas/source/directx/dx_gdiplususer.cxx b/canvas/source/directx/dx_gdiplususer.cxx index b1517e65f52a..a7b0703915f2 100644 --- a/canvas/source/directx/dx_gdiplususer.cxx +++ b/canvas/source/directx/dx_gdiplususer.cxx @@ -64,7 +64,7 @@ namespace dxcanvas Gdiplus::GdiplusStartup( &a_GdiPlusToken, &gdiPlusStartupInput, - NULL ); + nullptr ); } ++n_gdiPlusUsageCount; diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx index f2d0e7745ba7..60429f2a500d 100644 --- a/canvas/source/directx/dx_impltools.cxx +++ b/canvas/source/directx/dx_impltools.cxx @@ -196,7 +196,7 @@ namespace dxcanvas // first point, thus, one more (can't simply // GraphicsPath::CloseFigure() it, since the last // point cannot have any control points for GDI+) - rPoints.resize( 3*nPoints + bClosedPolygon ); + rPoints.resize( 3*nPoints + (bClosedPolygon ? 1 : 0) ); sal_uInt32 nCurrOutput=0; for( sal_uInt32 nCurrPoint=0; nCurrPoint argbToDoubleSequence( const Gdiplus::ARGB& rColor ) - { - // TODO(F1): handle color space conversions, when defined on canvas/graphicDevice - uno::Sequence< double > aRet(4); - - aRet[0] = ((rColor >> 16) & 0xFF) / 255.0; // red - aRet[1] = ((rColor >> 8) & 0xFF) / 255.0; // green - aRet[2] = (rColor & 0xFF) / 255.0; // blue - aRet[3] = ((rColor >> 24) & 0xFF) / 255.0; // alpha - - return aRet; - } - - uno::Sequence< sal_Int8 > argbToIntSequence( const Gdiplus::ARGB& rColor ) + uno::Sequence< sal_Int8 > argbToIntSequence( Gdiplus::ARGB rColor ) { // TODO(F1): handle color space conversions, when defined on canvas/graphicDevice uno::Sequence< sal_Int8 > aRet(4); @@ -505,7 +487,7 @@ namespace dxcanvas { BitmapSharedPtr pBitmap( Gdiplus::Bitmap::FromBITMAPINFO( &rBI, - (void*)pBits ) ); + const_cast(pBits) ) ); return drawGdiPlusBitmap( rGraphics, pBitmap ); @@ -643,9 +625,7 @@ namespace dxcanvas aColorMatrix.m[4][3] = 0.0; aColorMatrix.m[4][4] = 1.0; - o_rAttr.SetColorMatrix( &aColorMatrix, - Gdiplus::ColorMatrixFlagsDefault, - Gdiplus::ColorAdjustTypeDefault ); + o_rAttr.SetColorMatrix( &aColorMatrix ); } } // namespace tools diff --git a/canvas/source/directx/dx_impltools.hxx b/canvas/source/directx/dx_impltools.hxx index 5601e21d5f45..f90c49cf5537 100644 --- a/canvas/source/directx/dx_impltools.hxx +++ b/canvas/source/directx/dx_impltools.hxx @@ -84,8 +84,7 @@ namespace dxcanvas ::basegfx::B2DPoint b2dPointFromGdiPlusPointF( const Gdiplus::PointF& ); ::basegfx::B2DRange b2dRangeFromGdiPlusRectF( const Gdiplus::RectF& ); - css::uno::Sequence< double > argbToDoubleSequence( const Gdiplus::ARGB& rColor ); - css::uno::Sequence< sal_Int8 > argbToIntSequence( const Gdiplus::ARGB& rColor ); + css::uno::Sequence< sal_Int8 > argbToIntSequence( Gdiplus::ARGB rColor ); Gdiplus::ARGB sequenceToArgb( const css::uno::Sequence< sal_Int8 >& rColor ); Gdiplus::ARGB sequenceToArgb( const css::uno::Sequence< double >& rColor ); diff --git a/canvas/source/directx/dx_spritecanvas.cxx b/canvas/source/directx/dx_spritecanvas.cxx index b8dc36f989e6..99ba39ceadfb 100644 --- a/canvas/source/directx/dx_spritecanvas.cxx +++ b/canvas/source/directx/dx_spritecanvas.cxx @@ -89,7 +89,7 @@ namespace dxcanvas awt::Rectangle aRect; maArguments[2] >>= aRect; - sal_Bool bIsFullscreen( sal_False ); + sal_Bool bIsFullscreen( false ); maArguments[3] >>= bIsFullscreen; // setup helper @@ -123,7 +123,7 @@ namespace dxcanvas // avoid repaints on hidden window (hidden: not mapped to // screen). Return failure, since the screen really has _not_ // been updated (caller should try again later) - return !mbIsVisible ? false : SpriteCanvasBaseT::showBuffer( bUpdateAll ); + return mbIsVisible && SpriteCanvasBaseT::showBuffer( bUpdateAll ); } sal_Bool SAL_CALL SpriteCanvas::switchBuffer( sal_Bool bUpdateAll ) throw (uno::RuntimeException) @@ -133,7 +133,7 @@ namespace dxcanvas // avoid repaints on hidden window (hidden: not mapped to // screen). Return failure, since the screen really has _not_ // been updated (caller should try again later) - return !mbIsVisible ? false : SpriteCanvasBaseT::switchBuffer( bUpdateAll ); + return mbIsVisible && SpriteCanvasBaseT::switchBuffer( bUpdateAll ); } sal_Bool SAL_CALL SpriteCanvas::updateScreen( sal_Bool bUpdateAll ) throw (uno::RuntimeException) @@ -143,7 +143,7 @@ namespace dxcanvas // avoid repaints on hidden window (hidden: not mapped to // screen). Return failure, since the screen really has _not_ // been updated (caller should try again later) - return !mbIsVisible ? false : maCanvasHelper.updateScreen( + return mbIsVisible && maCanvasHelper.updateScreen( ::basegfx::unotools::b2IRectangleFromAwtRectangle(maBounds), bUpdateAll, mbSurfaceDirty ); diff --git a/canvas/source/directx/dx_spritecanvashelper.cxx b/canvas/source/directx/dx_spritecanvashelper.cxx index a36f3aac8643..f8661d82a0d3 100644 --- a/canvas/source/directx/dx_spritecanvashelper.cxx +++ b/canvas/source/directx/dx_spritecanvashelper.cxx @@ -61,8 +61,8 @@ namespace dxcanvas } SpriteCanvasHelper::SpriteCanvasHelper() : - mpSpriteSurface( NULL ), - mpRedrawManager( NULL ), + mpSpriteSurface( nullptr ), + mpRedrawManager( nullptr ), mpRenderModule(), mpSurfaceProxy(), mpBackBuffer(), @@ -101,8 +101,8 @@ namespace dxcanvas mpBackBuffer.reset(); mpRenderModule.reset(); - mpRedrawManager = NULL; - mpSpriteSurface = NULL; + mpRedrawManager = nullptr; + mpSpriteSurface = nullptr; // forward to base CanvasHelper::disposing(); diff --git a/canvas/source/directx/dx_spritedevicehelper.cxx b/canvas/source/directx/dx_spritedevicehelper.cxx index 8f1f0a9da483..74e5957cdd89 100644 --- a/canvas/source/directx/dx_spritedevicehelper.cxx +++ b/canvas/source/directx/dx_spritedevicehelper.cxx @@ -43,7 +43,7 @@ namespace dxcanvas { SpriteDeviceHelper::SpriteDeviceHelper() : DeviceHelper(), - mpSpriteCanvas( NULL ), + mpSpriteCanvas( nullptr ), mpBackBuffer(), mpSurfaceProxyManager(), mpRenderModule() @@ -102,7 +102,7 @@ namespace dxcanvas mpBackBuffer.reset(); mpSurfaceProxyManager.reset(); mpRenderModule.reset(); - mpSpriteCanvas = NULL; + mpSpriteCanvas = nullptr; DeviceHelper::disposing(); } @@ -163,16 +163,16 @@ namespace dxcanvas // _always_ will have exactly one backbuffer } - sal_Bool SpriteDeviceHelper::showBuffer( bool, sal_Bool ) + bool SpriteDeviceHelper::showBuffer( bool, bool ) { SAL_WARN("canvas.directx", "Not supposed to be called, handled by SpriteCanvas"); - return sal_False; + return false; } - sal_Bool SpriteDeviceHelper::switchBuffer( bool, sal_Bool ) + bool SpriteDeviceHelper::switchBuffer( bool, bool ) { SAL_WARN("canvas.directx", "Not supposed to be called, handled by SpriteCanvas"); - return sal_False; + return false; } uno::Any SpriteDeviceHelper::isAccelerated() const @@ -209,7 +209,7 @@ namespace dxcanvas if( mpRenderModule ) return mpRenderModule->getHWND(); else - return 0; + return nullptr; } void SpriteDeviceHelper::dumpScreenContent() const diff --git a/canvas/source/directx/dx_spritedevicehelper.hxx b/canvas/source/directx/dx_spritedevicehelper.hxx index 6f3608e62f1d..9d5eed1b9789 100644 --- a/canvas/source/directx/dx_spritedevicehelper.hxx +++ b/canvas/source/directx/dx_spritedevicehelper.hxx @@ -63,8 +63,8 @@ namespace dxcanvas const css::geometry::IntegerSize2D& size ); void destroyBuffers( ); - sal_Bool showBuffer( bool bIsVisible, sal_Bool bUpdateAll ); - sal_Bool switchBuffer( bool bIsVisible, sal_Bool bUpdateAll ); + bool showBuffer( bool bIsVisible, bool bUpdateAll ); + bool switchBuffer( bool bIsVisible, bool bUpdateAll ); const IDXRenderModuleSharedPtr& getRenderModule() const { return mpRenderModule; } const DXSurfaceBitmapSharedPtr& getBackBuffer() const { return mpBackBuffer; } diff --git a/canvas/source/directx/dx_spritehelper.cxx b/canvas/source/directx/dx_spritehelper.cxx index c5352af48dbe..10131dadf19d 100644 --- a/canvas/source/directx/dx_spritehelper.cxx +++ b/canvas/source/directx/dx_spritehelper.cxx @@ -120,7 +120,7 @@ namespace dxcanvas // background buffer. // log output pos in device pixel - SAL_INFO("canva.directx", "SpriteHelper::redraw(): output pos is (" << + SAL_INFO("canvas.directx", "SpriteHelper::redraw(): output pos is (" << rPos.getX() << "," << rPos.getY() << ")" ); const ::basegfx::B2DVector& rSize( getSizePixel() ); diff --git a/canvas/source/directx/dx_spritehelper.hxx b/canvas/source/directx/dx_spritehelper.hxx index d298a0d20d8d..c1fb66e01794 100644 --- a/canvas/source/directx/dx_spritehelper.hxx +++ b/canvas/source/directx/dx_spritehelper.hxx @@ -87,7 +87,7 @@ namespace dxcanvas private: virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D( - css::uno::Reference< css::rendering::XPolyPolygon2D >& xPoly ) const; + css::uno::Reference< css::rendering::XPolyPolygon2D >& xPoly ) const override; /// Returns true, if the sprite _really_ needs redraw bool needRedraw() const; diff --git a/canvas/source/directx/dx_surfacebitmap.cxx b/canvas/source/directx/dx_surfacebitmap.cxx index df2962f531d3..2e4548677bc5 100644 --- a/canvas/source/directx/dx_surfacebitmap.cxx +++ b/canvas/source/directx/dx_surfacebitmap.cxx @@ -55,12 +55,12 @@ namespace dxcanvas // implementation of the 'IColorBuffer' interface public: - virtual sal_uInt8* lock() const; - virtual void unlock() const; - virtual sal_uInt32 getWidth() const; - virtual sal_uInt32 getHeight() const; - virtual sal_uInt32 getStride() const; - virtual Format getFormat() const; + virtual sal_uInt8* lock() const override; + virtual void unlock() const override; + virtual sal_uInt32 getWidth() const override; + virtual sal_uInt32 getHeight() const override; + virtual sal_uInt32 getStride() const override; + virtual Format getFormat() const override; private: @@ -71,9 +71,9 @@ namespace dxcanvas sal_uInt8* DXColorBuffer::lock() const { - if(SUCCEEDED(mpSurface->LockRect(&maLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) + if(SUCCEEDED(mpSurface->LockRect(&maLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) return static_cast(maLockedRect.pBits); - return NULL; + return nullptr; } void DXColorBuffer::unlock() const @@ -119,12 +119,12 @@ namespace dxcanvas // implementation of the 'IColorBuffer' interface public: - virtual sal_uInt8* lock() const; - virtual void unlock() const; - virtual sal_uInt32 getWidth() const; - virtual sal_uInt32 getHeight() const; - virtual sal_uInt32 getStride() const; - virtual Format getFormat() const; + virtual sal_uInt8* lock() const override; + virtual void unlock() const override; + virtual sal_uInt32 getWidth() const override; + virtual sal_uInt32 getHeight() const override; + virtual sal_uInt32 getStride() const override; + virtual Format getFormat() const override; private: @@ -139,14 +139,14 @@ namespace dxcanvas aBmpData.Height = maSize.getY(); aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = NULL; + aBmpData.Scan0 = nullptr; const Gdiplus::Rect aRect( 0,0,aBmpData.Width,aBmpData.Height ); if( Gdiplus::Ok != mpGDIPlusBitmap->LockBits( &aRect, Gdiplus::ImageLockModeRead, PixelFormat32bppARGB, &aBmpData ) ) { - return NULL; + return nullptr; } return static_cast(aBmpData.Scan0); @@ -314,7 +314,7 @@ namespace dxcanvas BitmapSharedPtr pResult; D3DLOCKED_RECT aLockedRect; - if(SUCCEEDED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) + if(SUCCEEDED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) { // decide about the format we pass the gdi+, the directx surface is always // 32bit, either with or without alpha component. @@ -324,7 +324,7 @@ namespace dxcanvas pResult.reset(new Gdiplus::Bitmap( maSize.getX(),maSize.getY(), aLockedRect.Pitch, nFormat, - (BYTE *)aLockedRect.pBits )); + static_cast(aLockedRect.pBits) )); mpSurface->UnlockRect(); } @@ -453,7 +453,7 @@ namespace dxcanvas uno::Sequence< sal_Int8 > aRes(nWidth*nHeight*4); D3DLOCKED_RECT aLockedRect; - if(FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) + if(FAILED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) return uno::Sequence< sal_Int8 >(); D3DSURFACE_DESC aDesc; if(FAILED(mpSurface->GetDesc(&aDesc))) @@ -461,8 +461,8 @@ namespace dxcanvas assert(aDesc.Format == D3DFMT_A8R8G8B8 || aDesc.Format == D3DFMT_X8R8G8B8); - sal_uInt8 *pSrc = (sal_uInt8 *)((((BYTE *)aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1); - sal_uInt8 *pDst = (sal_uInt8 *)aRes.getArray(); + sal_uInt8 *pSrc = (static_cast(aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1; + sal_uInt8 *pDst = reinterpret_cast(aRes.getArray()); sal_uInt32 nSegmentSizeInBytes = nWidth*4; for(sal_uInt32 y=0; ygetComponentTags().getArray()[0] == rendering::ColorComponentTag::RGB_RED && rBitmapLayout.ColorSpace->getComponentTags().getArray()[2] == rendering::ColorComponentTag::RGB_BLUE) { - pDst = (sal_uInt8 *)aRes.getArray(); + pDst = reinterpret_cast(aRes.getArray()); for(sal_uInt32 y=0; y(data.getConstArray()); // TODO(F1): Support more pixel formats natively @@ -536,11 +536,11 @@ namespace dxcanvas // lock the directx surface to receive the pointer to the surface memory. D3DLOCKED_RECT aLockedRect; - if(FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) + if(FAILED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) throw uno::RuntimeException(); - sal_uInt8 *pSrc = (sal_uInt8 *)data.getConstArray(); - sal_uInt8 *pDst = (sal_uInt8 *)((((BYTE *)aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1); + sal_uInt8 const *pSrc = reinterpret_cast(data.getConstArray()); + sal_uInt8 *pDst = (static_cast(aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1; sal_uInt32 nSegmentSizeInBytes = nWidth<<4; for(sal_uInt32 y=0; yLockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) + if(FAILED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) throw uno::RuntimeException(); - sal_uInt32 *pDst = (sal_uInt32 *)((((BYTE *)aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X); + sal_uInt32 *pDst = reinterpret_cast((static_cast(aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X); *pDst = aColor.GetValue(); mpSurface->UnlockRect(); } @@ -636,10 +636,10 @@ namespace dxcanvas // lock the directx surface to receive the pointer to the surface memory. D3DLOCKED_RECT aLockedRect; - if(FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) + if(FAILED(mpSurface->LockRect(&aLockedRect,nullptr,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY))) throw uno::RuntimeException(); - sal_uInt32 *pDst = (sal_uInt32 *)((((BYTE *)aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X); + sal_uInt32 *pDst = reinterpret_cast((static_cast(aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X); Gdiplus::Color aColor(*pDst); mpSurface->UnlockRect(); diff --git a/canvas/source/directx/dx_surfacebitmap.hxx b/canvas/source/directx/dx_surfacebitmap.hxx index 85c067c595ba..87d6dcbfe647 100644 --- a/canvas/source/directx/dx_surfacebitmap.hxx +++ b/canvas/source/directx/dx_surfacebitmap.hxx @@ -40,11 +40,11 @@ namespace dxcanvas bool resize( const ::basegfx::B2IVector& rSize ); void clear(); - virtual GraphicsSharedPtr getGraphics(); + virtual GraphicsSharedPtr getGraphics() override; - virtual BitmapSharedPtr getBitmap() const; - virtual ::basegfx::B2IVector getSize() const; - virtual bool hasAlpha() const; + virtual BitmapSharedPtr getBitmap() const override; + virtual ::basegfx::B2IVector getSize() const override; + virtual bool hasAlpha() const override; COMReference getSurface() const { return mpSurface; } @@ -66,21 +66,21 @@ namespace dxcanvas virtual css::uno::Sequence< sal_Int8 > getData( css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerRectangle2D& rect ); + const css::geometry::IntegerRectangle2D& rect ) override; virtual void setData( const css::uno::Sequence< sal_Int8 >& data, const css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerRectangle2D& rect ); + const css::geometry::IntegerRectangle2D& rect ) override; virtual void setPixel( const css::uno::Sequence< sal_Int8 >& color, const css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerPoint2D& pos ); + const css::geometry::IntegerPoint2D& pos ) override; virtual css::uno::Sequence< sal_Int8 > getPixel( css::rendering::IntegerBitmapLayout& bitmapLayout, - const css::geometry::IntegerPoint2D& pos ); + const css::geometry::IntegerPoint2D& pos ) override; private: void init(); diff --git a/canvas/source/directx/dx_textlayout.hxx b/canvas/source/directx/dx_textlayout.hxx index 8de490b7f9f5..0cdea204431c 100644 --- a/canvas/source/directx/dx_textlayout.hxx +++ b/canvas/source/directx/dx_textlayout.hxx @@ -54,31 +54,31 @@ namespace dxcanvas const TextLayout& operator=(const TextLayout&) = delete; /// Dispose all internal references - virtual void SAL_CALL disposing(); + virtual void SAL_CALL disposing() override; // XTextLayout - virtual css::uno::Sequence< css::uno::Reference< css::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes( ) throw (css::uno::RuntimeException); - virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryInkMeasures( ) throw (css::uno::RuntimeException); - virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures( ) throw (css::uno::RuntimeException); - virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements( ) throw (css::uno::RuntimeException); - virtual void SAL_CALL applyLogicalAdvancements( const css::uno::Sequence< double >& aAdvancements ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); - virtual css::geometry::RealRectangle2D SAL_CALL queryTextBounds( ) throw (css::uno::RuntimeException); - virtual double SAL_CALL justify( double nSize ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); - virtual double SAL_CALL combinedJustify( const css::uno::Sequence< css::uno::Reference< css::rendering::XTextLayout > >& aNextLayouts, double nSize ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); - virtual css::rendering::TextHit SAL_CALL getTextHit( const css::geometry::RealPoint2D& aHitPoint ) throw (css::uno::RuntimeException); - virtual css::rendering::Caret SAL_CALL getCaret( sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getNextInsertionIndex( sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException); - virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException); - virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException); - virtual double SAL_CALL getBaselineOffset( ) throw (css::uno::RuntimeException); - virtual sal_Int8 SAL_CALL getMainTextDirection( ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL getFont( ) throw (css::uno::RuntimeException); - virtual css::rendering::StringContext SAL_CALL getText( ) throw (css::uno::RuntimeException); + virtual css::uno::Sequence< css::uno::Reference< css::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes( ) throw (css::uno::RuntimeException) override; + virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryInkMeasures( ) throw (css::uno::RuntimeException) override; + virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures( ) throw (css::uno::RuntimeException) override; + virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements( ) throw (css::uno::RuntimeException) override; + virtual void SAL_CALL applyLogicalAdvancements( const css::uno::Sequence< double >& aAdvancements ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException) override; + virtual css::geometry::RealRectangle2D SAL_CALL queryTextBounds( ) throw (css::uno::RuntimeException) override; + virtual double SAL_CALL justify( double nSize ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException) override; + virtual double SAL_CALL combinedJustify( const css::uno::Sequence< css::uno::Reference< css::rendering::XTextLayout > >& aNextLayouts, double nSize ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException) override; + virtual css::rendering::TextHit SAL_CALL getTextHit( const css::geometry::RealPoint2D& aHitPoint ) throw (css::uno::RuntimeException) override; + virtual css::rendering::Caret SAL_CALL getCaret( sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException) override; + virtual sal_Int32 SAL_CALL getNextInsertionIndex( sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException) override; + virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException) override; + virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException) override; + virtual double SAL_CALL getBaselineOffset( ) throw (css::uno::RuntimeException) override; + virtual sal_Int8 SAL_CALL getMainTextDirection( ) throw (css::uno::RuntimeException) override; + virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL getFont( ) throw (css::uno::RuntimeException) override; + virtual css::rendering::StringContext SAL_CALL getText( ) throw (css::uno::RuntimeException) override; // XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ); - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ); + virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( css::uno::RuntimeException ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException ) override; bool draw( const GraphicsSharedPtr& rGraphics, const css::rendering::ViewState& rViewState, @@ -89,7 +89,7 @@ namespace dxcanvas bool bAlphaSurface ) const; protected: - ~TextLayout(); // we're a ref-counted UNO class. _We_ destroy ourselves. + ~TextLayout() override; // we're a ref-counted UNO class. _We_ destroy ourselves. private: // NOTE: no need for GDIPlusUserSharedPtr, mpFont implicitly has one already diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index 1e4e83b6f715..fb8e184f9cc6 100644 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -89,7 +89,7 @@ namespace dxcanvas if(rText.Length) { - sal_Bool test = mxGraphicDevice.is(); + bool test = mxGraphicDevice.is(); ENSURE_OR_THROW( test, "TextLayoutDrawHelper::drawText(): Invalid GraphicDevice" ); @@ -112,7 +112,7 @@ namespace dxcanvas aFont.SetAlignment( ALIGN_BASELINE ); aFont.SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); - aFont.SetVertical( (rFontRequest.FontDescription.IsVertical==css::util::TriState_YES) ? sal_True : sal_False ); + aFont.SetVertical( rFontRequest.FontDescription.IsVertical==css::util::TriState_YES ); aFont.SetWeight( static_cast(rFontRequest.FontDescription.FontDescription.Weight) ); aFont.SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL ); aFont.SetPitch( @@ -235,7 +235,7 @@ namespace dxcanvas // metrics when e.g. formatting for a printer! SystemGraphicsData aSystemGraphicsData; aSystemGraphicsData.nSize = sizeof(SystemGraphicsData); - aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(GetDC( NULL )); + aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(GetDC( nullptr )); ScopedVclPtrInstance xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT); // create the font @@ -247,7 +247,7 @@ namespace dxcanvas aFont.SetAlignment( ALIGN_BASELINE ); aFont.SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); - aFont.SetVertical( (rFontRequest.FontDescription.IsVertical==css::util::TriState_YES) ? sal_True : sal_False ); + aFont.SetVertical( rFontRequest.FontDescription.IsVertical==css::util::TriState_YES ); aFont.SetWeight( static_cast(rFontRequest.FontDescription.FontDescription.Weight) ); aFont.SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL ); aFont.SetPitch( diff --git a/canvas/source/directx/dx_vcltools.cxx b/canvas/source/directx/dx_vcltools.cxx index addbda659a35..6d60842a3172 100644 --- a/canvas/source/directx/dx_vcltools.cxx +++ b/canvas/source/directx/dx_vcltools.cxx @@ -54,7 +54,7 @@ namespace dxcanvas } else { - BITMAPCOREHEADER* pCoreHeader = (BITMAPCOREHEADER*)&rBIH; + BITMAPCOREHEADER const * pCoreHeader = reinterpret_cast(&rBIH); if( pCoreHeader->bcBitCount <= 8 ) return 1 << pCoreHeader->bcBitCount; @@ -70,19 +70,18 @@ namespace dxcanvas bool bRet( false ); BitmapSharedPtr pBitmap; - const BITMAPINFO* pBI = (BITMAPINFO*)GlobalLock( (HGLOBAL)hDIB ); + const BITMAPINFO* pBI = static_cast(GlobalLock( const_cast(hDIB) )); if( pBI ) { - const BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*)pBI; - const BYTE* pBits = (BYTE*) pBI + *(DWORD*)pBI + - calcDIBColorCount( *pBIH ) * sizeof( RGBQUAD ); + const BYTE* pBits = reinterpret_cast(pBI) + pBI->bmiHeader.biSize + + calcDIBColorCount( pBI->bmiHeader ) * sizeof( RGBQUAD ); // forward to outsourced GDI+ rendering method // (header clashes) - bRet = tools::drawDIBits( rGraphics, *pBI, (void*)pBits ); + bRet = tools::drawDIBits( rGraphics, *pBI, pBits ); - GlobalUnlock( (HGLOBAL)hDIB ); + GlobalUnlock( const_cast(hDIB) ); } return bRet; @@ -121,7 +120,7 @@ namespace dxcanvas aBmpSysData.pDIB ); } - rBmp.ReleaseAccess( pReadAcc ); + Bitmap::ReleaseAccess( pReadAcc ); } } else @@ -165,7 +164,7 @@ namespace dxcanvas const sal_Int32 nWidth( aBmpSize.Width() ); const sal_Int32 nHeight( aBmpSize.Height() ); - ENSURE_OR_THROW( pReadAccess.get() != NULL, + ENSURE_OR_THROW( pReadAccess.get() != nullptr, "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "Unable to acquire read access to bitmap" ); @@ -191,7 +190,7 @@ namespace dxcanvas // WinSalBitmap::AcquireBuffer() sets up the // buffer - ENSURE_OR_THROW( pAlphaReadAccess.get() != NULL, + ENSURE_OR_THROW( pAlphaReadAccess.get() != nullptr, "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "Unable to acquire read access to alpha" ); @@ -331,7 +330,7 @@ namespace dxcanvas // WinSalBitmap::AcquireBuffer() sets up the // buffer - ENSURE_OR_THROW( pMaskReadAccess.get() != NULL, + ENSURE_OR_THROW( pMaskReadAccess.get() != nullptr, "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "Unable to acquire read access to mask" ); diff --git a/canvas/source/directx/dx_winstuff.hxx b/canvas/source/directx/dx_winstuff.hxx index 88929f41f53b..cb1840d4d42b 100644 --- a/canvas/source/directx/dx_winstuff.hxx +++ b/canvas/source/directx/dx_winstuff.hxx @@ -83,7 +83,7 @@ namespace dxcanvas typedef T Wrappee; COMReference() : - mp( NULL ) + mp( nullptr ) { } @@ -109,9 +109,9 @@ namespace dxcanvas } COMReference( const COMReference& rNew ) : - mp( NULL ) + mp( nullptr ) { - if( rNew.mp == NULL ) + if( rNew.mp == nullptr ) return; rNew.mp->AddRef(); // do that _before_ assigning the @@ -138,11 +138,11 @@ namespace dxcanvas if( mp ) refcount = mp->Release(); - mp = NULL; + mp = nullptr; return refcount; } - bool is() const { return mp != NULL; } + bool is() const { return mp != nullptr; } T* get() const { return mp; } T* operator->() const { return mp; } T& operator*() const { return *mp; } -- cgit