[SurfaceFlinger] Replace NULL with nullptr.
Test: make
Change-Id: Ia0ecb3160cd5fddf22fb7100c1759d62e723d0b7
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index 5f70ab5..d860f58 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -105,7 +105,8 @@
bool BufferLayer::isVisible() const {
return !(isHiddenByPolicy()) && getAlpha() > 0.0f &&
- (getBE().compositionInfo.mBuffer != NULL || getBE().compositionInfo.hwc.sidebandStream != NULL);
+ (getBE().compositionInfo.mBuffer != nullptr ||
+ getBE().compositionInfo.hwc.sidebandStream != nullptr);
}
bool BufferLayer::isFixedSize() const {
@@ -377,7 +378,7 @@
mSidebandStream = mConsumer->getSidebandStream();
// replicated in LayerBE until FE/BE is ready to be synchronized
getBE().compositionInfo.hwc.sidebandStream = mSidebandStream;
- if (getBE().compositionInfo.hwc.sidebandStream != NULL) {
+ if (getBE().compositionInfo.hwc.sidebandStream != nullptr) {
setTransactionFlags(eTransactionNeeded);
mFlinger->setTransactionFlags(eTraversalNeeded);
}
@@ -492,7 +493,7 @@
mConsumer->getCurrentBuffer(&getBE().compositionInfo.mBufferSlot);
// replicated in LayerBE until FE/BE is ready to be synchronized
mActiveBuffer = getBE().compositionInfo.mBuffer;
- if (getBE().compositionInfo.mBuffer == NULL) {
+ if (getBE().compositionInfo.mBuffer == nullptr) {
// this can only happen if the very first buffer was rejected.
return outDirtyRegion;
}
@@ -508,7 +509,7 @@
mRefreshPending = true;
mFrameLatencyNeeded = true;
- if (oldBuffer == NULL) {
+ if (oldBuffer == nullptr) {
// the first time we receive a buffer, we need to trigger a
// geometry invalidation.
recomputeVisibleRegions = true;
@@ -528,7 +529,7 @@
recomputeVisibleRegions = true;
}
- if (oldBuffer != NULL) {
+ if (oldBuffer != nullptr) {
uint32_t bufWidth = getBE().compositionInfo.mBuffer->getWidth();
uint32_t bufHeight = getBE().compositionInfo.mBuffer->getHeight();
if (bufWidth != uint32_t(oldBuffer->width) ||
diff --git a/services/surfaceflinger/BufferLayerConsumer.cpp b/services/surfaceflinger/BufferLayerConsumer.cpp
index bf61236..8f5c9c7 100644
--- a/services/surfaceflinger/BufferLayerConsumer.cpp
+++ b/services/surfaceflinger/BufferLayerConsumer.cpp
@@ -271,7 +271,7 @@
// If item->mGraphicBuffer is not null, this buffer has not been acquired
// before, so any prior EglImage created is using a stale buffer. This
// replaces any old EglImage with a new one (using the new buffer).
- if (item->mGraphicBuffer != NULL) {
+ if (item->mGraphicBuffer != nullptr) {
mImages[item->mSlot] = new Image(item->mGraphicBuffer, mRE);
}
@@ -306,8 +306,8 @@
}
BLC_LOGV("updateAndRelease: (slot=%d buf=%p) -> (slot=%d buf=%p)", mCurrentTexture,
- mCurrentTextureImage != NULL ? mCurrentTextureImage->graphicBufferHandle() : 0, slot,
- mSlots[slot].mGraphicBuffer->handle);
+ mCurrentTextureImage != nullptr ? mCurrentTextureImage->graphicBufferHandle() : 0,
+ slot, mSlots[slot].mGraphicBuffer->handle);
// Hang onto the pointer so that it isn't freed in the call to
// releaseBufferLocked() if we're in shared buffer mode and both buffers are
@@ -355,7 +355,7 @@
status_t BufferLayerConsumer::bindTextureImageLocked() {
mRE.checkErrors();
- if (mCurrentTexture == BufferQueue::INVALID_BUFFER_SLOT && mCurrentTextureImage == NULL) {
+ if (mCurrentTexture == BufferQueue::INVALID_BUFFER_SLOT && mCurrentTextureImage == nullptr) {
BLC_LOGE("bindTextureImage: no currently-bound texture");
mRE.bindExternalTextureImage(mTexName, RE::Image(mRE));
return NO_INIT;
@@ -414,11 +414,11 @@
bool needsRecompute = mFilteringEnabled != enabled;
mFilteringEnabled = enabled;
- if (needsRecompute && mCurrentTextureImage == NULL) {
- BLC_LOGD("setFilteringEnabled called with mCurrentTextureImage == NULL");
+ if (needsRecompute && mCurrentTextureImage == nullptr) {
+ BLC_LOGD("setFilteringEnabled called with mCurrentTextureImage == nullptr");
}
- if (needsRecompute && mCurrentTextureImage != NULL) {
+ if (needsRecompute && mCurrentTextureImage != nullptr) {
computeCurrentTransformMatrixLocked();
}
}
@@ -429,7 +429,7 @@
(mCurrentTextureImage == nullptr) ? nullptr : mCurrentTextureImage->graphicBuffer();
if (buf == nullptr) {
BLC_LOGD("computeCurrentTransformMatrixLocked: "
- "mCurrentTextureImage is NULL");
+ "mCurrentTextureImage is nullptr");
}
const Rect& cropRect = canUseImageCrop(mCurrentCrop) ? Rect::EMPTY_RECT : mCurrentCrop;
GLConsumer::computeTransformMatrix(mCurrentTransformMatrix, buf, cropRect, mCurrentTransform,
@@ -476,7 +476,7 @@
*outSlot = mCurrentTexture;
}
- return (mCurrentTextureImage == nullptr) ? NULL : mCurrentTextureImage->graphicBuffer();
+ return (mCurrentTextureImage == nullptr) ? nullptr : mCurrentTextureImage->graphicBuffer();
}
Rect BufferLayerConsumer::getCurrentCrop() const {
@@ -564,7 +564,7 @@
listener = mContentsChangedListener.promote();
}
- if (listener != NULL) {
+ if (listener != nullptr) {
listener->onSidebandStreamChanged();
}
}
diff --git a/services/surfaceflinger/BufferLayerConsumer.h b/services/surfaceflinger/BufferLayerConsumer.h
index 51c2b41..f473390 100644
--- a/services/surfaceflinger/BufferLayerConsumer.h
+++ b/services/surfaceflinger/BufferLayerConsumer.h
@@ -228,7 +228,7 @@
const sp<GraphicBuffer>& graphicBuffer() { return mGraphicBuffer; }
const native_handle* graphicBufferHandle() {
- return mGraphicBuffer == NULL ? NULL : mGraphicBuffer->handle;
+ return mGraphicBuffer == nullptr ? nullptr : mGraphicBuffer->handle;
}
const RE::Image& image() const { return mImage; }
@@ -265,7 +265,7 @@
// computeCurrentTransformMatrixLocked computes the transform matrix for the
// current texture. It uses mCurrentTransform and the current GraphicBuffer
// to compute this matrix and stores it in mCurrentTransformMatrix.
- // mCurrentTextureImage must not be NULL.
+ // mCurrentTextureImage must not be nullptr.
void computeCurrentTransformMatrixLocked();
// doFenceWaitLocked inserts a wait command into the RenderEngine command
diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp
index ea6541a..a69940a 100644
--- a/services/surfaceflinger/Client.cpp
+++ b/services/surfaceflinger/Client.cpp
@@ -206,7 +206,7 @@
status_t Client::clearLayerFrameStats(const sp<IBinder>& handle) const {
sp<Layer> layer = getLayerUser(handle);
- if (layer == NULL) {
+ if (layer == nullptr) {
return NAME_NOT_FOUND;
}
layer->clearFrameStats();
@@ -215,7 +215,7 @@
status_t Client::getLayerFrameStats(const sp<IBinder>& handle, FrameStats* outStats) const {
sp<Layer> layer = getLayerUser(handle);
- if (layer == NULL) {
+ if (layer == nullptr) {
return NAME_NOT_FOUND;
}
layer->getFrameStats(outStats);
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 2753f11..9772f9a 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -160,7 +160,7 @@
}
bool DisplayDevice::isValid() const {
- return mFlinger != NULL;
+ return mFlinger != nullptr;
}
int DisplayDevice::getWidth() const {
diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
index 4186b7a..eaa5455 100644
--- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
+++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
@@ -80,7 +80,7 @@
// on/off.
android_dataspace mDataSpace;
- // mCurrentBuffer is the current buffer or NULL to indicate that there is
+ // mCurrentBuffer is the current buffer or nullptr to indicate that there is
// no current buffer.
sp<GraphicBuffer> mCurrentBuffer;
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.h b/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.h
index 4bc63bb..fe7944f 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.h
@@ -190,7 +190,7 @@
virtual status_t setLayer(size_t index) = 0;
virtual HWCLayer* dup() = 0;
static HWCLayer* copy(HWCLayer *rhs) {
- return rhs ? rhs->dup() : NULL;
+ return rhs ? rhs->dup() : nullptr;
}
protected:
virtual ~HWCLayer() { }
@@ -205,7 +205,7 @@
HWCLayer* const mLayerList;
size_t mIndex;
- LayerListIterator() : mLayerList(NULL), mIndex(0) { }
+ LayerListIterator() : mLayerList(nullptr), mIndex(0) { }
LayerListIterator(HWCLayer* layer, size_t index)
: mLayerList(layer), mIndex(index) { }
@@ -371,8 +371,8 @@
sp<SurfaceFlinger> mFlinger;
framebuffer_device_t* mFbDev;
struct hwc_composer_device_1* mHwc;
- // invariant: mLists[0] != NULL iff mHwc != NULL
- // mLists[i>0] can be NULL. that display is to be ignored
+ // invariant: mLists[0] != nullptr iff mHwc != nullptr
+ // mLists[i>0] can be nullptr. that display is to be ignored
struct hwc_display_contents_1* mLists[MAX_HWC_DISPLAYS];
DisplayData mDisplayData[MAX_HWC_DISPLAYS];
// protect mDisplayData from races between prepare and dump
diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
index cde96e4..3480b24 100644
--- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
+++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
@@ -108,7 +108,7 @@
mConsumer->setDefaultBufferSize(sinkWidth, sinkHeight);
sink->setAsyncMode(true);
IGraphicBufferProducer::QueueBufferOutput output;
- mSource[SOURCE_SCRATCH]->connect(NULL, NATIVE_WINDOW_API_EGL, false, &output);
+ mSource[SOURCE_SCRATCH]->connect(nullptr, NATIVE_WINDOW_API_EGL, false, &output);
}
VirtualDisplaySurface::~VirtualDisplaySurface() {
@@ -203,7 +203,7 @@
}
sp<GraphicBuffer> fbBuffer = mFbProducerSlot >= 0 ?
- mProducerBuffers[mFbProducerSlot] : sp<GraphicBuffer>(NULL);
+ mProducerBuffers[mFbProducerSlot] : sp<GraphicBuffer>(nullptr);
sp<GraphicBuffer> outBuffer = mProducerBuffers[mOutputProducerSlot];
VDS_LOGV("advanceFrame: fb=%d(%p) out=%d(%p)",
mFbProducerSlot, fbBuffer.get(),
@@ -214,7 +214,7 @@
mHwc.setOutputBuffer(mDisplayId, mOutputFence, outBuffer);
status_t result = NO_ERROR;
- if (fbBuffer != NULL) {
+ if (fbBuffer != nullptr) {
uint32_t hwcSlot = 0;
sp<GraphicBuffer> hwcBuffer;
mHwcBufferCache.getHwcBuffer(mFbProducerSlot, fbBuffer,
diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp
index a1a0420..5c0e3b3 100644
--- a/services/surfaceflinger/EventThread.cpp
+++ b/services/surfaceflinger/EventThread.cpp
@@ -216,7 +216,7 @@
size_t count = mDisplayEventConnections.size();
for (size_t i=0 ; i<count ; ) {
sp<Connection> connection(mDisplayEventConnections[i].promote());
- if (connection != NULL) {
+ if (connection != nullptr) {
bool added = false;
if (connection->count >= 0) {
// we need vsync events because at least
@@ -346,7 +346,7 @@
sp<Connection> connection =
mDisplayEventConnections.itemAt(i).promote();
result.appendFormat(" %p: count=%d\n",
- connection.get(), connection!=NULL ? connection->count : 0);
+ connection.get(), connection != nullptr ? connection->count : 0);
}
}
diff --git a/services/surfaceflinger/FrameTracker.cpp b/services/surfaceflinger/FrameTracker.cpp
index 99c4daa..1539873 100644
--- a/services/surfaceflinger/FrameTracker.cpp
+++ b/services/surfaceflinger/FrameTracker.cpp
@@ -82,17 +82,17 @@
mFrameRecords[mOffset].frameReadyTime = INT64_MAX;
mFrameRecords[mOffset].actualPresentTime = INT64_MAX;
- if (mFrameRecords[mOffset].frameReadyFence != NULL) {
+ if (mFrameRecords[mOffset].frameReadyFence != nullptr) {
// We're clobbering an unsignaled fence, so we need to decrement the
// fence count.
- mFrameRecords[mOffset].frameReadyFence = NULL;
+ mFrameRecords[mOffset].frameReadyFence = nullptr;
mNumFences--;
}
- if (mFrameRecords[mOffset].actualPresentFence != NULL) {
+ if (mFrameRecords[mOffset].actualPresentFence != nullptr) {
// We're clobbering an unsignaled fence, so we need to decrement the
// fence count.
- mFrameRecords[mOffset].actualPresentFence = NULL;
+ mFrameRecords[mOffset].actualPresentFence = nullptr;
mNumFences--;
}
}
@@ -153,10 +153,10 @@
bool updated = false;
const std::shared_ptr<FenceTime>& rfence = records[idx].frameReadyFence;
- if (rfence != NULL) {
+ if (rfence != nullptr) {
records[idx].frameReadyTime = rfence->getSignalTime();
if (records[idx].frameReadyTime < INT64_MAX) {
- records[idx].frameReadyFence = NULL;
+ records[idx].frameReadyFence = nullptr;
numFences--;
updated = true;
}
@@ -164,10 +164,10 @@
const std::shared_ptr<FenceTime>& pfence =
records[idx].actualPresentFence;
- if (pfence != NULL) {
+ if (pfence != nullptr) {
records[idx].actualPresentTime = pfence->getSignalTime();
if (records[idx].actualPresentTime < INT64_MAX) {
- records[idx].actualPresentFence = NULL;
+ records[idx].actualPresentFence = nullptr;
numFences--;
updated = true;
}
diff --git a/services/surfaceflinger/FrameTracker.h b/services/surfaceflinger/FrameTracker.h
index adcdfb5..b4a9fd6 100644
--- a/services/surfaceflinger/FrameTracker.h
+++ b/services/surfaceflinger/FrameTracker.h
@@ -35,7 +35,7 @@
// possible.
//
// Some of the time values tracked may be set either as a specific timestamp
-// or a fence. When a non-NULL fence is set for a given time value, the
+// or a fence. When a non-nullptr fence is set for a given time value, the
// signal time of that fence is used instead of the timestamp.
class FrameTracker {
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index cc675c4..63f6781 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -265,7 +265,7 @@
if (!mCurrentCrop.isEmpty()) {
// if the buffer crop is defined, we use that
crop = mCurrentCrop;
- } else if (getBE().compositionInfo.mBuffer != NULL) {
+ } else if (getBE().compositionInfo.mBuffer != nullptr) {
// otherwise we use the whole buffer
crop = getBE().compositionInfo.mBuffer->getBounds();
} else {
diff --git a/services/surfaceflinger/LayerRejecter.cpp b/services/surfaceflinger/LayerRejecter.cpp
index e864607..a5f0b98 100644
--- a/services/surfaceflinger/LayerRejecter.cpp
+++ b/services/surfaceflinger/LayerRejecter.cpp
@@ -41,7 +41,7 @@
mFreezeGeometryUpdates(freezePositionUpdates) {}
bool LayerRejecter::reject(const sp<GraphicBuffer>& buf, const BufferItem& item) {
- if (buf == NULL) {
+ if (buf == nullptr) {
return false;
}
diff --git a/services/surfaceflinger/RenderEngine/Program.cpp b/services/surfaceflinger/RenderEngine/Program.cpp
index baf92eb..225bcf0 100644
--- a/services/surfaceflinger/RenderEngine/Program.cpp
+++ b/services/surfaceflinger/RenderEngine/Program.cpp
@@ -115,7 +115,7 @@
GLint l;
glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &l);
char* src = new char[l];
- glGetShaderSource(shader, l, NULL, src);
+ glGetShaderSource(shader, l, nullptr, src);
result.append(src);
delete[] src;
return result;
diff --git a/services/surfaceflinger/RenderEngine/ProgramCache.cpp b/services/surfaceflinger/RenderEngine/ProgramCache.cpp
index 4f138dc..3b8ac0e 100644
--- a/services/surfaceflinger/RenderEngine/ProgramCache.cpp
+++ b/services/surfaceflinger/RenderEngine/ProgramCache.cpp
@@ -98,7 +98,7 @@
continue;
}
Program* program = mCache.valueFor(shaderKey);
- if (program == NULL) {
+ if (program == nullptr) {
program = generateProgram(shaderKey);
mCache.add(shaderKey, program);
shaderCount++;
@@ -273,7 +273,7 @@
// look-up the program in the cache
Program* program = mCache.valueFor(needs);
- if (program == NULL) {
+ if (program == nullptr) {
// we didn't find our program, so generate one...
nsecs_t time = -systemTime();
program = generateProgram(needs);
diff --git a/services/surfaceflinger/RenderEngine/RenderEngine.cpp b/services/surfaceflinger/RenderEngine/RenderEngine.cpp
index 314333f..179b790 100644
--- a/services/surfaceflinger/RenderEngine/RenderEngine.cpp
+++ b/services/surfaceflinger/RenderEngine/RenderEngine.cpp
@@ -36,11 +36,11 @@
std::unique_ptr<RenderEngine> RenderEngine::create(int hwcFormat, uint32_t featureFlags) {
// initialize EGL for the default display
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- if (!eglInitialize(display, NULL, NULL)) {
+ if (!eglInitialize(display, nullptr, nullptr)) {
LOG_ALWAYS_FATAL("failed to initialize EGL");
}
- GLExtensions& extensions(GLExtensions::getInstance());
+ GLExtensions& extensions = GLExtensions::getInstance();
extensions.initWithEGLStrings(eglQueryStringImplementationANDROID(display, EGL_VERSION),
eglQueryStringImplementationANDROID(display, EGL_EXTENSIONS));
@@ -79,7 +79,7 @@
contextAttributes.push_back(EGL_NONE);
contextAttributes.push_back(EGL_NONE);
- EGLContext ctxt = eglCreateContext(display, config, NULL, contextAttributes.data());
+ EGLContext ctxt = eglCreateContext(display, config, nullptr, contextAttributes.data());
// if can't create a GL context, we can only abort.
LOG_ALWAYS_FATAL_IF(ctxt == EGL_NO_CONTEXT, "EGLContext creation failed");
@@ -132,7 +132,7 @@
}
RenderEngine::RenderEngine()
- : mEGLDisplay(EGL_NO_DISPLAY), mEGLConfig(NULL), mEGLContext(EGL_NO_CONTEXT) {}
+ : mEGLDisplay(EGL_NO_DISPLAY), mEGLConfig(nullptr), mEGLContext(EGL_NO_CONTEXT) {}
RenderEngine::~RenderEngine() {
eglMakeCurrent(mEGLDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
@@ -183,7 +183,7 @@
return base::unique_fd();
}
- EGLSyncKHR sync = eglCreateSyncKHR(mEGLDisplay, EGL_SYNC_NATIVE_FENCE_ANDROID, NULL);
+ EGLSyncKHR sync = eglCreateSyncKHR(mEGLDisplay, EGL_SYNC_NATIVE_FENCE_ANDROID, nullptr);
if (sync == EGL_NO_SYNC_KHR) {
ALOGW("failed to create EGL native fence sync: %#x", eglGetError());
return base::unique_fd();
@@ -208,7 +208,7 @@
return false;
}
- EGLSyncKHR sync = eglCreateSyncKHR(mEGLDisplay, EGL_SYNC_FENCE_KHR, NULL);
+ EGLSyncKHR sync = eglCreateSyncKHR(mEGLDisplay, EGL_SYNC_FENCE_KHR, nullptr);
if (sync == EGL_NO_SYNC_KHR) {
ALOGW("failed to create EGL fence sync: %#x", eglGetError());
return false;
@@ -347,7 +347,7 @@
}
void RenderEngine::dump(String8& result) {
- const GLExtensions& extensions(GLExtensions::getInstance());
+ const GLExtensions& extensions = GLExtensions::getInstance();
result.appendFormat("EGL implementation : %s\n", extensions.getEGLVersion());
result.appendFormat("%s\n", extensions.getEGLExtensions());
@@ -363,7 +363,7 @@
RenderEngine& engine, ANativeWindowBuffer* buffer)
: mEngine(engine) {
mImage = eglCreateImageKHR(mEngine.mEGLDisplay, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID,
- buffer, NULL);
+ buffer, nullptr);
if (mImage == EGL_NO_IMAGE_KHR) {
mStatus = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
return;
@@ -394,7 +394,7 @@
static status_t selectConfigForAttribute(EGLDisplay dpy, EGLint const* attrs, EGLint attribute,
EGLint wanted, EGLConfig* outConfig) {
EGLint numConfigs = -1, n = 0;
- eglGetConfigs(dpy, NULL, 0, &numConfigs);
+ eglGetConfigs(dpy, nullptr, 0, &numConfigs);
EGLConfig* const configs = new EGLConfig[numConfigs];
eglChooseConfig(dpy, attrs, configs, numConfigs, &n);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index db13b99..0210592 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -382,7 +382,7 @@
sp<IBinder> SurfaceFlinger::getBuiltInDisplay(int32_t id) {
if (uint32_t(id) >= DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) {
ALOGE("getDefaultDisplay: id=%d is not a valid default display id", id);
- return NULL;
+ return nullptr;
}
return mBuiltinDisplays[id];
}
@@ -531,7 +531,7 @@
}
}
- if (callback != NULL) {
+ if (callback != nullptr) {
callback->onVSyncEvent(when);
}
}
@@ -737,7 +737,7 @@
status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
Vector<DisplayInfo>* configs) {
- if ((configs == NULL) || (display.get() == NULL)) {
+ if (configs == nullptr || display.get() == nullptr) {
return BAD_VALUE;
}
@@ -761,7 +761,7 @@
static int getDensityFromProperty(char const* propName) {
char property[PROPERTY_VALUE_MAX];
int density = 0;
- if (property_get(propName, property, NULL) > 0) {
+ if (property_get(propName, property, nullptr) > 0) {
density = atoi(property);
}
return density;
@@ -842,7 +842,7 @@
status_t SurfaceFlinger::getDisplayStats(const sp<IBinder>& /* display */,
DisplayStatInfo* stats) {
- if (stats == NULL) {
+ if (stats == nullptr) {
return BAD_VALUE;
}
@@ -854,13 +854,13 @@
}
int SurfaceFlinger::getActiveConfig(const sp<IBinder>& display) {
- if (display == NULL) {
- ALOGE("%s : display is NULL", __func__);
+ if (display == nullptr) {
+ ALOGE("%s : display is nullptr", __func__);
return BAD_VALUE;
}
sp<const DisplayDevice> device(getDisplayDevice(display));
- if (device != NULL) {
+ if (device != nullptr) {
return device->getActiveConfig();
}
@@ -905,7 +905,7 @@
return true;
}
sp<DisplayDevice> hw(mFlinger.getDisplayDevice(mDisplay));
- if (hw == NULL) {
+ if (hw == nullptr) {
ALOGE("Attempt to set active config = %d for null display %p",
mMode, mDisplay.get());
} else if (hw->getDisplayType() >= DisplayDevice::DISPLAY_VIRTUAL) {
@@ -2165,7 +2165,7 @@
const sp<const DisplayDevice> defaultDisplay(getDefaultDisplayDeviceLocked());
defaultDisplay->makeCurrent();
sp<DisplayDevice> hw(getDisplayDeviceLocked(draw.keyAt(i)));
- if (hw != NULL)
+ if (hw != nullptr)
hw->disconnect(getHwComposer());
if (draw[i].type < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES)
mEventThread->onHotplugReceived(draw[i].type, false);
@@ -2185,7 +2185,7 @@
// from the drawing state, so that it get re-added
// below.
sp<DisplayDevice> hw(getDisplayDeviceLocked(display));
- if (hw != NULL)
+ if (hw != nullptr)
hw->disconnect(getHwComposer());
mDisplays.removeItem(display);
mDrawingState.displays.removeItemsAt(i);
@@ -2195,7 +2195,7 @@
}
const sp<DisplayDevice> disp(getDisplayDeviceLocked(display));
- if (disp != NULL) {
+ if (disp != nullptr) {
if (state.layerStack != draw[i].layerStack) {
disp->setLayerStack(state.layerStack);
}
@@ -2231,7 +2231,7 @@
// Virtual displays without a surface are dormant:
// they have external state (layer stack, projection,
// etc.) but no internal state (i.e. a DisplayDevice).
- if (state.surface != NULL) {
+ if (state.surface != nullptr) {
// Allow VR composer to use virtual displays.
if (mUseHwcVirtualDisplays || getBE().mHwc->isUsingVrComposer()) {
@@ -2268,7 +2268,7 @@
producer = vds;
}
} else {
- ALOGE_IF(state.surface!=NULL,
+ ALOGE_IF(state.surface != nullptr,
"adding a supported display, but rendering "
"surface is provided (%p), ignoring it",
state.surface.get());
@@ -2279,7 +2279,7 @@
}
const wp<IBinder>& display(curr.keyAt(i));
- if (dispSurface != NULL) {
+ if (dispSurface != nullptr) {
sp<DisplayDevice> hw =
new DisplayDevice(this, state.type, hwcId, state.isSecure, display,
dispSurface, producer, hasWideColorDisplay);
@@ -2334,10 +2334,10 @@
for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
sp<const DisplayDevice> hw(mDisplays[dpy]);
if (layer->belongsToDisplay(hw->getLayerStack(), hw->isPrimary())) {
- if (disp == NULL) {
+ if (disp == nullptr) {
disp = std::move(hw);
} else {
- disp = NULL;
+ disp = nullptr;
break;
}
}
@@ -2345,7 +2345,7 @@
}
if (transactionFlags & eDisplayTransactionNeeded) {
- if (disp == NULL) {
+ if (disp == nullptr) {
// NOTE: TEMPORARY FIX ONLY. Real fix should cause layers to
// redraw after transform hint changes. See bug 8508397.
@@ -2941,16 +2941,16 @@
for (size_t i=0 ; i<count ; i++) {
const ComposerState& s(state[i]);
// Here we need to check that the interface we're given is indeed
- // one of our own. A malicious client could give us a NULL
+ // one of our own. A malicious client could give us a nullptr
// IInterface, or one of its own or even one of our own but a
// different type. All these situations would cause us to crash.
//
// NOTE: it would be better to use RTTI as we could directly check
// that we have a Client*. however, RTTI is disabled in Android.
- if (s.client != NULL) {
+ if (s.client != nullptr) {
sp<IBinder> binder = IInterface::asBinder(s.client);
- if (binder != NULL) {
- if (binder->queryLocalInterface(ISurfaceComposerClient::descriptor) != NULL) {
+ if (binder != nullptr) {
+ if (binder->queryLocalInterface(ISurfaceComposerClient::descriptor) != nullptr) {
sp<Client> client( static_cast<Client *>(s.client.get()) );
transactionFlags |= setClientStateLocked(client, s.state);
}
@@ -3324,7 +3324,7 @@
// called by a client when it wants to remove a Layer
status_t err = NO_ERROR;
sp<Layer> l(client->getLayerUser(handle));
- if (l != NULL) {
+ if (l != nullptr) {
mInterceptor.saveSurfaceDeletion(l);
err = removeLayer(l);
ALOGE_IF(err<0 && err != NAME_NOT_FOUND,
@@ -3489,7 +3489,7 @@
mDisplay(disp) { mMode = mode; }
virtual bool handler() {
sp<DisplayDevice> hw(mFlinger.getDisplayDevice(mDisplay));
- if (hw == NULL) {
+ if (hw == nullptr) {
ALOGE("Attempt to set power mode = %d for null display %p",
mMode, mDisplay.get());
} else if (hw->getDisplayType() >= DisplayDevice::DISPLAY_VIRTUAL) {
@@ -3978,7 +3978,7 @@
break;
}
}
- if (dpy == NULL) {
+ if (dpy == nullptr) {
ALOGE("getLayerSortedByZForHwcDisplay: invalid hwc display id %d", id);
// Just use the primary display so we have something to return
dpy = getBuiltInDisplay(DisplayDevice::DISPLAY_PRIMARY);
diff --git a/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp b/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp
index ed806b8..de78c3f 100644
--- a/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp
+++ b/services/surfaceflinger/tests/SurfaceInterceptor_test.cpp
@@ -148,7 +148,7 @@
mBGSurfaceControl = mComposerClient->createSurface(
String8("BG Interceptor Test Surface"), displayWidth, displayHeight,
PIXEL_FORMAT_RGBA_8888, 0);
- ASSERT_TRUE(mBGSurfaceControl != NULL);
+ ASSERT_TRUE(mBGSurfaceControl != nullptr);
ASSERT_TRUE(mBGSurfaceControl->isValid());
mBGLayerId = getSurfaceId("BG Interceptor Test Surface");
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index ff81dc9..ac8a2ad 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -148,8 +148,8 @@
bool unlock = true) {
ANativeWindow_Buffer outBuffer;
sp<Surface> s = sc->getSurface();
- ASSERT_TRUE(s != NULL);
- ASSERT_EQ(NO_ERROR, s->lock(&outBuffer, NULL));
+ ASSERT_TRUE(s != nullptr);
+ ASSERT_EQ(NO_ERROR, s->lock(&outBuffer, nullptr));
uint8_t* img = reinterpret_cast<uint8_t*>(outBuffer.bits);
for (int y = 0; y < outBuffer.height; y++) {
for (int x = 0; x < outBuffer.width; x++) {
@@ -279,7 +279,7 @@
private:
sp<GraphicBuffer> mOutBuffer;
- uint8_t* mPixels = NULL;
+ uint8_t* mPixels = nullptr;
};
class LayerTransactionTest : public ::testing::Test {
@@ -1483,14 +1483,14 @@
mBGSurfaceControl =
mComposerClient->createSurface(String8("BG Test Surface"), displayWidth,
displayHeight, PIXEL_FORMAT_RGBA_8888, 0);
- ASSERT_TRUE(mBGSurfaceControl != NULL);
+ ASSERT_TRUE(mBGSurfaceControl != nullptr);
ASSERT_TRUE(mBGSurfaceControl->isValid());
fillSurfaceRGBA8(mBGSurfaceControl, 63, 63, 195);
// Foreground surface
mFGSurfaceControl = mComposerClient->createSurface(String8("FG Test Surface"), 64, 64,
PIXEL_FORMAT_RGBA_8888, 0);
- ASSERT_TRUE(mFGSurfaceControl != NULL);
+ ASSERT_TRUE(mFGSurfaceControl != nullptr);
ASSERT_TRUE(mFGSurfaceControl->isValid());
fillSurfaceRGBA8(mFGSurfaceControl, 195, 63, 63);
@@ -1498,7 +1498,7 @@
// Synchronization surface
mSyncSurfaceControl = mComposerClient->createSurface(String8("Sync Test Surface"), 1, 1,
PIXEL_FORMAT_RGBA_8888, 0);
- ASSERT_TRUE(mSyncSurfaceControl != NULL);
+ ASSERT_TRUE(mSyncSurfaceControl != nullptr);
ASSERT_TRUE(mSyncSurfaceControl->isValid());
fillSurfaceRGBA8(mSyncSurfaceControl, 31, 31, 31);
@@ -2018,7 +2018,7 @@
mNewComposerClient->createSurface(String8("New Child Test Surface"), 10, 10,
PIXEL_FORMAT_RGBA_8888, 0, mFGSurfaceControl.get());
- ASSERT_TRUE(mChildNewClient != NULL);
+ ASSERT_TRUE(mChildNewClient != nullptr);
ASSERT_TRUE(mChildNewClient->isValid());
fillSurfaceRGBA8(mChildNewClient, 200, 200, 200);
@@ -2210,7 +2210,7 @@
TEST_F(ChildLayerTest, ReparentFromNoParent) {
sp<SurfaceControl> newSurface = mComposerClient->createSurface(String8("New Surface"), 10, 10,
PIXEL_FORMAT_RGBA_8888, 0);
- ASSERT_TRUE(newSurface != NULL);
+ ASSERT_TRUE(newSurface != nullptr);
ASSERT_TRUE(newSurface->isValid());
fillSurfaceRGBA8(newSurface, 63, 195, 63);