summaryrefslogtreecommitdiff
path: root/libs/gui/Surface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gui/Surface.cpp')
-rw-r--r--libs/gui/Surface.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index d9d945dff1..e55e6e415a 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -153,7 +153,7 @@ status_t Surface::getDisplayRefreshCycleDuration(nsecs_t* outRefreshDuration) {
ATRACE_CALL();
DisplayStatInfo stats;
- status_t result = composerService()->getDisplayStats(NULL, &stats);
+ status_t result = composerService()->getDisplayStats(nullptr, &stats);
if (result != NO_ERROR) {
return result;
}
@@ -494,7 +494,7 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer, int* fenceFd) {
if (mSharedBufferMode && mAutoRefresh && mSharedBufferSlot !=
BufferItem::INVALID_BUFFER_SLOT) {
sp<GraphicBuffer>& gbuf(mSlots[mSharedBufferSlot].buffer);
- if (gbuf != NULL) {
+ if (gbuf != nullptr) {
*buffer = gbuf.get();
*fenceFd = -1;
return OK;
@@ -534,7 +534,7 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer, int* fenceFd) {
sp<GraphicBuffer>& gbuf(mSlots[buf].buffer);
// this should never happen
- ALOGE_IF(fence == NULL, "Surface::dequeueBuffer: received null Fence! buf=%d", buf);
+ ALOGE_IF(fence == nullptr, "Surface::dequeueBuffer: received null Fence! buf=%d", buf);
if (result & IGraphicBufferProducer::RELEASE_ALL_BUFFERS) {
freeAllBuffers();
@@ -612,7 +612,7 @@ int Surface::cancelBuffer(android_native_buffer_t* buffer,
int Surface::getSlotFromBufferLocked(
android_native_buffer_t* buffer) const {
for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
- if (mSlots[i].buffer != NULL &&
+ if (mSlots[i].buffer != nullptr &&
mSlots[i].buffer->handle == buffer->handle) {
return i;
}
@@ -1236,7 +1236,7 @@ int Surface::detachNextBuffer(sp<GraphicBuffer>* outBuffer,
ATRACE_CALL();
ALOGV("Surface::detachNextBuffer");
- if (outBuffer == NULL || outFence == NULL) {
+ if (outBuffer == nullptr || outFence == nullptr) {
return BAD_VALUE;
}
@@ -1245,8 +1245,8 @@ int Surface::detachNextBuffer(sp<GraphicBuffer>* outBuffer,
mRemovedBuffers.clear();
}
- sp<GraphicBuffer> buffer(NULL);
- sp<Fence> fence(NULL);
+ sp<GraphicBuffer> buffer(nullptr);
+ sp<Fence> fence(nullptr);
status_t result = mGraphicBufferProducer->detachNextBuffer(
&buffer, &fence);
if (result != NO_ERROR) {
@@ -1254,19 +1254,19 @@ int Surface::detachNextBuffer(sp<GraphicBuffer>* outBuffer,
}
*outBuffer = buffer;
- if (fence != NULL && fence->isValid()) {
+ if (fence != nullptr && fence->isValid()) {
*outFence = fence;
} else {
*outFence = Fence::NO_FENCE;
}
for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
- if (mSlots[i].buffer != NULL &&
+ if (mSlots[i].buffer != nullptr &&
mSlots[i].buffer->getId() == buffer->getId()) {
if (mReportRemovedBuffers) {
mRemovedBuffers.push_back(mSlots[i].buffer);
}
- mSlots[i].buffer = NULL;
+ mSlots[i].buffer = nullptr;
}
}
@@ -1317,7 +1317,7 @@ int Surface::setCrop(Rect const* rect)
ATRACE_CALL();
Rect realRect(Rect::EMPTY_RECT);
- if (rect == NULL || rect->isEmpty()) {
+ if (rect == nullptr || rect->isEmpty()) {
realRect.clear();
} else {
realRect = *rect;
@@ -1514,7 +1514,7 @@ int Surface::setBuffersDataSpace(android_dataspace dataSpace)
void Surface::freeAllBuffers() {
for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
- mSlots[i].buffer = 0;
+ mSlots[i].buffer = nullptr;
}
}
@@ -1554,12 +1554,12 @@ static status_t copyBlt(
// src and dst with, height and format must be identical. no verification
// is done here.
status_t err;
- uint8_t* src_bits = NULL;
+ uint8_t* src_bits = nullptr;
err = src->lock(GRALLOC_USAGE_SW_READ_OFTEN, reg.bounds(),
reinterpret_cast<void**>(&src_bits));
ALOGE_IF(err, "error locking src buffer %s", strerror(-err));
- uint8_t* dst_bits = NULL;
+ uint8_t* dst_bits = nullptr;
err = dst->lockAsync(GRALLOC_USAGE_SW_WRITE_OFTEN, reg.bounds(),
reinterpret_cast<void**>(&dst_bits), *dstFenceFd);
ALOGE_IF(err, "error locking dst buffer %s", strerror(-err));
@@ -1607,7 +1607,7 @@ static status_t copyBlt(
status_t Surface::lock(
ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds)
{
- if (mLockedBuffer != 0) {
+ if (mLockedBuffer != nullptr) {
ALOGE("Surface::lock failed, already locked");
return INVALID_OPERATION;
}
@@ -1639,7 +1639,7 @@ status_t Surface::lock(
// figure out if we can copy the frontbuffer back
const sp<GraphicBuffer>& frontBuffer(mPostedBuffer);
- const bool canCopyBack = (frontBuffer != 0 &&
+ const bool canCopyBack = (frontBuffer != nullptr &&
backBuffer->width == frontBuffer->width &&
backBuffer->height == frontBuffer->height &&
backBuffer->format == frontBuffer->format);
@@ -1701,7 +1701,7 @@ status_t Surface::lock(
status_t Surface::unlockAndPost()
{
- if (mLockedBuffer == 0) {
+ if (mLockedBuffer == nullptr) {
ALOGE("Surface::unlockAndPost failed, no locked buffer");
return INVALID_OPERATION;
}
@@ -1715,7 +1715,7 @@ status_t Surface::unlockAndPost()
mLockedBuffer->handle, strerror(-err));
mPostedBuffer = mLockedBuffer;
- mLockedBuffer = 0;
+ mLockedBuffer = nullptr;
return err;
}