summaryrefslogtreecommitdiff
path: root/vcl/opengl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-10 10:28:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-10 10:32:00 +0100
commitd3b6cb7ec2da4afb5687c9d28b2be2f96e6aa7b1 (patch)
treee9d209d6d5f06cacd8e0df78c7f6b8ad45d74be5 /vcl/opengl
parent45979047abbd9da7a29401f298e8ef9ab58ad337 (diff)
loplugin:nullptr (automatic rewrite)
Change-Id: I05e89f9896170d4df3d1377549ea074f06b884a0
Diffstat (limited to 'vcl/opengl')
-rw-r--r--vcl/opengl/framebuffer.cxx4
-rw-r--r--vcl/opengl/gdiimpl.cxx20
-rw-r--r--vcl/opengl/salbmp.cxx24
-rw-r--r--vcl/opengl/scale.cxx8
-rw-r--r--vcl/opengl/texture.cxx12
-rw-r--r--vcl/opengl/x11/X11DeviceInfo.cxx8
-rw-r--r--vcl/opengl/x11/gdiimpl.cxx12
-rw-r--r--vcl/opengl/x11/salvd.cxx6
8 files changed, 47 insertions, 47 deletions
diff --git a/vcl/opengl/framebuffer.cxx b/vcl/opengl/framebuffer.cxx
index 403c37922695..0c2cca920ed9 100644
--- a/vcl/opengl/framebuffer.cxx
+++ b/vcl/opengl/framebuffer.cxx
@@ -18,8 +18,8 @@ OpenGLFramebuffer::OpenGLFramebuffer() :
mnWidth( 0 ),
mnHeight( 0 ),
mnAttachedTexture( 0 ),
- mpPrevFramebuffer( NULL ),
- mpNextFramebuffer( NULL )
+ mpPrevFramebuffer( nullptr ),
+ mpNextFramebuffer( nullptr )
{
glGenFramebuffers( 1, &mnId );
VCL_GL_INFO( "vcl.opengl", "Created framebuffer " << (int)mnId );
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 83352eca7961..51dbc5ae8b56 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -38,11 +38,11 @@
#include <vector>
OpenGLSalGraphicsImpl::OpenGLSalGraphicsImpl(SalGraphics& rParent, SalGeometryProvider *pProvider)
- : mpContext(0)
+ : mpContext(nullptr)
, mrParent(rParent)
, mpProvider(pProvider)
- , mpFramebuffer(NULL)
- , mpProgram(NULL)
+ , mpFramebuffer(nullptr)
+ , mpProgram(nullptr)
, mbUseScissor(false)
, mbUseStencil(false)
, mbOffscreen(false)
@@ -64,7 +64,7 @@ OpenGLSalGraphicsImpl::~OpenGLSalGraphicsImpl()
rtl::Reference<OpenGLContext> OpenGLSalGraphicsImpl::GetOpenGLContext()
{
if( !AcquireContext() )
- return NULL;
+ return nullptr;
return mpContext;
}
@@ -193,7 +193,7 @@ void OpenGLSalGraphicsImpl::PostDraw()
if( mpProgram )
{
mpProgram->Clean();
- mpProgram = NULL;
+ mpProgram = nullptr;
#ifdef DBG_UTIL
mProgramIsSolidColor = false;
#endif
@@ -392,13 +392,13 @@ bool OpenGLSalGraphicsImpl::CheckOffscreenTexture()
bool OpenGLSalGraphicsImpl::UseProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble )
{
- if( mpProgram != NULL )
+ if( mpProgram != nullptr )
mpProgram->Clean();
mpProgram = mpContext->UseProgram( rVertexShader, rFragmentShader, preamble );
#ifdef DBG_UTIL
mProgramIsSolidColor = false; // UseSolid() will set to true if needed
#endif
- return ( mpProgram != NULL );
+ return ( mpProgram != nullptr );
}
bool OpenGLSalGraphicsImpl::UseSolid( SalColor nColor, sal_uInt8 nTransparency )
@@ -1601,7 +1601,7 @@ SalBitmap* OpenGLSalGraphicsImpl::getBitmap( long nX, long nY, long nWidth, long
if( !pBitmap->Create( maOffscreenTex, nX, nY, nWidth, nHeight ) )
{
delete pBitmap;
- pBitmap = NULL;
+ pBitmap = nullptr;
}
PostDraw();
return pBitmap;
@@ -1758,7 +1758,7 @@ bool OpenGLSalGraphicsImpl::drawTransformedBitmap(
OpenGLTexture& rTexture( rBitmap.GetTexture() );
OpenGLTexture aMask; // no texture
- if( pMaskBitmap != NULL )
+ if( pMaskBitmap != nullptr )
aMask = pMaskBitmap->GetTexture();
VCL_GL_INFO( "vcl.opengl", "::drawTransformedBitmap" );
@@ -1865,7 +1865,7 @@ bool OpenGLSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPoly,
OpenGLContext *OpenGLSalGraphicsImpl::beginPaint()
{
if( mbOffscreen || !AcquireContext() )
- return NULL;
+ return nullptr;
else
return mpContext.get();
}
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 14250b7b01a8..7cda1eea7eb0 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -64,7 +64,7 @@ static std::vector<std::unique_ptr<FixedTextureAtlasManager>> sTextureAtlases;
}
OpenGLSalBitmap::OpenGLSalBitmap()
-: mpContext(NULL)
+: mpContext(nullptr)
, mbDirtyTexture(true)
, mnBits(0)
, mnBytesPerRow(0)
@@ -225,7 +225,7 @@ bool OpenGLSalBitmap::AllocateUserData()
if (!alloc)
{
SAL_WARN("vcl.opengl", "bad alloc " << mnBytesPerRow << "x" << mnHeight);
- maUserBuffer.reset( static_cast<sal_uInt8*>(NULL) );
+ maUserBuffer.reset( static_cast<sal_uInt8*>(nullptr) );
mnBytesPerRow = 0;
}
#ifdef DBG_UTIL
@@ -236,7 +236,7 @@ bool OpenGLSalBitmap::AllocateUserData()
}
#endif
- return maUserBuffer.get() != 0;
+ return maUserBuffer.get() != nullptr;
}
namespace {
@@ -335,7 +335,7 @@ ImplPixelFormat* ImplPixelFormat::GetFormat( sal_uInt16 nBits, const BitmapPalet
case 8: return new ImplPixelFormat8( rPalette );
}
- return 0;
+ return nullptr;
}
void lclInstantiateTexture(OpenGLTexture& rTexture, const int nWidth, const int nHeight,
@@ -394,10 +394,10 @@ GLuint OpenGLSalBitmap::CreateTexture()
VCL_GL_INFO( "vcl.opengl", "::CreateTexture bits: " << mnBits);
GLenum nFormat = GL_RGBA;
GLenum nType = GL_UNSIGNED_BYTE;
- sal_uInt8* pData( NULL );
+ sal_uInt8* pData( nullptr );
bool bAllocated( false );
- if( maUserBuffer.get() != 0 )
+ if( maUserBuffer.get() != nullptr )
{
if( mnBits == 16 || mnBits == 24 || mnBits == 32 )
{
@@ -481,7 +481,7 @@ bool OpenGLSalBitmap::ReadTexture()
VCL_GL_INFO( "vcl.opengl", "::ReadTexture " << mnWidth << "x" << mnHeight << " bits: " << mnBits);
- if( pData == NULL )
+ if( pData == nullptr )
return false;
if (mnBits == 8 || mnBits == 16 || mnBits == 24 || mnBits == 32)
@@ -578,7 +578,7 @@ bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType&
int nHeight = rInputTexture.GetHeight();
OpenGLProgram* pProgram = mpContext->UseProgram("textureVertexShader", FragShader);
- if (pProgram == 0)
+ if (pProgram == nullptr)
return false;
int nNewWidth = ceil( nWidth / 4.0 );
@@ -606,7 +606,7 @@ bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType&
nHeight = aFirstPassTexture.GetHeight();
pProgram = mpContext->UseProgram("textureVertexShader", FragShader);
- if (pProgram == 0)
+ if (pProgram == nullptr)
return false;
nNewWidth = ceil( nWidth / 4.0 );
@@ -694,16 +694,16 @@ BitmapBuffer* OpenGLSalBitmap::AcquireBuffer( BitmapAccessMode nMode )
if( !maUserBuffer.get() )
{
if( !AllocateUserData() )
- return NULL;
+ return nullptr;
if( maTexture && !ReadTexture() )
- return NULL;
+ return nullptr;
}
if( !maPendingOps.empty() )
{
VCL_GL_INFO( "vcl.opengl", "** Creating texture and reading it back immediately" );
if( !CreateTexture() || !AllocateUserData() || !ReadTexture() )
- return NULL;
+ return nullptr;
}
}
diff --git a/vcl/opengl/scale.cxx b/vcl/opengl/scale.cxx
index 2953e0eb0136..24c137df565f 100644
--- a/vcl/opengl/scale.cxx
+++ b/vcl/opengl/scale.cxx
@@ -134,7 +134,7 @@ bool OpenGLSalBitmap::ImplScaleConvolution(
{
OpenGLFramebuffer* pFramebuffer;
OpenGLProgram* pProgram;
- GLfloat* pWeights( 0 );
+ GLfloat* pWeights( nullptr );
sal_uInt32 nKernelSize;
GLfloat aOffsets[32];
int nNewWidth( mnWidth * rScaleX );
@@ -144,7 +144,7 @@ bool OpenGLSalBitmap::ImplScaleConvolution(
pProgram = mpContext->UseProgram( "textureVertexShader",
"convolutionFragmentShader" );
- if( pProgram == 0 )
+ if( pProgram == nullptr )
return false;
// horizontal scaling in scratch texture
@@ -231,7 +231,7 @@ bool OpenGLSalBitmap::ImplScaleArea( double rScaleX, double rScaleY )
OpenGLProgram* pProgram = mpContext->UseProgram( "textureVertexShader",
fast ? OUString( "areaScaleFastFragmentShader" ) : OUString( "areaScaleFragmentShader" ));
- if( pProgram == 0 )
+ if( pProgram == nullptr )
return false;
OpenGLTexture aScratchTex(nNewWidth, nNewHeight);
@@ -351,7 +351,7 @@ bool OpenGLSalBitmap::Scale( const double& rScaleX, const double& rScaleY, BmpSc
nScaleFlag == BmpScaleFlag::BestQuality )
{
makeCurrent();
- if( mpContext == NULL )
+ if( mpContext == nullptr )
{
VCL_GL_INFO( "vcl.opengl", "Add ScaleOp to pending operations" );
maPendingOps.push_back( new ScaleOp( this, rScaleX, rScaleY, nScaleFlag ) );
diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index c0373cc46a5a..909532682b7e 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -44,7 +44,7 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int nHeight, bool bAllocate )
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
if( bAllocate )
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
+ glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr );
glBindTexture( GL_TEXTURE_2D, 0 );
VCL_GL_INFO( "vcl.opengl", "OpenGLTexture " << mnTexture << " " << nWidth << "x" << nHeight << " allocate" );
@@ -165,7 +165,7 @@ int ImplOpenGLTexture::FindFreeSlot()
OpenGLTexture::OpenGLTexture() :
maRect( 0, 0, 0, 0 ),
- mpImpl(NULL),
+ mpImpl(nullptr),
mnSlotNumber(-1)
{
}
@@ -234,7 +234,7 @@ OpenGLTexture::~OpenGLTexture()
bool OpenGLTexture::IsUnique() const
{
- return ( mpImpl == NULL || mpImpl->mnRefCount == 1 );
+ return ( mpImpl == nullptr || mpImpl->mnRefCount == 1 );
}
GLuint OpenGLTexture::Id() const
@@ -258,7 +258,7 @@ void OpenGLTexture::GetCoord( GLfloat* pCoord, const SalTwoRect& rPosAry, bool b
{
VCL_GL_INFO( "vcl.opengl", "Getting coord " << Id() << " [" << maRect.Left() << "," << maRect.Top() << "] " << GetWidth() << "x" << GetHeight() );
- if( mpImpl == NULL )
+ if( mpImpl == nullptr )
{
pCoord[0] = pCoord[1] = pCoord[2] = pCoord[3] = 0.0f;
pCoord[4] = pCoord[5] = pCoord[6] = pCoord[7] = 0.0f;
@@ -355,7 +355,7 @@ void OpenGLTexture::SaveToFile(const OUString& rFileName)
void OpenGLTexture::Read( GLenum nFormat, GLenum nType, sal_uInt8* pData )
{
- if( mpImpl == NULL )
+ if( mpImpl == nullptr )
{
SAL_WARN( "vcl.opengl", "Can't read invalid texture" );
return;
@@ -392,7 +392,7 @@ void OpenGLTexture::Read( GLenum nFormat, GLenum nType, sal_uInt8* pData )
OpenGLTexture::operator bool() const
{
- return ( mpImpl != NULL );
+ return ( mpImpl != nullptr );
}
OpenGLTexture& OpenGLTexture::operator=( const OpenGLTexture& rTexture )
diff --git a/vcl/opengl/x11/X11DeviceInfo.cxx b/vcl/opengl/x11/X11DeviceInfo.cxx
index f60f9c18106c..e9754eab67d1 100644
--- a/vcl/opengl/x11/X11DeviceInfo.cxx
+++ b/vcl/opengl/x11/X11DeviceInfo.cxx
@@ -215,7 +215,7 @@ void X11OpenGLDeviceInfo::GetData()
}
// determine the major OpenGL version. That's the first integer in the version string.
- mnGLMajorVersion = strtol(maVersion.getStr(), 0, 10);
+ mnGLMajorVersion = strtol(maVersion.getStr(), nullptr, 10);
// determine driver type (vendor) and where in the version string
// the actual driver version numbers should be expected to be found (whereToReadVersionNumbers)
@@ -267,14 +267,14 @@ void X11OpenGLDeviceInfo::GetData()
char *token = strtok_wrapper(".", &bufptr);
if (token)
{
- mnMajorVersion = strtol(token, 0, 10);
+ mnMajorVersion = strtol(token, nullptr, 10);
token = strtok_wrapper(".", &bufptr);
if (token)
{
- mnMinorVersion = strtol(token, 0, 10);
+ mnMinorVersion = strtol(token, nullptr, 10);
token = strtok_wrapper(".", &bufptr);
if (token)
- mnRevisionVersion = strtol(token, 0, 10);
+ mnRevisionVersion = strtol(token, nullptr, 10);
}
}
}
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index fa47b271aec4..20c45ffe108b 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -49,7 +49,7 @@ rtl::Reference<OpenGLContext> X11OpenGLSalGraphicsImpl::CreateWinContext()
X11WindowProvider *pProvider = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame);
if( !pProvider )
- return NULL;
+ return nullptr;
Window aWin = pProvider->GetX11Window();
rtl::Reference<OpenGLContext> pContext = OpenGLContext::Create();
@@ -102,7 +102,7 @@ bool X11OpenGLSalGraphicsImpl::FillPixmapFromScreen( X11Pixmap* pPixmap, int nX,
pImage = XCreateImage( pDisplay, aVisualInfo.visual, 24, ZPixmap, 0, pData,
pPixmap->GetWidth(), pPixmap->GetHeight(), 8, 0 );
XInitImage( pImage );
- GC aGC = XCreateGC( pDisplay, pPixmap->GetPixmap(), 0, NULL );
+ GC aGC = XCreateGC( pDisplay, pPixmap->GetPixmap(), 0, nullptr );
XPutImage( pDisplay, pPixmap->GetDrawable(), aGC, pImage,
0, 0, 0, 0, pPixmap->GetWidth(), pPixmap->GetHeight() );
XFreeGC( pDisplay, aGC );
@@ -140,7 +140,7 @@ bool X11OpenGLSalGraphicsImpl::RenderPixmap(X11Pixmap* pPixmap, X11Pixmap* pMask
GLXFBConfig pFbConfig = OpenGLHelper::GetPixmapFBConfig( pDisplay, bInverted );
GLXPixmap pGlxPixmap = glXCreatePixmap( pDisplay, pFbConfig, pPixmap->GetPixmap(), aAttribs);
GLXPixmap pGlxMask;
- if( pMask != NULL )
+ if( pMask != nullptr )
pGlxMask = glXCreatePixmap( pDisplay, pFbConfig, pMask->GetPixmap(), aAttribs);
else
pGlxMask = 0;
@@ -155,14 +155,14 @@ bool X11OpenGLSalGraphicsImpl::RenderPixmap(X11Pixmap* pPixmap, X11Pixmap* pMask
glActiveTexture( GL_TEXTURE0 );
rCombo.mpTexture->Bind();
- glXBindTexImageEXT( pDisplay, pGlxPixmap, GLX_FRONT_LEFT_EXT, NULL );
+ glXBindTexImageEXT( pDisplay, pGlxPixmap, GLX_FRONT_LEFT_EXT, nullptr );
rCombo.mpTexture->Unbind();
- if( pMask != NULL && pGlxMask )
+ if( pMask != nullptr && pGlxMask )
{
rCombo.mpMask.reset(new OpenGLTexture(pPixmap->GetWidth(), pPixmap->GetHeight(), false));
rCombo.mpMask->Bind();
- glXBindTexImageEXT( pDisplay, pGlxMask, GLX_FRONT_LEFT_EXT, NULL );
+ glXBindTexImageEXT( pDisplay, pGlxMask, GLX_FRONT_LEFT_EXT, nullptr );
rCombo.mpMask->Unbind();
DrawTextureDiff(*rCombo.mpTexture, *rCombo.mpMask, aPosAry, bInverted);
diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx
index 99abcddfdaab..9c8c20e02f0e 100644
--- a/vcl/opengl/x11/salvd.cxx
+++ b/vcl/opengl/x11/salvd.cxx
@@ -25,7 +25,7 @@ void X11SalGraphics::Init( X11OpenGLSalVirtualDevice *pDevice )
m_pColormap = &pDisplay->GetColormap( m_nXScreen );
m_pVDev = pDevice;
- m_pFrame = NULL;
+ m_pFrame = nullptr;
bWindow_ = pDisplay->IsDisplay();
bVirDev_ = true;
@@ -48,7 +48,7 @@ X11OpenGLSalVirtualDevice::X11OpenGLSalVirtualDevice( SalGraphics* pGraphics,
nBitCount = pGraphics->GetBitCount();
// TODO Check where a VirtualDevice is created from SystemGraphicsData
- assert( pData == NULL ); (void)pData;
+ assert( pData == nullptr ); (void)pData;
mpDisplay = vcl_sal::getSalDisplay(GetGenericData());
mnDepth = nBitCount;
@@ -67,7 +67,7 @@ X11OpenGLSalVirtualDevice::~X11OpenGLSalVirtualDevice()
SalGraphics* X11OpenGLSalVirtualDevice::AcquireGraphics()
{
if( mbGraphics )
- return NULL;
+ return nullptr;
if( mpGraphics )
mbGraphics = true;