Kaydet (Commit) 29eb4f12 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

clang-cl loplugin: canvas

Change-Id: I3e4f9ccbe608a98759f2a9e312839eb909e6b575
Reviewed-on: https://gerrit.libreoffice.org/29878Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 347f67dd
......@@ -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<sal_Int8 *>(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
......
......@@ -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
......
......@@ -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*/,
......
......@@ -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<OutputDevice*>(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<OutputDevice*>(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<HBITMAP>(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 );
......
......@@ -84,7 +84,7 @@ namespace dxcanvas
{
// sorry, no BitmapEx here...
case 0:
aRes = css::uno::Any( reinterpret_cast<sal_Int64>( (BitmapEx*) NULL ) );
aRes = css::uno::Any( reinterpret_cast<sal_Int64>( 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<PBITMAPINFO>(&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<sal_uInt8[]> pAlphaBits( new sal_uInt8[nScanWidth*aSize.getY()] );
const sal_uInt8* pInBits=(sal_uInt8*)aBmpData.Scan0;
const sal_uInt8* pInBits=static_cast<sal_uInt8*>(aBmpData.Scan0);
pInBits+=3;
for( sal_Int32 y=0; y<aSize.getY(); ++y )
{
......@@ -225,7 +225,7 @@ namespace dxcanvas
// set bits to newly create HBITMAP
SetDIBits( hScreenDC, hBmpBitmap, 0,
aSize.getY(), pAlphaBits.get(),
(PBITMAPINFO)&aDIB, DIB_RGB_COLORS );
reinterpret_cast<PBITMAPINFO>(&aDIB), DIB_RGB_COLORS );
uno::Sequence< uno::Any > args(1);
args[0] = uno::Any( sal_Int64(hBmpBitmap) );
......
......@@ -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<LPCWSTR>(&pStrBuf[0]),NULL) );
mpFontFamily.reset( new Gdiplus::FontFamily(reinterpret_cast<LPCWSTR>(&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<Gdiplus::REAL>(rFontRequest.CellSize),
......
......@@ -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;
......
......@@ -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()
......
......@@ -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,
......
......@@ -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);
}
}
......
......@@ -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;
......
......@@ -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()
......
......@@ -64,7 +64,7 @@ namespace dxcanvas
Gdiplus::GdiplusStartup( &a_GdiPlusToken,
&gdiPlusStartupInput,
NULL );
nullptr );
}
++n_gdiPlusUsageCount;
......
......@@ -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<nPoints; ++nCurrPoint )
......@@ -298,11 +298,6 @@ namespace dxcanvas
}
}
Gdiplus::PointF gdiPlusPointFromRealPoint2D( const css::geometry::RealPoint2D& rPoint )
{
return implGdiPlusPointFromRealPoint2D( rPoint );
}
Gdiplus::Rect gdiPlusRectFromIntegerRectangle2D( const geometry::IntegerRectangle2D& rRect )
{
return Gdiplus::Rect( rRect.X1,
......@@ -353,20 +348,7 @@ namespace dxcanvas
rRect.Y + rRect.Height );
}
uno::Sequence< double > 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<void*>(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
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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();
......
......@@ -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
......
......@@ -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; }
......
......@@ -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() );
......
......@@ -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;
......
......@@ -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<sal_uInt8 *>(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<sal_uInt8*>(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<BYTE *>(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<BYTE *>(aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1;
sal_uInt8 *pDst = reinterpret_cast<sal_uInt8 *>(aRes.getArray());
sal_uInt32 nSegmentSizeInBytes = nWidth*4;
for(sal_uInt32 y=0; y<nHeight; ++y)
{
......@@ -474,7 +474,7 @@ namespace dxcanvas
if(rBitmapLayout.ColorSpace->getComponentTags().getArray()[0] == rendering::ColorComponentTag::RGB_RED &&
rBitmapLayout.ColorSpace->getComponentTags().getArray()[2] == rendering::ColorComponentTag::RGB_BLUE)
{
pDst = (sal_uInt8 *)aRes.getArray();
pDst = reinterpret_cast<sal_uInt8 *>(aRes.getArray());
for(sal_uInt32 y=0; y<nHeight; ++y)
{
sal_uInt8* pPixel = pDst;
......@@ -511,7 +511,7 @@ 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<sal_Int8 *>(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<sal_uInt8 const *>(data.getConstArray());
sal_uInt8 *pDst = (static_cast<BYTE *>(aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1;
sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
for(sal_uInt32 y=0; y<nHeight; ++y)
{
......@@ -593,10 +593,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<sal_uInt32 *>((static_cast<BYTE *>(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<sal_uInt32 *>((static_cast<BYTE *>(aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X);
Gdiplus::Color aColor(*pDst);
mpSurface->UnlockRect();
......
......@@ -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<surface_type> 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();
......
......@@ -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
......
......@@ -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<FontWeight>(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<VirtualDevice> 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<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
aFont.SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL );
aFont.SetPitch(
......
......@@ -54,7 +54,7 @@ namespace dxcanvas
}
else
{
BITMAPCOREHEADER* pCoreHeader = (BITMAPCOREHEADER*)&rBIH;
BITMAPCOREHEADER const * pCoreHeader = reinterpret_cast<BITMAPCOREHEADER const *>(&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<BITMAPINFO*>(GlobalLock( const_cast<void *>(hDIB) ));
if( pBI )
{
const BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*)pBI;
const BYTE* pBits = (BYTE*) pBI + *(DWORD*)pBI +
calcDIBColorCount( *pBIH ) * sizeof( RGBQUAD );
const BYTE* pBits = reinterpret_cast<BYTE const *>(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<void *>(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" );
......
......@@ -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; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment