Add overrides and switch to nullptr keyword for all files
Adds remaining missing overrides and nullptr usages, missed due to
an extreme failure in tool usage.
Change-Id: I56abd72975a3999ad13330003c348db40f59aebf
diff --git a/libs/hwui/AnimationContext.cpp b/libs/hwui/AnimationContext.cpp
index a20bdae..097be08 100644
--- a/libs/hwui/AnimationContext.cpp
+++ b/libs/hwui/AnimationContext.cpp
@@ -59,7 +59,7 @@
"Missed running animations last frame!");
AnimationHandle* head = mNextFrameAnimations.mNextHandle;
if (head) {
- mNextFrameAnimations.mNextHandle = NULL;
+ mNextFrameAnimations.mNextHandle = nullptr;
mCurrentFrameAnimations.mNextHandle = head;
head->mPreviousHandle = &mCurrentFrameAnimations;
}
@@ -84,15 +84,15 @@
AnimationHandle::AnimationHandle(AnimationContext& context)
: mContext(context)
- , mPreviousHandle(NULL)
- , mNextHandle(NULL) {
+ , mPreviousHandle(nullptr)
+ , mNextHandle(nullptr) {
}
AnimationHandle::AnimationHandle(RenderNode& animatingNode, AnimationContext& context)
: mRenderNode(&animatingNode)
, mContext(context)
- , mPreviousHandle(NULL)
- , mNextHandle(NULL) {
+ , mPreviousHandle(nullptr)
+ , mNextHandle(nullptr) {
mRenderNode->animators().setAnimationHandle(this);
}
@@ -114,7 +114,7 @@
LOG_ALWAYS_FATAL_IF(mRenderNode->animators().hasAnimators(),
"Releasing the handle for an RenderNode with outstanding animators!");
removeFromList();
- mRenderNode->animators().setAnimationHandle(NULL);
+ mRenderNode->animators().setAnimationHandle(nullptr);
delete this;
}
@@ -135,8 +135,8 @@
if (mNextHandle) {
mNextHandle->mPreviousHandle = mPreviousHandle;
}
- mPreviousHandle = NULL;
- mNextHandle = NULL;
+ mPreviousHandle = nullptr;
+ mNextHandle = nullptr;
}
} /* namespace uirenderer */
diff --git a/libs/hwui/Animator.cpp b/libs/hwui/Animator.cpp
index 805f844..512e0e2 100644
--- a/libs/hwui/Animator.cpp
+++ b/libs/hwui/Animator.cpp
@@ -32,7 +32,7 @@
************************************************************/
BaseRenderNodeAnimator::BaseRenderNodeAnimator(float finalValue)
- : mTarget(NULL)
+ : mTarget(nullptr)
, mFinalValue(finalValue)
, mDeltaValue(0)
, mFromValue(0)
diff --git a/libs/hwui/Animator.h b/libs/hwui/Animator.h
index aa3d301..1b3d8e7 100644
--- a/libs/hwui/Animator.h
+++ b/libs/hwui/Animator.h
@@ -64,7 +64,7 @@
void attach(RenderNode* target);
virtual void onAttached() {}
- void detach() { mTarget = 0; }
+ void detach() { mTarget = nullptr; }
void pushStaging(AnimationContext& context);
bool animate(AnimationContext& context);
@@ -139,10 +139,10 @@
ANDROID_API virtual uint32_t dirtyMask();
protected:
- virtual float getValue(RenderNode* target) const;
- virtual void setValue(RenderNode* target, float value);
- virtual void onAttached();
- virtual void onStagingPlayStateChanged();
+ virtual float getValue(RenderNode* target) const override;
+ virtual void setValue(RenderNode* target, float value) override;
+ virtual void onAttached() override;
+ virtual void onStagingPlayStateChanged() override;
private:
typedef bool (RenderProperties::*SetFloatProperty)(float value);
@@ -162,8 +162,8 @@
ANDROID_API virtual uint32_t dirtyMask();
protected:
- virtual float getValue(RenderNode* target) const;
- virtual void setValue(RenderNode* target, float value);
+ virtual float getValue(RenderNode* target) const override;
+ virtual void setValue(RenderNode* target, float value) override;
private:
sp<CanvasPropertyPrimitive> mProperty;
};
@@ -181,8 +181,8 @@
ANDROID_API virtual uint32_t dirtyMask();
protected:
- virtual float getValue(RenderNode* target) const;
- virtual void setValue(RenderNode* target, float value);
+ virtual float getValue(RenderNode* target) const override;
+ virtual void setValue(RenderNode* target, float value) override;
private:
sp<CanvasPropertyPaint> mProperty;
PaintField mField;
@@ -196,8 +196,8 @@
ANDROID_API virtual uint32_t dirtyMask();
protected:
- virtual float getValue(RenderNode* target) const;
- virtual void setValue(RenderNode* target, float value);
+ virtual float getValue(RenderNode* target) const override;
+ virtual void setValue(RenderNode* target, float value) override;
private:
int mCenterX, mCenterY;
diff --git a/libs/hwui/AnimatorManager.cpp b/libs/hwui/AnimatorManager.cpp
index 9a4ba21..966959a 100644
--- a/libs/hwui/AnimatorManager.cpp
+++ b/libs/hwui/AnimatorManager.cpp
@@ -29,12 +29,12 @@
static void unref(BaseRenderNodeAnimator* animator) {
animator->detach();
- animator->decStrong(0);
+ animator->decStrong(nullptr);
}
AnimatorManager::AnimatorManager(RenderNode& parent)
: mParent(parent)
- , mAnimationHandle(NULL) {
+ , mAnimationHandle(nullptr) {
}
AnimatorManager::~AnimatorManager() {
@@ -43,7 +43,7 @@
}
void AnimatorManager::addAnimator(const sp<BaseRenderNodeAnimator>& animator) {
- animator->incStrong(0);
+ animator->incStrong(nullptr);
animator->attach(&mParent);
mNewAnimators.push_back(animator.get());
}
@@ -87,7 +87,7 @@
dirtyMask |= animator->dirtyMask();
bool remove = animator->animate(mContext);
if (remove) {
- animator->decStrong(0);
+ animator->decStrong(nullptr);
} else {
if (animator->isRunning()) {
mInfo.out.hasAnimations = true;
@@ -144,7 +144,7 @@
if (animator->listener()) {
animator->listener()->onAnimationFinished(animator);
}
- animator->decStrong(0);
+ animator->decStrong(nullptr);
}
void AnimatorManager::endAllStagingAnimators() {
@@ -161,7 +161,7 @@
void operator() (BaseRenderNodeAnimator* animator) {
animator->forceEndNow(mContext);
- animator->decStrong(0);
+ animator->decStrong(nullptr);
}
private:
diff --git a/libs/hwui/AssetAtlas.cpp b/libs/hwui/AssetAtlas.cpp
index 366e486..4d2e3a0 100644
--- a/libs/hwui/AssetAtlas.cpp
+++ b/libs/hwui/AssetAtlas.cpp
@@ -48,7 +48,7 @@
} else {
ALOGW("Could not create atlas image");
delete mImage;
- mImage = NULL;
+ mImage = nullptr;
}
updateTextureId();
@@ -57,7 +57,7 @@
void AssetAtlas::terminate() {
if (mImage) {
delete mImage;
- mImage = NULL;
+ mImage = nullptr;
updateTextureId();
}
}
@@ -83,12 +83,12 @@
AssetAtlas::Entry* AssetAtlas::getEntry(const SkBitmap* bitmap) const {
ssize_t index = mEntries.indexOfKey(bitmap);
- return index >= 0 ? mEntries.valueAt(index) : NULL;
+ return index >= 0 ? mEntries.valueAt(index) : nullptr;
}
Texture* AssetAtlas::getEntryTexture(const SkBitmap* bitmap) const {
ssize_t index = mEntries.indexOfKey(bitmap);
- return index >= 0 ? mEntries.valueAt(index)->texture : NULL;
+ return index >= 0 ? mEntries.valueAt(index)->texture : nullptr;
}
/**
@@ -99,12 +99,12 @@
DelegateTexture(Caches& caches, Texture* delegate): Texture(caches), mDelegate(delegate) { }
virtual void setWrapST(GLenum wrapS, GLenum wrapT, bool bindTexture = false,
- bool force = false, GLenum renderTarget = GL_TEXTURE_2D) {
+ bool force = false, GLenum renderTarget = GL_TEXTURE_2D) override {
mDelegate->setWrapST(wrapS, wrapT, bindTexture, force, renderTarget);
}
virtual void setFilterMinMag(GLenum min, GLenum mag, bool bindTexture = false,
- bool force = false, GLenum renderTarget = GL_TEXTURE_2D) {
+ bool force = false, GLenum renderTarget = GL_TEXTURE_2D) override {
mDelegate->setFilterMinMag(min, mag, bindTexture, force, renderTarget);
}
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index ebeb845..107eb08 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -49,7 +49,7 @@
///////////////////////////////////////////////////////////////////////////////
Caches::Caches(): Singleton<Caches>(),
- mExtensions(Extensions::getInstance()), mInitialized(false), mRenderState(NULL) {
+ mExtensions(Extensions::getInstance()), mInitialized(false), mRenderState(nullptr) {
init();
initFont();
initConstraints();
@@ -87,13 +87,13 @@
glActiveTexture(gTextureUnits[0]);
mTextureUnit = 0;
- mRegionMesh = NULL;
+ mRegionMesh = nullptr;
mMeshIndices = 0;
mShadowStripsIndices = 0;
blend = false;
lastSrcMode = GL_ZERO;
lastDstMode = GL_ZERO;
- currentProgram = NULL;
+ currentProgram = nullptr;
mFunctorsCount = 0;
@@ -163,7 +163,7 @@
StencilClipDebug prevDebugStencilClip = debugStencilClip;
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_DEBUG_LAYERS_UPDATES, property, NULL) > 0) {
+ if (property_get(PROPERTY_DEBUG_LAYERS_UPDATES, property, nullptr) > 0) {
INIT_LOGD(" Layers updates debug enabled: %s", property);
debugLayersUpdates = !strcmp(property, "true");
} else {
@@ -171,7 +171,7 @@
}
debugOverdraw = false;
- if (property_get(PROPERTY_DEBUG_OVERDRAW, property, NULL) > 0) {
+ if (property_get(PROPERTY_DEBUG_OVERDRAW, property, nullptr) > 0) {
INIT_LOGD(" Overdraw debug enabled: %s", property);
if (!strcmp(property, "show")) {
debugOverdraw = true;
@@ -183,7 +183,7 @@
}
// See Properties.h for valid values
- if (property_get(PROPERTY_DEBUG_STENCIL_CLIP, property, NULL) > 0) {
+ if (property_get(PROPERTY_DEBUG_STENCIL_CLIP, property, nullptr) > 0) {
INIT_LOGD(" Stencil clip debug enabled: %s", property);
if (!strcmp(property, "hide")) {
debugStencilClip = kStencilHide;
@@ -233,7 +233,7 @@
fboCache.clear();
programCache.clear();
- currentProgram = NULL;
+ currentProgram = nullptr;
patchCache.clear();
diff --git a/libs/hwui/CanvasState.cpp b/libs/hwui/CanvasState.cpp
index 20cc17e..9d2ccf1 100644
--- a/libs/hwui/CanvasState.cpp
+++ b/libs/hwui/CanvasState.cpp
@@ -257,7 +257,7 @@
// round rect clip is required if RR clip exists, and geometry intersects its corners
if (roundRectClipRequired) {
- *roundRectClipRequired = mSnapshot->roundRectClipState != NULL
+ *roundRectClipRequired = mSnapshot->roundRectClipState != nullptr
&& mSnapshot->roundRectClipState->areaRequiresRoundRectClip(r);
}
return false;
diff --git a/libs/hwui/DamageAccumulator.cpp b/libs/hwui/DamageAccumulator.cpp
index 420e331..a422622 100644
--- a/libs/hwui/DamageAccumulator.cpp
+++ b/libs/hwui/DamageAccumulator.cpp
@@ -79,7 +79,7 @@
void DamageAccumulator::pushCommon() {
if (!mHead->next) {
DirtyStack* nextFrame = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack));
- nextFrame->next = 0;
+ nextFrame->next = nullptr;
nextFrame->prev = mHead;
mHead->next = nextFrame;
}
@@ -147,7 +147,7 @@
return frame;
}
}
- return NULL;
+ return nullptr;
}
static DirtyStack* findProjectionReceiver(DirtyStack* frame) {
@@ -160,7 +160,7 @@
}
}
}
- return NULL;
+ return nullptr;
}
static void applyTransforms(DirtyStack* frame, DirtyStack* end) {
diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp
index 7355baa..a1a7e1a 100644
--- a/libs/hwui/DeferredDisplayList.cpp
+++ b/libs/hwui/DeferredDisplayList.cpp
@@ -91,7 +91,7 @@
return false;
}
- virtual void replay(OpenGLRenderer& renderer, Rect& dirty, int index) {
+ virtual void replay(OpenGLRenderer& renderer, Rect& dirty, int index) override {
DEFER_LOGD("%d replaying DrawBatch %p, with %d ops (batch id %x, merge id %p)",
index, this, mOps.size(), getBatchId(), getMergeId());
@@ -119,9 +119,9 @@
}
}
- virtual bool purelyDrawBatch() { return true; }
+ virtual bool purelyDrawBatch() override { return true; }
- virtual bool coversBounds(const Rect& bounds) {
+ virtual bool coversBounds(const Rect& bounds) override {
if (CC_LIKELY(!mAllOpsOpaque || !mBounds.contains(bounds) || count() == 1)) return false;
Region uncovered(android::Rect(bounds.left, bounds.top, bounds.right, bounds.bottom));
@@ -236,7 +236,8 @@
return true;
}
- virtual void add(DrawOp* op, const DeferredDisplayState* state, bool opaqueOverBounds) {
+ virtual void add(DrawOp* op, const DeferredDisplayState* state,
+ bool opaqueOverBounds) override {
DrawBatch::add(op, state, opaqueOverBounds);
const int newClipSideFlags = state->mClipSideFlags;
@@ -247,7 +248,7 @@
if (newClipSideFlags & kClipSide_Bottom) mClipRect.bottom = state->mClip.bottom;
}
- virtual void replay(OpenGLRenderer& renderer, Rect& dirty, int index) {
+ virtual void replay(OpenGLRenderer& renderer, Rect& dirty, int index) override {
DEFER_LOGD("%d replaying MergingDrawBatch %p, with %d ops,"
" clip flags %x (batch id %x, merge id %p)",
index, this, mOps.size(), mClipSideFlags, getBatchId(), getMergeId());
@@ -257,7 +258,7 @@
}
// clipping in the merged case is done ahead of time since all ops share the clip (if any)
- renderer.setupMergedMultiDraw(mClipSideFlags ? &mClipRect : NULL);
+ renderer.setupMergedMultiDraw(mClipSideFlags ? &mClipRect : nullptr);
DrawOp* op = mOps[0].op;
DisplayListLogBuffer& buffer = DisplayListLogBuffer::getInstance();
@@ -291,7 +292,7 @@
// creates a single operation batch
StateOpBatch(const StateOp* op, const DeferredDisplayState* state) : mOp(op), mState(state) {}
- virtual void replay(OpenGLRenderer& renderer, Rect& dirty, int index) {
+ virtual void replay(OpenGLRenderer& renderer, Rect& dirty, int index) override {
DEFER_LOGD("replaying state op batch %p", this);
renderer.restoreDisplayState(*mState);
@@ -312,7 +313,7 @@
RestoreToCountBatch(const StateOp* op, const DeferredDisplayState* state, int restoreCount) :
mState(state), mRestoreCount(restoreCount) {}
- virtual void replay(OpenGLRenderer& renderer, Rect& dirty, int index) {
+ virtual void replay(OpenGLRenderer& renderer, Rect& dirty, int index) override {
DEFER_LOGD("batch %p restoring to count %d", this, mRestoreCount);
renderer.restoreDisplayState(*mState);
@@ -346,7 +347,7 @@
void DeferredDisplayList::resetBatchingState() {
for (int i = 0; i < kOpBatch_Count; i++) {
- mBatchLookup[i] = NULL;
+ mBatchLookup[i] = nullptr;
mMergingBatches[i].clear();
}
#if DEBUG_MERGE_BEHAVIOR
@@ -516,7 +517,7 @@
}
// find the latest batch of the new op's type, and try to merge the new op into it
- DrawBatch* targetBatch = NULL;
+ DrawBatch* targetBatch = nullptr;
// insertion point of a new batch, will hopefully be immediately after similar batch
// (eventually, should be similar shader)
@@ -539,7 +540,7 @@
// Try to merge with any existing batch with same mergeId.
if (mMergingBatches[deferInfo.batchId].get(deferInfo.mergeId, targetBatch)) {
if (!((MergingDrawBatch*) targetBatch)->canMergeWith(op, state)) {
- targetBatch = NULL;
+ targetBatch = nullptr;
}
}
} else {
@@ -565,7 +566,7 @@
// NOTE: it may be possible to optimize for special cases where two operations
// of the same batch/paint could swap order, such as with a non-mergeable
// (clipped) and a mergeable text operation
- targetBatch = NULL;
+ targetBatch = nullptr;
#if DEBUG_DEFER
DEFER_LOGD("op couldn't join batch %p, was intersected by batch %d",
targetBatch, i);
@@ -670,7 +671,7 @@
// leave deferred state ops alone for simplicity (empty save restore pairs may now exist)
if (mBatches[i] && mBatches[i]->purelyDrawBatch()) {
delete mBatches[i];
- mBatches.replaceAt(NULL, i);
+ mBatches.replaceAt(nullptr, i);
}
}
mEarliestUnclearedIndex = maxIndex + 1;
diff --git a/libs/hwui/DeferredLayerUpdater.cpp b/libs/hwui/DeferredLayerUpdater.cpp
index 16d61fd..0792120 100644
--- a/libs/hwui/DeferredLayerUpdater.cpp
+++ b/libs/hwui/DeferredLayerUpdater.cpp
@@ -25,8 +25,8 @@
namespace uirenderer {
DeferredLayerUpdater::DeferredLayerUpdater(renderthread::RenderThread& thread, Layer* layer)
- : mSurfaceTexture(0)
- , mTransform(0)
+ : mSurfaceTexture(nullptr)
+ , mTransform(nullptr)
, mNeedsGLContextAttach(false)
, mUpdateTexImage(false)
, mLayer(layer)
@@ -42,14 +42,14 @@
DeferredLayerUpdater::~DeferredLayerUpdater() {
SkSafeUnref(mColorFilter);
- setTransform(0);
+ setTransform(nullptr);
mLayer->postDecStrong();
- mLayer = 0;
+ mLayer = nullptr;
}
void DeferredLayerUpdater::setPaint(const SkPaint* paint) {
OpenGLRenderer::getAlphaAndModeDirect(paint, &mAlpha, &mMode);
- SkColorFilter* colorFilter = (paint) ? paint->getColorFilter() : NULL;
+ SkColorFilter* colorFilter = (paint) ? paint->getColorFilter() : nullptr;
SkRefCnt_SafeAssign(mColorFilter, colorFilter);
}
@@ -70,7 +70,7 @@
}
if (mTransform) {
mLayer->getTransform().load(*mTransform);
- setTransform(0);
+ setTransform(nullptr);
}
}
return success;
@@ -95,7 +95,7 @@
bool forceFilter = false;
sp<GraphicBuffer> buffer = mSurfaceTexture->getCurrentBuffer();
- if (buffer != NULL) {
+ if (buffer != nullptr) {
// force filtration if buffer size != layer size
forceFilter = mWidth != static_cast<int>(buffer->getWidth())
|| mHeight != static_cast<int>(buffer->getHeight());
@@ -122,7 +122,7 @@
// TODO: Elevate to fatal exception
ALOGE("Failed to detach SurfaceTexture from context %d", err);
}
- mSurfaceTexture = 0;
+ mSurfaceTexture = nullptr;
mLayer->clearTexture();
}
}
diff --git a/libs/hwui/DeferredLayerUpdater.h b/libs/hwui/DeferredLayerUpdater.h
index 61efafe..38d8e4a 100644
--- a/libs/hwui/DeferredLayerUpdater.h
+++ b/libs/hwui/DeferredLayerUpdater.h
@@ -68,7 +68,7 @@
ANDROID_API void setTransform(const SkMatrix* matrix) {
delete mTransform;
- mTransform = matrix ? new SkMatrix(*matrix) : 0;
+ mTransform = matrix ? new SkMatrix(*matrix) : nullptr;
}
ANDROID_API void setPaint(const SkPaint* paint);
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 499c113..1b5af49 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -86,7 +86,7 @@
class StateOp : public DisplayListOp {
public:
virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ bool useQuickReject) override {
// default behavior only affects immediate, deferrable state, issue directly to renderer
applyState(deferStruct.mRenderer, saveCount);
}
@@ -96,7 +96,7 @@
* list to flush
*/
virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int level,
- bool useQuickReject) {
+ bool useQuickReject) override {
applyState(replayStruct.mRenderer, saveCount);
}
@@ -110,7 +110,7 @@
: mPaint(paint), mQuickRejected(false) {}
virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ bool useQuickReject) override {
if (mQuickRejected && CC_LIKELY(useQuickReject)) {
return;
}
@@ -119,7 +119,7 @@
}
virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int level,
- bool useQuickReject) {
+ bool useQuickReject) override {
if (mQuickRejected && CC_LIKELY(useQuickReject)) {
return;
}
@@ -245,7 +245,7 @@
// default empty constructor for bounds, to be overridden in child constructor body
DrawBoundedOp(const SkPaint* paint): DrawOp(paint) { }
- virtual bool getLocalBounds(Rect& localBounds) {
+ virtual bool getLocalBounds(Rect& localBounds) override {
localBounds.set(mLocalBounds);
OpenGLRenderer::TextShadow textShadow;
if (OpenGLRenderer::getTextShadow(mPaint, &textShadow)) {
@@ -272,20 +272,20 @@
: mFlags(flags) {}
virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ bool useQuickReject) override {
int newSaveCount = deferStruct.mRenderer.save(mFlags);
deferStruct.mDeferredList.addSave(deferStruct.mRenderer, this, newSaveCount);
}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.save(mFlags);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Save flags %x", mFlags);
}
- virtual const char* name() { return "Save"; }
+ virtual const char* name() override { return "Save"; }
int getFlags() const { return mFlags; }
private:
@@ -298,21 +298,21 @@
: mCount(count) {}
virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ bool useQuickReject) override {
deferStruct.mDeferredList.addRestoreToCount(deferStruct.mRenderer,
this, saveCount + mCount);
deferStruct.mRenderer.restoreToCount(saveCount + mCount);
}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.restoreToCount(saveCount + mCount);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Restore to count %d", mCount);
}
- virtual const char* name() { return "RestoreToCount"; }
+ virtual const char* name() override { return "RestoreToCount"; }
private:
int mCount;
@@ -324,7 +324,7 @@
: mArea(left, top, right, bottom)
, mPaint(&mCachedPaint)
, mFlags(flags)
- , mConvexMask(NULL) {
+ , mConvexMask(nullptr) {
mCachedPaint.setAlpha(alpha);
}
@@ -332,11 +332,11 @@
: mArea(left, top, right, bottom)
, mPaint(paint)
, mFlags(flags)
- , mConvexMask(NULL)
+ , mConvexMask(nullptr)
{}
virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ bool useQuickReject) override {
// NOTE: don't bother with actual saveLayer, instead issuing it at flush time
int newSaveCount = deferStruct.mRenderer.getSaveCount();
deferStruct.mDeferredList.addSaveLayer(deferStruct.mRenderer, this, newSaveCount);
@@ -347,17 +347,19 @@
mPaint, mFlags);
}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.saveLayer(mArea.left, mArea.top, mArea.right, mArea.bottom,
mPaint, mFlags, mConvexMask);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("SaveLayer%s of area " RECT_STRING,
(isSaveLayerAlpha() ? "Alpha" : ""),RECT_ARGS(mArea));
}
- virtual const char* name() { return isSaveLayerAlpha() ? "SaveLayerAlpha" : "SaveLayer"; }
+ virtual const char* name() override {
+ return isSaveLayerAlpha() ? "SaveLayerAlpha" : "SaveLayer";
+ }
int getFlags() { return mFlags; }
@@ -388,15 +390,15 @@
TranslateOp(float dx, float dy)
: mDx(dx), mDy(dy) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.translate(mDx, mDy);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Translate by %f %f", mDx, mDy);
}
- virtual const char* name() { return "Translate"; }
+ virtual const char* name() override { return "Translate"; }
private:
float mDx;
@@ -408,15 +410,15 @@
RotateOp(float degrees)
: mDegrees(degrees) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.rotate(mDegrees);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Rotate by %f degrees", mDegrees);
}
- virtual const char* name() { return "Rotate"; }
+ virtual const char* name() override { return "Rotate"; }
private:
float mDegrees;
@@ -427,15 +429,15 @@
ScaleOp(float sx, float sy)
: mSx(sx), mSy(sy) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.scale(mSx, mSy);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Scale by %f %f", mSx, mSy);
}
- virtual const char* name() { return "Scale"; }
+ virtual const char* name() override { return "Scale"; }
private:
float mSx;
@@ -447,15 +449,15 @@
SkewOp(float sx, float sy)
: mSx(sx), mSy(sy) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.skew(mSx, mSy);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Skew by %f %f", mSx, mSy);
}
- virtual const char* name() { return "Skew"; }
+ virtual const char* name() override { return "Skew"; }
private:
float mSx;
@@ -467,11 +469,11 @@
SetMatrixOp(const SkMatrix& matrix)
: mMatrix(matrix) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.setMatrix(mMatrix);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
if (mMatrix.isIdentity()) {
OP_LOGS("SetMatrix (reset)");
} else {
@@ -479,7 +481,7 @@
}
}
- virtual const char* name() { return "SetMatrix"; }
+ virtual const char* name() override { return "SetMatrix"; }
private:
const SkMatrix mMatrix;
@@ -490,15 +492,15 @@
ConcatMatrixOp(const SkMatrix& matrix)
: mMatrix(matrix) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.concatMatrix(mMatrix);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("ConcatMatrix " SK_MATRIX_STRING, SK_MATRIX_ARGS(&mMatrix));
}
- virtual const char* name() { return "ConcatMatrix"; }
+ virtual const char* name() override { return "ConcatMatrix"; }
private:
const SkMatrix mMatrix;
@@ -509,7 +511,7 @@
ClipOp(SkRegion::Op op) : mOp(op) {}
virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ bool useQuickReject) override {
// NOTE: must defer op BEFORE applying state, since it may read clip
deferStruct.mDeferredList.addClip(deferStruct.mRenderer, this);
@@ -532,18 +534,18 @@
ClipRectOp(float left, float top, float right, float bottom, SkRegion::Op op)
: ClipOp(op), mArea(left, top, right, bottom) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.clipRect(mArea.left, mArea.top, mArea.right, mArea.bottom, mOp);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("ClipRect " RECT_STRING, RECT_ARGS(mArea));
}
- virtual const char* name() { return "ClipRect"; }
+ virtual const char* name() override { return "ClipRect"; }
protected:
- virtual bool isRect() { return true; }
+ virtual bool isRect() override { return true; }
private:
Rect mArea;
@@ -554,17 +556,17 @@
ClipPathOp(const SkPath* path, SkRegion::Op op)
: ClipOp(op), mPath(path) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.clipPath(mPath, mOp);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
SkRect bounds = mPath->getBounds();
OP_LOG("ClipPath bounds " RECT_STRING,
bounds.left(), bounds.top(), bounds.right(), bounds.bottom());
}
- virtual const char* name() { return "ClipPath"; }
+ virtual const char* name() override { return "ClipPath"; }
private:
const SkPath* mPath;
@@ -575,17 +577,17 @@
ClipRegionOp(const SkRegion* region, SkRegion::Op op)
: ClipOp(op), mRegion(region) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int saveCount) const override {
renderer.clipRegion(mRegion, mOp);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
SkIRect bounds = mRegion->getBounds();
OP_LOG("ClipRegion bounds %d %d %d %d",
bounds.left(), bounds.top(), bounds.right(), bounds.bottom());
}
- virtual const char* name() { return "ClipRegion"; }
+ virtual const char* name() override { return "ClipRegion"; }
private:
const SkRegion* mRegion;
@@ -600,10 +602,10 @@
DrawBitmapOp(const SkBitmap* bitmap, const SkPaint* paint)
: DrawBoundedOp(0, 0, bitmap->width(), bitmap->height(), paint)
, mBitmap(bitmap)
- , mEntryValid(false), mEntry(NULL) {
+ , mEntryValid(false), mEntry(nullptr) {
}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawBitmap(mBitmap, mPaint);
}
@@ -625,7 +627,7 @@
* the current layer, if any.
*/
virtual void multiDraw(OpenGLRenderer& renderer, Rect& dirty,
- const Vector<OpStatePair>& ops, const Rect& bounds) {
+ const Vector<OpStatePair>& ops, const Rect& bounds) override {
const DeferredDisplayState& firstState = *(ops[0].state);
renderer.restoreDisplayState(firstState, true); // restore all but the clip
@@ -665,15 +667,15 @@
pureTranslate, bounds, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw bitmap %p at %f %f%s", mBitmap, mLocalBounds.left, mLocalBounds.top,
mEntry ? " using AssetAtlas" : "");
}
- virtual const char* name() { return "DrawBitmap"; }
+ virtual const char* name() override { return "DrawBitmap"; }
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Bitmap;
deferInfo.mergeId = getAtlasEntry(renderer) ?
(mergeid_t) mEntry->getMergeId() : (mergeid_t) mBitmap;
@@ -709,21 +711,21 @@
: DrawBoundedOp(dstLeft, dstTop, dstRight, dstBottom, paint),
mBitmap(bitmap), mSrc(srcLeft, srcTop, srcRight, srcBottom) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawBitmap(mBitmap, mSrc.left, mSrc.top, mSrc.right, mSrc.bottom,
mLocalBounds.left, mLocalBounds.top, mLocalBounds.right, mLocalBounds.bottom,
mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw bitmap %p src=" RECT_STRING ", dst=" RECT_STRING,
mBitmap, RECT_ARGS(mSrc), RECT_ARGS(mLocalBounds));
}
- virtual const char* name() { return "DrawBitmapRect"; }
+ virtual const char* name() override { return "DrawBitmapRect"; }
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Bitmap;
}
@@ -737,18 +739,18 @@
DrawBitmapDataOp(const SkBitmap* bitmap, const SkPaint* paint)
: DrawBitmapOp(bitmap, paint) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawBitmapData(mBitmap, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw bitmap %p", mBitmap);
}
- virtual const char* name() { return "DrawBitmapData"; }
+ virtual const char* name() override { return "DrawBitmapData"; }
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Bitmap;
}
};
@@ -761,19 +763,19 @@
mBitmap(bitmap), mMeshWidth(meshWidth), mMeshHeight(meshHeight),
mVertices(vertices), mColors(colors) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawBitmapMesh(mBitmap, mMeshWidth, mMeshHeight,
mVertices, mColors, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw bitmap %p mesh %d x %d", mBitmap, mMeshWidth, mMeshHeight);
}
- virtual const char* name() { return "DrawBitmapMesh"; }
+ virtual const char* name() override { return "DrawBitmapMesh"; }
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Bitmap;
}
@@ -790,8 +792,8 @@
DrawPatchOp(const SkBitmap* bitmap, const Res_png_9patch* patch,
float left, float top, float right, float bottom, const SkPaint* paint)
: DrawBoundedOp(left, top, right, bottom, paint),
- mBitmap(bitmap), mPatch(patch), mGenerationId(0), mMesh(NULL),
- mEntryValid(false), mEntry(NULL) {
+ mBitmap(bitmap), mPatch(patch), mGenerationId(0), mMesh(nullptr),
+ mEntryValid(false), mEntry(nullptr) {
};
AssetAtlas::Entry* getAtlasEntry(OpenGLRenderer& renderer) {
@@ -818,7 +820,7 @@
* is also responsible for dirtying the current layer, if any.
*/
virtual void multiDraw(OpenGLRenderer& renderer, Rect& dirty,
- const Vector<OpStatePair>& ops, const Rect& bounds) {
+ const Vector<OpStatePair>& ops, const Rect& bounds) override {
const DeferredDisplayState& firstState = *(ops[0].state);
renderer.restoreDisplayState(firstState, true); // restore all but the clip
@@ -891,7 +893,7 @@
&vertices[0], indexCount, mPaint);
}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
// We're not calling the public variant of drawPatch() here
// This method won't perform the quickReject() since we've already done it at this point
renderer.drawPatch(mBitmap, getMesh(renderer), getAtlasEntry(renderer),
@@ -899,15 +901,15 @@
mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw patch " RECT_STRING "%s", RECT_ARGS(mLocalBounds),
mEntry ? " with AssetAtlas" : "");
}
- virtual const char* name() { return "DrawPatch"; }
+ virtual const char* name() override { return "DrawPatch"; }
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Patch;
deferInfo.mergeId = getAtlasEntry(renderer) ? (mergeid_t) mEntry->getMergeId() : (mergeid_t) mBitmap;
deferInfo.mergeable = state.mMatrix.isPureTranslate() &&
@@ -929,17 +931,17 @@
class DrawColorOp : public DrawOp {
public:
DrawColorOp(int color, SkXfermode::Mode mode)
- : DrawOp(NULL), mColor(color), mMode(mode) {};
+ : DrawOp(nullptr), mColor(color), mMode(mode) {};
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawColor(mColor, mMode);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw color %#x, mode %d", mColor, mMode);
}
- virtual const char* name() { return "DrawColor"; }
+ virtual const char* name() override { return "DrawColor"; }
private:
int mColor;
@@ -953,7 +955,7 @@
DrawStrokableOp(const Rect& localBounds, const SkPaint* paint)
: DrawBoundedOp(localBounds, paint) {};
- virtual bool getLocalBounds(Rect& localBounds) {
+ virtual bool getLocalBounds(Rect& localBounds) override {
localBounds.set(mLocalBounds);
if (mPaint && mPaint->getStyle() != SkPaint::kFill_Style) {
localBounds.outset(strokeWidthOutset());
@@ -962,7 +964,7 @@
}
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
if (mPaint->getPathEffect()) {
deferInfo.batchId = DeferredDisplayList::kOpBatch_AlphaMaskTexture;
} else {
@@ -978,23 +980,23 @@
DrawRectOp(float left, float top, float right, float bottom, const SkPaint* paint)
: DrawStrokableOp(left, top, right, bottom, paint) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawRect(mLocalBounds.left, mLocalBounds.top,
mLocalBounds.right, mLocalBounds.bottom, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Rect " RECT_STRING, RECT_ARGS(mLocalBounds));
}
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
DrawStrokableOp::onDefer(renderer, deferInfo, state);
deferInfo.opaqueOverBounds = isOpaqueOverBounds(state) &&
mPaint->getStyle() == SkPaint::kFill_Style;
}
- virtual const char* name() { return "DrawRect"; }
+ virtual const char* name() override { return "DrawRect"; }
};
class DrawRectsOp : public DrawBoundedOp {
@@ -1003,18 +1005,18 @@
: DrawBoundedOp(rects, count, paint),
mRects(rects), mCount(count) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawRects(mRects, mCount, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Rects count %d", mCount);
}
- virtual const char* name() { return "DrawRects"; }
+ virtual const char* name() override { return "DrawRects"; }
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Vertices;
}
@@ -1029,17 +1031,17 @@
float rx, float ry, const SkPaint* paint)
: DrawStrokableOp(left, top, right, bottom, paint), mRx(rx), mRy(ry) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawRoundRect(mLocalBounds.left, mLocalBounds.top,
mLocalBounds.right, mLocalBounds.bottom, mRx, mRy, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw RoundRect " RECT_STRING ", rx %f, ry %f", RECT_ARGS(mLocalBounds), mRx, mRy);
}
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
DrawStrokableOp::onDefer(renderer, deferInfo, state);
if (!mPaint->getPathEffect()) {
renderer.getCaches().tessellationCache.precacheRoundRect(state.mMatrix, *mPaint,
@@ -1047,7 +1049,7 @@
}
}
- virtual const char* name() { return "DrawRoundRect"; }
+ virtual const char* name() override { return "DrawRoundRect"; }
private:
float mRx;
@@ -1061,17 +1063,17 @@
: DrawOp(paint), mLeft(left), mTop(top), mRight(right), mBottom(bottom),
mRx(rx), mRy(ry) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawRoundRect(*mLeft, *mTop, *mRight, *mBottom,
*mRx, *mRy, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw RoundRect Props " RECT_STRING ", rx %f, ry %f",
*mLeft, *mTop, *mRight, *mBottom, *mRx, *mRy);
}
- virtual const char* name() { return "DrawRoundRectProps"; }
+ virtual const char* name() override { return "DrawRoundRectProps"; }
private:
float* mLeft;
@@ -1088,15 +1090,15 @@
: DrawStrokableOp(x - radius, y - radius, x + radius, y + radius, paint),
mX(x), mY(y), mRadius(radius) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawCircle(mX, mY, mRadius, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Circle x %f, y %f, r %f", mX, mY, mRadius);
}
- virtual const char* name() { return "DrawCircle"; }
+ virtual const char* name() override { return "DrawCircle"; }
private:
float mX;
@@ -1109,15 +1111,15 @@
DrawCirclePropsOp(float* x, float* y, float* radius, const SkPaint* paint)
: DrawOp(paint), mX(x), mY(y), mRadius(radius) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawCircle(*mX, *mY, *mRadius, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Circle Props x %p, y %p, r %p", mX, mY, mRadius);
}
- virtual const char* name() { return "DrawCircleProps"; }
+ virtual const char* name() override { return "DrawCircleProps"; }
private:
float* mX;
@@ -1130,16 +1132,16 @@
DrawOvalOp(float left, float top, float right, float bottom, const SkPaint* paint)
: DrawStrokableOp(left, top, right, bottom, paint) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawOval(mLocalBounds.left, mLocalBounds.top,
mLocalBounds.right, mLocalBounds.bottom, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Oval " RECT_STRING, RECT_ARGS(mLocalBounds));
}
- virtual const char* name() { return "DrawOval"; }
+ virtual const char* name() override { return "DrawOval"; }
};
class DrawArcOp : public DrawStrokableOp {
@@ -1149,18 +1151,18 @@
: DrawStrokableOp(left, top, right, bottom, paint),
mStartAngle(startAngle), mSweepAngle(sweepAngle), mUseCenter(useCenter) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawArc(mLocalBounds.left, mLocalBounds.top,
mLocalBounds.right, mLocalBounds.bottom,
mStartAngle, mSweepAngle, mUseCenter, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Arc " RECT_STRING ", start %f, sweep %f, useCenter %d",
RECT_ARGS(mLocalBounds), mStartAngle, mSweepAngle, mUseCenter);
}
- virtual const char* name() { return "DrawArc"; }
+ virtual const char* name() override { return "DrawArc"; }
private:
float mStartAngle;
@@ -1180,22 +1182,22 @@
mLocalBounds.set(left, top, left + width, top + height);
}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawPath(mPath, mPaint);
}
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
renderer.getCaches().pathCache.precache(mPath, mPaint);
deferInfo.batchId = DeferredDisplayList::kOpBatch_AlphaMaskTexture;
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Path %p in " RECT_STRING, mPath, RECT_ARGS(mLocalBounds));
}
- virtual const char* name() { return "DrawPath"; }
+ virtual const char* name() override { return "DrawPath"; }
private:
const SkPath* mPath;
@@ -1209,18 +1211,18 @@
mLocalBounds.outset(strokeWidthOutset());
}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawLines(mPoints, mCount, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Lines count %d", mCount);
}
- virtual const char* name() { return "DrawLines"; }
+ virtual const char* name() override { return "DrawLines"; }
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
deferInfo.batchId = mPaint->isAntiAlias() ?
DeferredDisplayList::kOpBatch_AlphaVertices :
DeferredDisplayList::kOpBatch_Vertices;
@@ -1236,15 +1238,15 @@
DrawPointsOp(const float* points, int count, const SkPaint* paint)
: DrawLinesOp(points, count, paint) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawPoints(mPoints, mCount, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Points count %d", mCount);
}
- virtual const char* name() { return "DrawPoints"; }
+ virtual const char* name() override { return "DrawPoints"; }
};
class DrawSomeTextOp : public DrawOp {
@@ -1252,16 +1254,16 @@
DrawSomeTextOp(const char* text, int bytesCount, int count, const SkPaint* paint)
: DrawOp(paint), mText(text), mBytesCount(bytesCount), mCount(count) {};
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw some text, %d bytes", mBytesCount);
}
- virtual bool hasTextShadow() const {
+ virtual bool hasTextShadow() const override {
return OpenGLRenderer::hasTextShadow(mPaint);
}
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
FontRenderer& fontRenderer = renderer.getCaches().fontRenderer->getFontRenderer(mPaint);
fontRenderer.precache(mPaint, mText, mCount, SkMatrix::I());
@@ -1285,12 +1287,12 @@
/* TODO: inherit from DrawBounded and init mLocalBounds */
}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawTextOnPath(mText, mBytesCount, mCount, mPath,
mHOffset, mVOffset, mPaint);
}
- virtual const char* name() { return "DrawTextOnPath"; }
+ virtual const char* name() override { return "DrawTextOnPath"; }
private:
const SkPath* mPath;
@@ -1306,11 +1308,11 @@
/* TODO: inherit from DrawBounded and init mLocalBounds */
}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawPosText(mText, mBytesCount, mCount, mPositions, mPaint);
}
- virtual const char* name() { return "DrawPosText"; }
+ virtual const char* name() override { return "DrawPosText"; }
private:
const float* mPositions;
@@ -1326,7 +1328,7 @@
}
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
FontRenderer& fontRenderer = renderer.getCaches().fontRenderer->getFontRenderer(mPaint);
SkMatrix transform;
renderer.findBestFontTransform(state.mMatrix, &transform);
@@ -1349,7 +1351,7 @@
&& OpenGLRenderer::getXfermodeDirect(mPaint) == SkXfermode::kSrcOver_Mode;
}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
Rect bounds;
getLocalBounds(bounds);
renderer.drawText(mText, mBytesCount, mCount, mX, mY,
@@ -1357,7 +1359,7 @@
}
virtual void multiDraw(OpenGLRenderer& renderer, Rect& dirty,
- const Vector<OpStatePair>& ops, const Rect& bounds) {
+ const Vector<OpStatePair>& ops, const Rect& bounds) override {
for (unsigned int i = 0; i < ops.size(); i++) {
const DeferredDisplayState& state = *(ops[i].state);
DrawOpMode drawOpMode = (i == ops.size() - 1) ? kDrawOpMode_Flush : kDrawOpMode_Defer;
@@ -1372,11 +1374,11 @@
}
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Text of count %d, bytes %d", mCount, mBytesCount);
}
- virtual const char* name() { return "DrawText"; }
+ virtual const char* name() override { return "DrawText"; }
private:
const char* mText;
@@ -1396,19 +1398,19 @@
class DrawFunctorOp : public DrawOp {
public:
DrawFunctorOp(Functor* functor)
- : DrawOp(NULL), mFunctor(functor) {}
+ : DrawOp(nullptr), mFunctor(functor) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.startMark("GL functor");
renderer.callDrawGLFunction(mFunctor, dirty);
renderer.endMark();
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Functor %p", mFunctor);
}
- virtual const char* name() { return "DrawFunctor"; }
+ virtual const char* name() override { return "DrawFunctor"; }
private:
Functor* mFunctor;
@@ -1419,35 +1421,35 @@
friend class DisplayListData; // grant DisplayListData access to info of child
public:
DrawRenderNodeOp(RenderNode* renderNode, int flags, const mat4& transformFromParent)
- : DrawBoundedOp(0, 0, renderNode->getWidth(), renderNode->getHeight(), 0),
+ : DrawBoundedOp(0, 0, renderNode->getWidth(), renderNode->getHeight(), nullptr),
mRenderNode(renderNode), mFlags(flags), mTransformFromParent(transformFromParent) {}
virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ bool useQuickReject) override {
if (mRenderNode->isRenderable() && !mSkipInOrderDraw) {
mRenderNode->defer(deferStruct, level + 1);
}
}
virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int level,
- bool useQuickReject) {
+ bool useQuickReject) override {
if (mRenderNode->isRenderable() && !mSkipInOrderDraw) {
mRenderNode->replay(replayStruct, level + 1);
}
}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
LOG_ALWAYS_FATAL("should not be called, because replay() is overridden");
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw RenderNode %p %s, flags %#x", mRenderNode, mRenderNode->getName(), mFlags);
if (mRenderNode && (logFlags & kOpLogFlag_Recurse)) {
mRenderNode->output(level + 1);
}
}
- virtual const char* name() { return "DrawRenderNode"; }
+ virtual const char* name() override { return "DrawRenderNode"; }
RenderNode* renderNode() { return mRenderNode; }
@@ -1482,7 +1484,7 @@
public:
DrawShadowOp(const mat4& transformXY, const mat4& transformZ,
float casterAlpha, const SkPath* casterOutline)
- : DrawOp(NULL)
+ : DrawOp(nullptr)
, mTransformXY(transformXY)
, mTransformZ(transformZ)
, mCasterAlpha(casterAlpha)
@@ -1490,13 +1492,13 @@
}
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& state) override {
renderer.getCaches().tessellationCache.precacheShadows(&state.mMatrix,
renderer.getLocalClipBounds(), isCasterOpaque(), mCasterOutline,
&mTransformXY, &mTransformZ, renderer.getLightCenter(), renderer.getLightRadius());
}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
TessellationCache::vertexBuffer_pair_t buffers;
Matrix4 drawTransform(*(renderer.currentTransform()));
renderer.getCaches().tessellationCache.getShadowBuffers(&drawTransform,
@@ -1507,11 +1509,11 @@
renderer.drawShadow(mCasterAlpha, buffers.first, buffers.second);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOGS("DrawShadow");
}
- virtual const char* name() { return "DrawShadow"; }
+ virtual const char* name() override { return "DrawShadow"; }
private:
bool isCasterOpaque() { return mCasterAlpha >= 1.0f; }
@@ -1525,17 +1527,17 @@
class DrawLayerOp : public DrawOp {
public:
DrawLayerOp(Layer* layer, float x, float y)
- : DrawOp(NULL), mLayer(layer), mX(x), mY(y) {}
+ : DrawOp(nullptr), mLayer(layer), mX(x), mY(y) {}
- virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
renderer.drawLayer(mLayer, mX, mY);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t logFlags) const override {
OP_LOG("Draw Layer %p at %f %f", mLayer, mX, mY);
}
- virtual const char* name() { return "DrawLayer"; }
+ virtual const char* name() override { return "DrawLayer"; }
private:
Layer* mLayer;
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 5a13293..ca21e4e 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -36,7 +36,7 @@
DisplayListRenderer::DisplayListRenderer()
: mState(*this)
, mResourceCache(ResourceCache::getInstance())
- , mDisplayListData(NULL)
+ , mDisplayListData(nullptr)
, mTranslateX(0.0f)
, mTranslateY(0.0f)
, mHasDeferredTranslate(false)
@@ -59,7 +59,7 @@
mRegionMap.clear();
mPathMap.clear();
DisplayListData* data = mDisplayListData;
- mDisplayListData = 0;
+ mDisplayListData = nullptr;
return data;
}
@@ -401,12 +401,12 @@
static void simplifyPaint(int color, SkPaint* paint) {
paint->setColor(color);
- paint->setShader(NULL);
- paint->setColorFilter(NULL);
- paint->setLooper(NULL);
+ paint->setShader(nullptr);
+ paint->setColorFilter(nullptr);
+ paint->setLooper(nullptr);
paint->setStrokeWidth(4 + 0.04 * paint->getTextSize());
paint->setStrokeJoin(SkPaint::kRound_Join);
- paint->setLooper(NULL);
+ paint->setLooper(nullptr);
}
void DisplayListRenderer::drawText(const uint16_t* glyphs, const float* positions,
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index a798329..01fcdd3 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -140,109 +140,109 @@
// ----------------------------------------------------------------------------
// android/graphics/Canvas interface
// ----------------------------------------------------------------------------
- virtual SkCanvas* getSkCanvas() {
+ virtual SkCanvas* getSkCanvas() override {
LOG_ALWAYS_FATAL("DisplayListRenderer has no SkCanvas");
- return NULL;
+ return nullptr;
}
- virtual void setBitmap(SkBitmap* bitmap, bool copyState) {
+ virtual void setBitmap(SkBitmap* bitmap, bool copyState) override {
LOG_ALWAYS_FATAL("DisplayListRenderer is not backed by a bitmap.");
}
- virtual bool isOpaque() { return false; }
- virtual int width() { return mState.getWidth(); }
- virtual int height() { return mState.getHeight(); }
+ virtual bool isOpaque() override { return false; }
+ virtual int width() override { return mState.getWidth(); }
+ virtual int height() override { return mState.getHeight(); }
// ----------------------------------------------------------------------------
// android/graphics/Canvas state operations
// ----------------------------------------------------------------------------
// Save (layer)
- virtual int getSaveCount() const { return mState.getSaveCount(); }
- virtual int save(SkCanvas::SaveFlags flags);
- virtual void restore();
- virtual void restoreToCount(int saveCount);
+ virtual int getSaveCount() const override { return mState.getSaveCount(); }
+ virtual int save(SkCanvas::SaveFlags flags) override;
+ virtual void restore() override;
+ virtual void restoreToCount(int saveCount) override;
virtual int saveLayer(float left, float top, float right, float bottom, const SkPaint* paint,
- SkCanvas::SaveFlags flags);
+ SkCanvas::SaveFlags flags) override;
virtual int saveLayerAlpha(float left, float top, float right, float bottom,
- int alpha, SkCanvas::SaveFlags flags) {
+ int alpha, SkCanvas::SaveFlags flags) override {
SkPaint paint;
paint.setAlpha(alpha);
return saveLayer(left, top, right, bottom, &paint, flags);
}
// Matrix
- virtual void getMatrix(SkMatrix* outMatrix) const { mState.getMatrix(outMatrix); }
- virtual void setMatrix(const SkMatrix& matrix);
+ virtual void getMatrix(SkMatrix* outMatrix) const override { mState.getMatrix(outMatrix); }
+ virtual void setMatrix(const SkMatrix& matrix) override;
- virtual void concat(const SkMatrix& matrix);
- virtual void rotate(float degrees);
- virtual void scale(float sx, float sy);
- virtual void skew(float sx, float sy);
- virtual void translate(float dx, float dy);
+ virtual void concat(const SkMatrix& matrix) override;
+ virtual void rotate(float degrees) override;
+ virtual void scale(float sx, float sy) override;
+ virtual void skew(float sx, float sy) override;
+ virtual void translate(float dx, float dy) override;
// Clip
- virtual bool getClipBounds(SkRect* outRect) const;
- virtual bool quickRejectRect(float left, float top, float right, float bottom) const;
- virtual bool quickRejectPath(const SkPath& path) const;
+ virtual bool getClipBounds(SkRect* outRect) const override;
+ virtual bool quickRejectRect(float left, float top, float right, float bottom) const override;
+ virtual bool quickRejectPath(const SkPath& path) const override;
- virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
- virtual bool clipPath(const SkPath* path, SkRegion::Op op);
- virtual bool clipRegion(const SkRegion* region, SkRegion::Op op);
+ virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op) override;
+ virtual bool clipPath(const SkPath* path, SkRegion::Op op) override;
+ virtual bool clipRegion(const SkRegion* region, SkRegion::Op op) override;
// Misc
- virtual SkDrawFilter* getDrawFilter() { return mDrawFilter.get(); }
- virtual void setDrawFilter(SkDrawFilter* filter);
+ virtual SkDrawFilter* getDrawFilter() override { return mDrawFilter.get(); }
+ virtual void setDrawFilter(SkDrawFilter* filter) override;
// ----------------------------------------------------------------------------
// android/graphics/Canvas draw operations
// ----------------------------------------------------------------------------
- virtual void drawColor(int color, SkXfermode::Mode mode);
- virtual void drawPaint(const SkPaint& paint);
+ virtual void drawColor(int color, SkXfermode::Mode mode) override;
+ virtual void drawPaint(const SkPaint& paint) override;
// Geometry
- virtual void drawPoint(float x, float y, const SkPaint& paint) {
+ virtual void drawPoint(float x, float y, const SkPaint& paint) override {
float points[2] = { x, y };
drawPoints(points, 2, paint);
}
- virtual void drawPoints(const float* points, int count, const SkPaint& paint);
+ virtual void drawPoints(const float* points, int count, const SkPaint& paint) override;
virtual void drawLine(float startX, float startY, float stopX, float stopY,
- const SkPaint& paint) {
+ const SkPaint& paint) override {
float points[4] = { startX, startY, stopX, stopY };
drawLines(points, 4, paint);
}
- virtual void drawLines(const float* points, int count, const SkPaint& paint);
- virtual void drawRect(float left, float top, float right, float bottom, const SkPaint& paint);
+ virtual void drawLines(const float* points, int count, const SkPaint& paint) override;
+ virtual void drawRect(float left, float top, float right, float bottom, const SkPaint& paint) override;
virtual void drawRoundRect(float left, float top, float right, float bottom,
- float rx, float ry, const SkPaint& paint);
- virtual void drawCircle(float x, float y, float radius, const SkPaint& paint);
- virtual void drawOval(float left, float top, float right, float bottom, const SkPaint& paint);
+ float rx, float ry, const SkPaint& paint) override;
+ virtual void drawCircle(float x, float y, float radius, const SkPaint& paint) override;
+ virtual void drawOval(float left, float top, float right, float bottom, const SkPaint& paint) override;
virtual void drawArc(float left, float top, float right, float bottom,
- float startAngle, float sweepAngle, bool useCenter, const SkPaint& paint);
- virtual void drawPath(const SkPath& path, const SkPaint& paint);
+ float startAngle, float sweepAngle, bool useCenter, const SkPaint& paint) override;
+ virtual void drawPath(const SkPath& path, const SkPaint& paint) override;
virtual void drawVertices(SkCanvas::VertexMode vertexMode, int vertexCount,
const float* verts, const float* tex, const int* colors,
- const uint16_t* indices, int indexCount, const SkPaint& paint)
+ const uint16_t* indices, int indexCount, const SkPaint& paint) override
{ LOG_ALWAYS_FATAL("DisplayListRenderer does not support drawVertices()"); }
// Bitmap-based
- virtual void drawBitmap(const SkBitmap& bitmap, float left, float top, const SkPaint* paint);
+ virtual void drawBitmap(const SkBitmap& bitmap, float left, float top, const SkPaint* paint) override;
virtual void drawBitmap(const SkBitmap& bitmap, const SkMatrix& matrix,
- const SkPaint* paint);
+ const SkPaint* paint) override;
virtual void drawBitmap(const SkBitmap& bitmap, float srcLeft, float srcTop,
float srcRight, float srcBottom, float dstLeft, float dstTop,
- float dstRight, float dstBottom, const SkPaint* paint);
+ float dstRight, float dstBottom, const SkPaint* paint) override;
virtual void drawBitmapMesh(const SkBitmap& bitmap, int meshWidth, int meshHeight,
- const float* vertices, const int* colors, const SkPaint* paint);
+ const float* vertices, const int* colors, const SkPaint* paint) override;
// Text
virtual void drawText(const uint16_t* glyphs, const float* positions, int count,
const SkPaint& paint, float x, float y, float boundsLeft, float boundsTop,
- float boundsRight, float boundsBottom, float totalAdvance);
+ float boundsRight, float boundsBottom, float totalAdvance) override;
virtual void drawPosText(const uint16_t* text, const float* positions, int count,
- int posCount, const SkPaint& paint);
+ int posCount, const SkPaint& paint) override;
virtual void drawTextOnPath(const uint16_t* glyphs, int count, const SkPath& path,
- float hOffset, float vOffset, const SkPaint& paint);
- virtual bool drawTextAbsolutePos() const { return false; }
+ float hOffset, float vOffset, const SkPaint& paint) override;
+ virtual bool drawTextAbsolutePos() const override { return false; }
private:
diff --git a/libs/hwui/Dither.cpp b/libs/hwui/Dither.cpp
index 77006a4..12d9389 100644
--- a/libs/hwui/Dither.cpp
+++ b/libs/hwui/Dither.cpp
@@ -24,7 +24,7 @@
// Lifecycle
///////////////////////////////////////////////////////////////////////////////
-Dither::Dither(): mCaches(NULL), mInitialized(false), mDitherTexture(0) {
+Dither::Dither(): mCaches(nullptr), mInitialized(false), mDitherTexture(0) {
}
void Dither::bindDitherTexture() {
diff --git a/libs/hwui/DrawProfiler.cpp b/libs/hwui/DrawProfiler.cpp
index e590642..ecde5ff 100644
--- a/libs/hwui/DrawProfiler.cpp
+++ b/libs/hwui/DrawProfiler.cpp
@@ -59,7 +59,7 @@
DrawProfiler::DrawProfiler()
: mType(kNone)
, mDensity(0)
- , mData(NULL)
+ , mData(nullptr)
, mDataSize(0)
, mCurrentFrame(-1)
, mPreviousTime(0)
@@ -160,7 +160,7 @@
void DrawProfiler::destroyData() {
delete mData;
- mData = NULL;
+ mData = nullptr;
}
void DrawProfiler::addRect(Rect& r, float data, float* shapeOutput) {
diff --git a/libs/hwui/Extensions.cpp b/libs/hwui/Extensions.cpp
index 84e7e65..8352c3f 100644
--- a/libs/hwui/Extensions.cpp
+++ b/libs/hwui/Extensions.cpp
@@ -66,7 +66,7 @@
findExtensions(eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS), mEglExtensionList);
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_DEBUG_NV_PROFILING, property, NULL) > 0) {
+ if (property_get(PROPERTY_DEBUG_NV_PROFILING, property, nullptr) > 0) {
mHasNvSystemTime = !strcmp(property, "true") && hasEglExtension("EGL_NV_system_time");
} else {
mHasNvSystemTime = false;
diff --git a/libs/hwui/FboCache.cpp b/libs/hwui/FboCache.cpp
index beef7be..b54d532 100644
--- a/libs/hwui/FboCache.cpp
+++ b/libs/hwui/FboCache.cpp
@@ -31,7 +31,7 @@
FboCache::FboCache(): mMaxSize(DEFAULT_FBO_CACHE_SIZE) {
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_FBO_CACHE_SIZE, property, NULL) > 0) {
+ if (property_get(PROPERTY_FBO_CACHE_SIZE, property, nullptr) > 0) {
INIT_LOGD(" Setting fbo cache size to %s", property);
mMaxSize = atoi(property);
} else {
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index 693afcd..a0bc7b0 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -104,10 +104,10 @@
INIT_LOGD("Creating FontRenderer");
}
- mGammaTable = NULL;
+ mGammaTable = nullptr;
mInitialized = false;
- mCurrentCacheTexture = NULL;
+ mCurrentCacheTexture = nullptr;
mLinearFiltering = false;
@@ -117,19 +117,19 @@
mLargeCacheHeight = DEFAULT_TEXT_LARGE_CACHE_HEIGHT;
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_TEXT_SMALL_CACHE_WIDTH, property, NULL) > 0) {
+ if (property_get(PROPERTY_TEXT_SMALL_CACHE_WIDTH, property, nullptr) > 0) {
mSmallCacheWidth = atoi(property);
}
- if (property_get(PROPERTY_TEXT_SMALL_CACHE_HEIGHT, property, NULL) > 0) {
+ if (property_get(PROPERTY_TEXT_SMALL_CACHE_HEIGHT, property, nullptr) > 0) {
mSmallCacheHeight = atoi(property);
}
- if (property_get(PROPERTY_TEXT_LARGE_CACHE_WIDTH, property, NULL) > 0) {
+ if (property_get(PROPERTY_TEXT_LARGE_CACHE_WIDTH, property, nullptr) > 0) {
mLargeCacheWidth = atoi(property);
}
- if (property_get(PROPERTY_TEXT_LARGE_CACHE_HEIGHT, property, NULL) > 0) {
+ if (property_get(PROPERTY_TEXT_LARGE_CACHE_HEIGHT, property, nullptr) > 0) {
mLargeCacheHeight = atoi(property);
}
@@ -213,7 +213,7 @@
}
}
// Could not fit glyph into current cache textures
- return NULL;
+ return nullptr;
}
void FontRenderer::cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyph,
@@ -224,7 +224,7 @@
// so we can avoid doing extra work later on
if (glyph.fWidth == 0 || glyph.fHeight == 0) {
cachedGlyph->mIsValid = true;
- cachedGlyph->mCacheTexture = NULL;
+ cachedGlyph->mCacheTexture = nullptr;
return;
}
@@ -232,7 +232,7 @@
// choose an appropriate cache texture list for this glyph format
SkMask::Format format = static_cast<SkMask::Format>(glyph.fMaskFormat);
- Vector<CacheTexture*>* cacheTextures = NULL;
+ Vector<CacheTexture*>* cacheTextures = nullptr;
switch (format) {
case SkMask::kA8_Format:
case SkMask::kBW_Format:
@@ -598,7 +598,7 @@
DropShadow image;
image.width = 0;
image.height = 0;
- image.image = NULL;
+ image.image = nullptr;
image.penX = 0;
image.penY = 0;
@@ -607,8 +607,8 @@
}
mDrawn = false;
- mClip = NULL;
- mBounds = NULL;
+ mClip = nullptr;
+ mBounds = nullptr;
Rect bounds;
mCurrentFont->measure(paint, text, startIndex, len, numGlyphs, &bounds, positions);
@@ -644,7 +644,7 @@
// NOTE: bounds.isEmpty() can't be used here, since vertical coordinates are inverted
// TODO: don't draw pure whitespace in the first place, and avoid needing this check
mCurrentFont->render(paint, text, startIndex, len, numGlyphs, penX, penY,
- Font::BITMAP, dataBuffer, paddedWidth, paddedHeight, NULL, positions);
+ Font::BITMAP, dataBuffer, paddedWidth, paddedHeight, nullptr, positions);
// Unbind any PBO we might have used
Caches::getInstance().unbindPixelBuffer();
@@ -671,8 +671,8 @@
}
void FontRenderer::finishRender() {
- mBounds = NULL;
- mClip = NULL;
+ mBounds = nullptr;
+ mClip = nullptr;
issueDrawCommand();
}
@@ -724,7 +724,7 @@
mActiveFonts.remove(font->getDescription());
if (mCurrentFont == font) {
- mCurrentFont = NULL;
+ mCurrentFont = nullptr;
}
}
@@ -734,7 +734,7 @@
if (width * height * intRadius >= RS_MIN_INPUT_CUTOFF) {
uint8_t* outImage = (uint8_t*) memalign(RS_CPU_ALLOCATION_ALIGNMENT, width * height);
- if (mRs == 0) {
+ if (mRs == nullptr) {
mRs = new RSC::RS();
// a null path is OK because there are no custom kernels used
// hence nothing gets cached by RS
@@ -746,7 +746,7 @@
mRsScript = RSC::ScriptIntrinsicBlur::create(mRs, mRsElement);
}
}
- if (mRs != 0) {
+ if (mRs != nullptr) {
RSC::sp<const RSC::Type> t = RSC::Type::create(mRs, mRsElement, width, height, 0);
RSC::sp<RSC::Allocation> ain = RSC::Allocation::createTyped(mRs, t,
RS_ALLOCATION_MIPMAP_NONE,
diff --git a/libs/hwui/GammaFontRenderer.cpp b/libs/hwui/GammaFontRenderer.cpp
index 0a98c29..e97a477 100644
--- a/libs/hwui/GammaFontRenderer.cpp
+++ b/libs/hwui/GammaFontRenderer.cpp
@@ -61,7 +61,7 @@
// Get the gamma
mGamma = DEFAULT_TEXT_GAMMA;
- if (property_get(PROPERTY_TEXT_GAMMA, property, NULL) > 0) {
+ if (property_get(PROPERTY_TEXT_GAMMA, property, nullptr) > 0) {
INIT_LOGD(" Setting text gamma to %s", property);
mGamma = atof(property);
} else {
@@ -70,7 +70,7 @@
// Get the black gamma threshold
mBlackThreshold = DEFAULT_TEXT_BLACK_GAMMA_THRESHOLD;
- if (property_get(PROPERTY_TEXT_BLACK_GAMMA_THRESHOLD, property, NULL) > 0) {
+ if (property_get(PROPERTY_TEXT_BLACK_GAMMA_THRESHOLD, property, nullptr) > 0) {
INIT_LOGD(" Setting text black gamma threshold to %s", property);
mBlackThreshold = atoi(property);
} else {
@@ -80,7 +80,7 @@
// Get the white gamma threshold
mWhiteThreshold = DEFAULT_TEXT_WHITE_GAMMA_THRESHOLD;
- if (property_get(PROPERTY_TEXT_WHITE_GAMMA_THRESHOLD, property, NULL) > 0) {
+ if (property_get(PROPERTY_TEXT_WHITE_GAMMA_THRESHOLD, property, nullptr) > 0) {
INIT_LOGD(" Setting text white gamma threshold to %s", property);
mWhiteThreshold = atoi(property);
} else {
@@ -98,13 +98,13 @@
ShaderGammaFontRenderer::ShaderGammaFontRenderer(bool multiGamma): GammaFontRenderer() {
INIT_LOGD("Creating shader gamma font renderer");
- mRenderer = NULL;
+ mRenderer = nullptr;
mMultiGamma = multiGamma;
}
void ShaderGammaFontRenderer::describe(ProgramDescription& description,
const SkPaint* paint) const {
- if (paint->getShader() == NULL) {
+ if (paint->getShader() == nullptr) {
if (mMultiGamma) {
const int l = luminance(paint);
@@ -149,7 +149,7 @@
mGammaTable[i] = uint8_t((float)::floor(pow(i / 255.0f, gamma) * 255.0f + 0.5f));
}
- mRenderer = NULL;
+ mRenderer = nullptr;
}
void LookupGammaFontRenderer::endPrecaching() {
@@ -234,7 +234,7 @@
}
FontRenderer& Lookup3GammaFontRenderer::getFontRenderer(const SkPaint* paint) {
- if (paint->getShader() == NULL) {
+ if (paint->getShader() == nullptr) {
const int l = luminance(paint);
if (l <= mBlackThreshold) {
diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp
index 06d234c..0987d9b 100644
--- a/libs/hwui/GradientCache.cpp
+++ b/libs/hwui/GradientCache.cpp
@@ -66,7 +66,7 @@
mCache(LruCache<GradientCacheEntry, Texture*>::kUnlimitedCapacity),
mSize(0), mMaxSize(MB(DEFAULT_GRADIENT_CACHE_SIZE)) {
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_GRADIENT_CACHE_SIZE, property, NULL) > 0) {
+ if (property_get(PROPERTY_GRADIENT_CACHE_SIZE, property, nullptr) > 0) {
INIT_LOGD(" Setting gradient cache size to %sMB", property);
setMaxSize(MB(atof(property)));
} else {
diff --git a/libs/hwui/Interpolator.h b/libs/hwui/Interpolator.h
index e636e11..66ce119 100644
--- a/libs/hwui/Interpolator.h
+++ b/libs/hwui/Interpolator.h
@@ -38,13 +38,13 @@
class ANDROID_API AccelerateDecelerateInterpolator : public Interpolator {
public:
- virtual float interpolate(float input);
+ virtual float interpolate(float input) override;
};
class ANDROID_API AccelerateInterpolator : public Interpolator {
public:
AccelerateInterpolator(float factor) : mFactor(factor), mDoubleFactor(factor*2) {}
- virtual float interpolate(float input);
+ virtual float interpolate(float input) override;
private:
const float mFactor;
const float mDoubleFactor;
@@ -53,7 +53,7 @@
class ANDROID_API AnticipateInterpolator : public Interpolator {
public:
AnticipateInterpolator(float tension) : mTension(tension) {}
- virtual float interpolate(float input);
+ virtual float interpolate(float input) override;
private:
const float mTension;
};
@@ -61,20 +61,20 @@
class ANDROID_API AnticipateOvershootInterpolator : public Interpolator {
public:
AnticipateOvershootInterpolator(float tension) : mTension(tension) {}
- virtual float interpolate(float input);
+ virtual float interpolate(float input) override;
private:
const float mTension;
};
class ANDROID_API BounceInterpolator : public Interpolator {
public:
- virtual float interpolate(float input);
+ virtual float interpolate(float input) override;
};
class ANDROID_API CycleInterpolator : public Interpolator {
public:
CycleInterpolator(float cycles) : mCycles(cycles) {}
- virtual float interpolate(float input);
+ virtual float interpolate(float input) override;
private:
const float mCycles;
};
@@ -82,20 +82,20 @@
class ANDROID_API DecelerateInterpolator : public Interpolator {
public:
DecelerateInterpolator(float factor) : mFactor(factor) {}
- virtual float interpolate(float input);
+ virtual float interpolate(float input) override;
private:
const float mFactor;
};
class ANDROID_API LinearInterpolator : public Interpolator {
public:
- virtual float interpolate(float input) { return input; }
+ virtual float interpolate(float input) override { return input; }
};
class ANDROID_API OvershootInterpolator : public Interpolator {
public:
OvershootInterpolator(float tension) : mTension(tension) {}
- virtual float interpolate(float input);
+ virtual float interpolate(float input) override;
private:
const float mTension;
};
@@ -105,7 +105,7 @@
LUTInterpolator(float* values, size_t size);
~LUTInterpolator();
- virtual float interpolate(float input);
+ virtual float interpolate(float input) override;
private:
std::unique_ptr<float[]> mValues;
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp
index 8e77c5c..7388e3c 100644
--- a/libs/hwui/Layer.cpp
+++ b/libs/hwui/Layer.cpp
@@ -44,23 +44,23 @@
, type(layerType) {
// TODO: This is a violation of Android's typical ref counting, but it
// preserves the old inc/dec ref locations. This should be changed...
- incStrong(0);
- mesh = NULL;
+ incStrong(nullptr);
+ mesh = nullptr;
meshElementCount = 0;
cacheable = true;
dirty = false;
renderTarget = GL_TEXTURE_2D;
texture.width = layerWidth;
texture.height = layerHeight;
- colorFilter = NULL;
+ colorFilter = nullptr;
deferredUpdateScheduled = false;
- renderNode = NULL;
+ renderNode = nullptr;
fbo = 0;
- stencil = NULL;
+ stencil = nullptr;
debugDrawUpdate = false;
hasDrawnSinceUpdate = false;
forceFilter = false;
- convexMask = NULL;
+ convexMask = nullptr;
rendererLightPosDirty = true;
wasBuildLayered = false;
renderState.registerLayer(this);
@@ -156,7 +156,7 @@
renderState.bindFramebuffer(previousFbo);
caches.renderBufferCache.put(stencil);
- stencil = NULL;
+ stencil = nullptr;
}
if (fbo) {
@@ -177,7 +177,7 @@
void Layer::setPaint(const SkPaint* paint) {
OpenGLRenderer::getAlphaAndModeDirect(paint, &alpha, &mode);
- setColorFilter((paint) ? paint->getColorFilter() : NULL);
+ setColorFilter((paint) ? paint->getColorFilter() : nullptr);
}
void Layer::setColorFilter(SkColorFilter* filter) {
@@ -221,7 +221,7 @@
if (texture.id) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glTexImage2D(renderTarget, 0, GL_RGBA, getWidth(), getHeight(), 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
}
}
@@ -253,7 +253,7 @@
}
void Layer::cancelDefer() {
- renderNode = NULL;
+ renderNode = nullptr;
deferredUpdateScheduled = false;
deferredList.release();
}
@@ -262,7 +262,7 @@
// renderer is checked as layer may be destroyed/put in layer cache with flush scheduled
if (deferredList && renderer) {
ATRACE_LAYER_WORK("Issue");
- renderer->startMark((renderNode.get() != NULL) ? renderNode->getName() : "Layer");
+ renderer->startMark((renderNode.get() != nullptr) ? renderNode->getName() : "Layer");
renderer->setViewport(layer.getWidth(), layer.getHeight());
renderer->prepareDirty(dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom,
@@ -273,7 +273,7 @@
renderer->finish();
dirtyRect.setEmpty();
- renderNode = NULL;
+ renderNode = nullptr;
renderer->endMark();
}
@@ -294,7 +294,7 @@
dirtyRect.setEmpty();
deferredUpdateScheduled = false;
- renderNode = NULL;
+ renderNode = nullptr;
}
void Layer::postDecStrong() {
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp
index d6703f2..60d4f4f 100644
--- a/libs/hwui/LayerCache.cpp
+++ b/libs/hwui/LayerCache.cpp
@@ -33,7 +33,7 @@
LayerCache::LayerCache(): mSize(0), mMaxSize(MB(DEFAULT_LAYER_CACHE_SIZE)) {
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_LAYER_CACHE_SIZE, property, NULL) > 0) {
+ if (property_get(PROPERTY_LAYER_CACHE_SIZE, property, nullptr) > 0) {
INIT_LOGD(" Setting layer cache size to %sMB", property);
setMaxSize(MB(atof(property)));
} else {
@@ -84,7 +84,7 @@
layer->getFbo());
mSize -= layer->getWidth() * layer->getHeight() * 4;
layer->state = Layer::kState_DeletedFromCache;
- layer->decStrong(0);
+ layer->decStrong(nullptr);
}
}
@@ -97,7 +97,7 @@
}
Layer* LayerCache::get(RenderState& renderState, const uint32_t width, const uint32_t height) {
- Layer* layer = NULL;
+ Layer* layer = nullptr;
LayerEntry entry(width, height);
ssize_t index = mCache.indexOf(entry);
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index fc3a3b2..6ad1b197 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -130,7 +130,7 @@
if (mLayer->region.isRect() || mLayer->region.isEmpty()) {
if (mLayer->mesh) {
delete[] mLayer->mesh;
- mLayer->mesh = NULL;
+ mLayer->mesh = nullptr;
mLayer->meshElementCount = 0;
}
@@ -151,7 +151,7 @@
if (mLayer->mesh && mLayer->meshElementCount < elementCount) {
delete[] mLayer->mesh;
- mLayer->mesh = NULL;
+ mLayer->mesh = nullptr;
}
if (!mLayer->mesh) {
@@ -192,14 +192,14 @@
GLuint fbo = caches.fboCache.get();
if (!fbo) {
ALOGW("Could not obtain an FBO");
- return NULL;
+ return nullptr;
}
caches.activeTexture(0);
Layer* layer = caches.layerCache.get(renderState, width, height);
if (!layer) {
ALOGW("Could not obtain a layer");
- return NULL;
+ return nullptr;
}
// We first obtain a layer before comparing against the max texture size
@@ -212,9 +212,9 @@
// Creating a new layer always increment its refcount by 1, this allows
// us to destroy the layer object if one was created for us
- layer->decStrong(0);
+ layer->decStrong(nullptr);
- return NULL;
+ return nullptr;
}
layer->setFbo(fbo);
@@ -222,7 +222,7 @@
layer->texCoords.set(0.0f, height / float(layer->getHeight()),
width / float(layer->getWidth()), 0.0f);
layer->setAlpha(255, SkXfermode::kSrcOver_Mode);
- layer->setColorFilter(NULL);
+ layer->setColorFilter(nullptr);
layer->setDirty(true);
layer->region.clear();
@@ -240,8 +240,8 @@
if (glGetError() != GL_NO_ERROR) {
ALOGE("Could not allocate texture for layer (fbo=%d %dx%d)", fbo, width, height);
renderState.bindFramebuffer(previousFbo);
- layer->decStrong(0);
- return NULL;
+ layer->decStrong(nullptr);
+ return nullptr;
}
}
@@ -316,7 +316,7 @@
if (!Caches::getInstance().layerCache.put(layer)) {
LAYER_RENDERER_LOGD(" Destroyed!");
- layer->decStrong(0);
+ layer->decStrong(nullptr);
} else {
LAYER_RENDERER_LOGD(" Cached!");
#if DEBUG_LAYER_RENDERER
@@ -423,7 +423,7 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, format, bitmap->width(), bitmap->height(),
- 0, format, type, NULL);
+ 0, format, type, nullptr);
if ((error = glGetError()) != GL_NO_ERROR) goto error;
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
diff --git a/libs/hwui/LayerRenderer.h b/libs/hwui/LayerRenderer.h
index 769ef49..5e1e835 100644
--- a/libs/hwui/LayerRenderer.h
+++ b/libs/hwui/LayerRenderer.h
@@ -49,10 +49,11 @@
LayerRenderer(RenderState& renderState, Layer* layer);
virtual ~LayerRenderer();
- virtual void onViewportInitialized() { /* do nothing */ }
- virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque);
- virtual void clear(float left, float top, float right, float bottom, bool opaque);
- virtual bool finish();
+ virtual void onViewportInitialized() override { /* do nothing */ }
+ virtual void prepareDirty(float left, float top, float right, float bottom,
+ bool opaque) override;
+ virtual void clear(float left, float top, float right, float bottom, bool opaque) override;
+ virtual bool finish() override;
static Layer* createTextureLayer(RenderState& renderState);
static Layer* createRenderLayer(RenderState& renderState, uint32_t width, uint32_t height);
@@ -65,11 +66,11 @@
static void flushLayer(RenderState& renderState, Layer* layer);
protected:
- virtual void ensureStencilBuffer();
- virtual bool hasLayer() const;
- virtual Region* getRegion() const;
- virtual GLuint onGetTargetFbo() const;
- virtual bool suppressErrorChecks() const;
+ virtual void ensureStencilBuffer() override;
+ virtual bool hasLayer() const override;
+ virtual Region* getRegion() const override;
+ virtual GLuint onGetTargetFbo() const override;
+ virtual bool suppressErrorChecks() const override;
private:
void generateMesh();
diff --git a/libs/hwui/Patch.cpp b/libs/hwui/Patch.cpp
index 442dc5b..8a4d65b 100644
--- a/libs/hwui/Patch.cpp
+++ b/libs/hwui/Patch.cpp
@@ -71,7 +71,7 @@
uint32_t yCount = patch->numYDivs;
uint32_t maxVertices = ((xCount + 1) * (yCount + 1) - emptyQuads) * 4;
- if (maxVertices == 0) return NULL;
+ if (maxVertices == 0) return nullptr;
vertices.reset(new TextureVertex[maxVertices]);
TextureVertex* vertex = vertices.get();
diff --git a/libs/hwui/PatchCache.cpp b/libs/hwui/PatchCache.cpp
index 1920fcf..eb88bc0 100644
--- a/libs/hwui/PatchCache.cpp
+++ b/libs/hwui/PatchCache.cpp
@@ -33,9 +33,9 @@
PatchCache::PatchCache():
mSize(0), mCache(LruCache<PatchDescription, Patch*>::kUnlimitedCapacity),
- mMeshBuffer(0), mFreeBlocks(NULL), mGenerationId(0) {
+ mMeshBuffer(0), mFreeBlocks(nullptr), mGenerationId(0) {
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_PATCH_CACHE_SIZE, property, NULL) > 0) {
+ if (property_get(PROPERTY_PATCH_CACHE_SIZE, property, nullptr) > 0) {
INIT_LOGD(" Setting patch cache size to %skB", property);
mMaxSize = KB(atoi(property));
} else {
@@ -105,7 +105,7 @@
delete block;
block = next;
}
- mFreeBlocks = NULL;
+ mFreeBlocks = nullptr;
}
void PatchCache::remove(Vector<patch_pair_t>& patchesToRemove, Res_png_9patch* patch) {
@@ -125,11 +125,11 @@
size_t count = mGarbage.size();
for (size_t i = 0; i < count; i++) {
if (patch == mGarbage[i]) {
- patch = NULL;
+ patch = nullptr;
break;
}
}
- LOG_ALWAYS_FATAL_IF(patch == NULL);
+ LOG_ALWAYS_FATAL_IF(patch == nullptr);
mGarbage.push(patch);
}
@@ -175,7 +175,7 @@
}
void PatchCache::createVertexBuffer() {
- glBufferData(GL_ARRAY_BUFFER, mMaxSize, NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, mMaxSize, nullptr, GL_DYNAMIC_DRAW);
mSize = 0;
mFreeBlocks = new BufferBlock(0, mMaxSize);
mGenerationId++;
@@ -197,7 +197,7 @@
}
// Find a block where we can fit the mesh
- BufferBlock* previous = NULL;
+ BufferBlock* previous = nullptr;
BufferBlock* block = mFreeBlocks;
while (block) {
// The mesh fits
@@ -213,7 +213,7 @@
if (!block) {
clearCache();
createVertexBuffer();
- previous = NULL;
+ previous = nullptr;
block = mFreeBlocks;
}
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index 80f9c2f..c564b87 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -48,7 +48,7 @@
style(SkPaint::kFill_Style),
miter(4.0f),
strokeWidth(1.0f),
- pathEffect(NULL) {
+ pathEffect(nullptr) {
memset(&shape, 0, sizeof(Shape));
}
@@ -81,7 +81,7 @@
bool PathCache::canDrawAsConvexPath(SkPath* path, const SkPaint* paint) {
// NOTE: This should only be used after PathTessellator handles joins properly
- return paint->getPathEffect() == NULL && path->getConvexity() == SkPath::kConvex_Convexity;
+ return paint->getPathEffect() == nullptr && path->getConvexity() == SkPath::kConvex_Convexity;
}
void PathCache::computePathBounds(const SkPath* path, const SkPaint* paint,
@@ -114,9 +114,9 @@
// will be applied later when compositing the alpha8 texture
paint.setColor(SK_ColorBLACK);
paint.setAlpha(255);
- paint.setColorFilter(NULL);
- paint.setMaskFilter(NULL);
- paint.setShader(NULL);
+ paint.setColorFilter(nullptr);
+ paint.setMaskFilter(nullptr);
+ paint.setShader(nullptr);
SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrc_Mode);
SkSafeUnref(paint.setXfermode(mode));
}
@@ -153,7 +153,7 @@
mCache(LruCache<PathDescription, PathTexture*>::kUnlimitedCapacity),
mSize(0), mMaxSize(MB(DEFAULT_PATH_CACHE_SIZE)) {
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_PATH_CACHE_SIZE, property, NULL) > 0) {
+ if (property_get(PROPERTY_PATH_CACHE_SIZE, property, nullptr) > 0) {
INIT_LOGD(" Setting %s cache size to %sMB", name, property);
setMaxSize(MB(atof(property)));
} else {
@@ -211,7 +211,7 @@
// If there is a pending task we must wait for it to return
// before attempting our cleanup
const sp<Task<SkBitmap*> >& task = texture->task();
- if (task != NULL) {
+ if (task != nullptr) {
task->getResult();
texture->clearTask();
} else {
@@ -261,7 +261,7 @@
uint32_t width, height;
computePathBounds(path, paint, left, top, offset, width, height);
- if (!checkTextureSize(width, height)) return NULL;
+ if (!checkTextureSize(width, height)) return nullptr;
purgeCache(width, height);
@@ -355,7 +355,7 @@
} else {
texture->width = 0;
texture->height = 0;
- t->setResult(NULL);
+ t->setResult(nullptr);
}
}
@@ -430,7 +430,7 @@
// A bitmap is attached to the texture, this means we need to
// upload it as a GL texture
const sp<Task<SkBitmap*> >& task = texture->task();
- if (task != NULL) {
+ if (task != nullptr) {
// But we must first wait for the worker thread to be done
// producing the bitmap, so let's wait
SkBitmap* bitmap = task->getResult();
@@ -440,7 +440,7 @@
} else {
ALOGW("Path too large to be rendered into a texture");
texture->clearTask();
- texture = NULL;
+ texture = nullptr;
mCache.remove(entry);
}
} else if (path->getGenerationID() != texture->generation) {
@@ -490,7 +490,7 @@
// be enforced.
mCache.put(entry, texture);
- if (mProcessor == NULL) {
+ if (mProcessor == nullptr) {
mProcessor = new PathProcessor(Caches::getInstance());
}
mProcessor->add(task);
diff --git a/libs/hwui/PixelBuffer.cpp b/libs/hwui/PixelBuffer.cpp
index 6c448f0..efa271e 100644
--- a/libs/hwui/PixelBuffer.cpp
+++ b/libs/hwui/PixelBuffer.cpp
@@ -35,12 +35,12 @@
public:
CpuPixelBuffer(GLenum format, uint32_t width, uint32_t height);
- uint8_t* map(AccessMode mode = kAccessMode_ReadWrite);
- void unmap();
+ uint8_t* map(AccessMode mode = kAccessMode_ReadWrite) override;
+ void unmap() override;
- uint8_t* getMappedPointer() const;
+ uint8_t* getMappedPointer() const override;
- void upload(uint32_t x, uint32_t y, uint32_t width, uint32_t height, int offset);
+ void upload(uint32_t x, uint32_t y, uint32_t width, uint32_t height, int offset) override;
private:
std::unique_ptr<uint8_t[]> mBuffer;
@@ -80,12 +80,12 @@
GpuPixelBuffer(GLenum format, uint32_t width, uint32_t height);
~GpuPixelBuffer();
- uint8_t* map(AccessMode mode = kAccessMode_ReadWrite);
- void unmap();
+ uint8_t* map(AccessMode mode = kAccessMode_ReadWrite) override;
+ void unmap() override;
- uint8_t* getMappedPointer() const;
+ uint8_t* getMappedPointer() const override;
- void upload(uint32_t x, uint32_t y, uint32_t width, uint32_t height, int offset);
+ void upload(uint32_t x, uint32_t y, uint32_t width, uint32_t height, int offset) override;
private:
GLuint mBuffer;
@@ -93,11 +93,13 @@
Caches& mCaches;
};
-GpuPixelBuffer::GpuPixelBuffer(GLenum format, uint32_t width, uint32_t height):
- PixelBuffer(format, width, height), mMappedPointer(0), mCaches(Caches::getInstance()) {
+GpuPixelBuffer::GpuPixelBuffer(GLenum format, uint32_t width, uint32_t height)
+ : PixelBuffer(format, width, height)
+ , mMappedPointer(nullptr)
+ , mCaches(Caches::getInstance()) {
glGenBuffers(1, &mBuffer);
mCaches.bindPixelBuffer(mBuffer);
- glBufferData(GL_PIXEL_UNPACK_BUFFER, getSize(), NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_PIXEL_UNPACK_BUFFER, getSize(), nullptr, GL_DYNAMIC_DRAW);
mCaches.unbindPixelBuffer();
}
@@ -133,7 +135,7 @@
}
}
mAccessMode = kAccessMode_None;
- mMappedPointer = NULL;
+ mMappedPointer = nullptr;
}
}
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp
index e6fd2dc..fb07dfa 100644
--- a/libs/hwui/Program.cpp
+++ b/libs/hwui/Program.cpp
@@ -64,7 +64,7 @@
glGetProgramiv(mProgramId, GL_INFO_LOG_LENGTH, &infoLen);
if (infoLen > 1) {
GLchar log[infoLen];
- glGetProgramInfoLog(mProgramId, infoLen, 0, &log[0]);
+ glGetProgramInfoLog(mProgramId, infoLen, nullptr, &log[0]);
ALOGE("%s", log);
}
LOG_ALWAYS_FATAL("Error while linking shaders");
@@ -135,7 +135,7 @@
ATRACE_NAME("Build GL Shader");
GLuint shader = glCreateShader(type);
- glShaderSource(shader, 1, &source, 0);
+ glShaderSource(shader, 1, &source, nullptr);
glCompileShader(shader);
GLint status;
@@ -145,7 +145,7 @@
// Some drivers return wrong values for GL_INFO_LOG_LENGTH
// use a fixed size instead
GLchar log[512];
- glGetShaderInfoLog(shader, sizeof(log), 0, &log[0]);
+ glGetShaderInfoLog(shader, sizeof(log), nullptr, &log[0]);
LOG_ALWAYS_FATAL("Shader info log: %s", log);
return 0;
}
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index 6d3f0cb..3bbd520 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -429,7 +429,7 @@
}
auto iter = mCache.find(key);
- Program* program = NULL;
+ Program* program = nullptr;
if (iter == mCache.end()) {
description.log("Could not find program");
program = generateProgram(description, key);
diff --git a/libs/hwui/RenderBufferCache.cpp b/libs/hwui/RenderBufferCache.cpp
index 830a13a..0380c51 100644
--- a/libs/hwui/RenderBufferCache.cpp
+++ b/libs/hwui/RenderBufferCache.cpp
@@ -42,7 +42,7 @@
RenderBufferCache::RenderBufferCache(): mSize(0), mMaxSize(MB(DEFAULT_RENDER_BUFFER_CACHE_SIZE)) {
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_RENDER_BUFFER_CACHE_SIZE, property, NULL) > 0) {
+ if (property_get(PROPERTY_RENDER_BUFFER_CACHE_SIZE, property, nullptr) > 0) {
INIT_LOGD(" Setting render buffer cache size to %sMB", property);
setMaxSize(MB(atof(property)));
} else {
@@ -108,7 +108,7 @@
}
RenderBuffer* RenderBufferCache::get(GLenum format, const uint32_t width, const uint32_t height) {
- RenderBuffer* buffer = NULL;
+ RenderBuffer* buffer = nullptr;
RenderBufferEntry entry(format, width, height);
ssize_t index = mCache.indexOf(entry);
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index ad38a12..b448949 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -78,10 +78,10 @@
RenderNode::RenderNode()
: mDirtyPropertyFields(0)
, mNeedsDisplayListDataSync(false)
- , mDisplayListData(0)
- , mStagingDisplayListData(0)
+ , mDisplayListData(nullptr)
+ , mStagingDisplayListData(nullptr)
, mAnimatorManager(*this)
- , mLayer(0)
+ , mLayer(nullptr)
, mParentCount(0) {
}
@@ -91,7 +91,7 @@
if (mLayer) {
ALOGW("Memory Warning: Layer %p missed its detachment, held on to for far too long!", mLayer);
mLayer->postDecStrong();
- mLayer = 0;
+ mLayer = nullptr;
}
}
@@ -110,7 +110,7 @@
getName(),
(properties().hasShadow() ? ", casting shadow" : ""),
(isRenderable() ? "" : ", empty"),
- (mLayer != NULL ? ", on HW Layer" : ""));
+ (mLayer != nullptr ? ", on HW Layer" : ""));
ALOGD("%*s%s %d", level * 2, "", "Save",
SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
@@ -182,7 +182,7 @@
if (CC_LIKELY(layerType != kLayerTypeRenderLayer) || CC_UNLIKELY(!isRenderable())) {
if (CC_UNLIKELY(mLayer)) {
LayerRenderer::destroyLayer(mLayer);
- mLayer = NULL;
+ mLayer = nullptr;
}
return;
}
@@ -196,7 +196,7 @@
} else if (mLayer->layer.getWidth() != getWidth() || mLayer->layer.getHeight() != getHeight()) {
if (!LayerRenderer::resizeLayer(mLayer, getWidth(), getHeight())) {
LayerRenderer::destroyLayer(mLayer);
- mLayer = 0;
+ mLayer = nullptr;
}
damageSelf(info);
transformUpdateNeeded = true;
@@ -311,10 +311,10 @@
Caches::getInstance().registerFunctors(mStagingDisplayListData->functors.size());
}
mDisplayListData = mStagingDisplayListData;
- mStagingDisplayListData = NULL;
+ mStagingDisplayListData = nullptr;
if (mDisplayListData) {
for (size_t i = 0; i < mDisplayListData->functors.size(); i++) {
- (*mDisplayListData->functors[i])(DrawGlInfo::kModeSync, NULL);
+ (*mDisplayListData->functors[i])(DrawGlInfo::kModeSync, nullptr);
}
}
damageSelf(info);
@@ -331,7 +331,7 @@
}
}
delete mDisplayListData;
- mDisplayListData = NULL;
+ mDisplayListData = nullptr;
}
void RenderNode::prepareSubTree(TreeInfo& info, DisplayListData* subtree) {
@@ -359,7 +359,7 @@
void RenderNode::destroyHardwareResources() {
if (mLayer) {
LayerRenderer::destroyLayer(mLayer);
- mLayer = NULL;
+ mLayer = nullptr;
}
if (mDisplayListData) {
for (size_t i = 0; i < mDisplayListData->children().size(); i++) {
@@ -517,7 +517,7 @@
// TODO: create temporary DDLOp and call computeOrderingImpl on top DisplayList so that
// transform properties are applied correctly to top level children
- if (mDisplayListData == NULL) return;
+ if (mDisplayListData == nullptr) return;
for (unsigned int i = 0; i < mDisplayListData->children().size(); i++) {
DrawRenderNodeOp* childOp = mDisplayListData->children()[i];
childOp->mRenderNode->computeOrderingImpl(childOp,
@@ -531,7 +531,7 @@
Vector<DrawRenderNodeOp*>* compositedChildrenOfProjectionSurface,
const mat4* transformFromProjectionSurface) {
mProjectedNodes.clear();
- if (mDisplayListData == NULL || mDisplayListData->isEmpty()) return;
+ if (mDisplayListData == nullptr || mDisplayListData->isEmpty()) return;
// TODO: should avoid this calculation in most cases
// TODO: just calculate single matrix, down to all leaf composited elements
@@ -555,9 +555,9 @@
DrawRenderNodeOp* childOp = mDisplayListData->children()[i];
RenderNode* child = childOp->mRenderNode;
- const SkPath* projectionOutline = NULL;
- Vector<DrawRenderNodeOp*>* projectionChildren = NULL;
- const mat4* projectionTransform = NULL;
+ const SkPath* projectionOutline = nullptr;
+ Vector<DrawRenderNodeOp*>* projectionChildren = nullptr;
+ const mat4* projectionTransform = nullptr;
if (isProjectionReceiver && !child->properties().getProjectBackwards()) {
// if receiving projections, collect projecting descendent
@@ -683,7 +683,7 @@
// holds temporary SkPath to store the result of intersections
- SkPath* frameAllocatedPath = NULL;
+ SkPath* frameAllocatedPath = nullptr;
const SkPath* outlinePath = casterOutlinePath;
// intersect the outline with the reveal clip, if present
@@ -810,9 +810,9 @@
// If the projection reciever has an outline, we mask each of the projected rendernodes to it
// Either with clipRect, or special saveLayer masking
- if (projectionReceiverOutline != NULL) {
+ if (projectionReceiverOutline != nullptr) {
const SkRect& outlineBounds = projectionReceiverOutline->getBounds();
- if (projectionReceiverOutline->isRect(NULL)) {
+ if (projectionReceiverOutline->isRect(nullptr)) {
// mask to the rect outline simply with clipRect
ClipRectOp* clipOp = new (alloc) ClipRectOp(
outlineBounds.left(), outlineBounds.top(),
@@ -847,7 +847,7 @@
renderer.restoreToCount(restoreTo);
}
- if (projectionReceiverOutline != NULL) {
+ if (projectionReceiverOutline != nullptr) {
handler(new (alloc) RestoreToCountOp(restoreTo),
PROPERTY_SAVECOUNT, properties().getClipToBounds());
}
diff --git a/libs/hwui/RenderProperties.cpp b/libs/hwui/RenderProperties.cpp
index 250cadc..bb6d087 100644
--- a/libs/hwui/RenderProperties.cpp
+++ b/libs/hwui/RenderProperties.cpp
@@ -35,7 +35,7 @@
LayerProperties::LayerProperties()
: mType(kLayerTypeNone)
- , mColorFilter(NULL) {
+ , mColorFilter(nullptr) {
reset();
}
@@ -45,7 +45,7 @@
void LayerProperties::reset() {
mOpaque = false;
- setFromPaint(NULL);
+ setFromPaint(nullptr);
}
bool LayerProperties::setColorFilter(SkColorFilter* filter) {
@@ -61,7 +61,7 @@
OpenGLRenderer::getAlphaAndModeDirect(paint, &alpha, &mode);
changed |= setAlpha(static_cast<uint8_t>(alpha));
changed |= setXferMode(mode);
- changed |= setColorFilter(paint ? paint->getColorFilter() : NULL);
+ changed |= setColorFilter(paint ? paint->getColorFilter() : nullptr);
return changed;
}
@@ -92,7 +92,7 @@
}
RenderProperties::ComputedFields::ComputedFields()
- : mTransformMatrix(NULL) {
+ : mTransformMatrix(nullptr) {
}
RenderProperties::ComputedFields::~ComputedFields() {
@@ -100,8 +100,8 @@
}
RenderProperties::RenderProperties()
- : mStaticMatrix(NULL)
- , mAnimationMatrix(NULL) {
+ : mStaticMatrix(nullptr)
+ , mAnimationMatrix(nullptr) {
}
RenderProperties::~RenderProperties() {
diff --git a/libs/hwui/RenderState.cpp b/libs/hwui/RenderState.cpp
index d1f5f4e..45a97fb 100644
--- a/libs/hwui/RenderState.cpp
+++ b/libs/hwui/RenderState.cpp
@@ -23,7 +23,7 @@
RenderState::RenderState(renderthread::RenderThread& thread)
: mRenderThread(thread)
- , mCaches(NULL)
+ , mCaches(nullptr)
, mViewportWidth(0)
, mViewportHeight(0)
, mFramebuffer(0) {
@@ -105,7 +105,7 @@
if (mCaches->currentProgram) {
if (mCaches->currentProgram->isInUse()) {
mCaches->currentProgram->remove();
- mCaches->currentProgram = NULL;
+ mCaches->currentProgram = nullptr;
}
}
mCaches->resetActiveTexture();
@@ -165,9 +165,9 @@
public:
DecStrongTask(VirtualLightRefBase* object) : mObject(object) {}
- virtual void run() {
- mObject->decStrong(0);
- mObject = 0;
+ virtual void run() override {
+ mObject->decStrong(nullptr);
+ mObject = nullptr;
delete this;
}
diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp
index 8a48a6e..45c27c2 100644
--- a/libs/hwui/ResourceCache.cpp
+++ b/libs/hwui/ResourceCache.cpp
@@ -79,8 +79,8 @@
void ResourceCache::incrementRefcountLocked(void* resource, ResourceType resourceType) {
ssize_t index = mCache->indexOfKey(resource);
- ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
- if (ref == NULL || mCache->size() == 0) {
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : nullptr;
+ if (ref == nullptr || mCache->size() == 0) {
ref = new ResourceReference(resourceType);
mCache->add(resource, ref);
}
@@ -118,8 +118,8 @@
void ResourceCache::decrementRefcountLocked(void* resource) {
ssize_t index = mCache->indexOfKey(resource);
- ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
- if (ref == NULL) {
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : nullptr;
+ if (ref == nullptr) {
// Should not get here - shouldn't get a call to decrement if we're not yet tracking it
return;
}
@@ -148,8 +148,8 @@
void ResourceCache::destructorLocked(SkPath* resource) {
ssize_t index = mCache->indexOfKey(resource);
- ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
- if (ref == NULL) {
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : nullptr;
+ if (ref == nullptr) {
// If we're not tracking this resource, just delete it
if (Caches::hasInstance()) {
Caches::getInstance().pathCache.removeDeferred(resource);
@@ -171,8 +171,8 @@
void ResourceCache::destructorLocked(const SkBitmap* resource) {
ssize_t index = mCache->indexOfKey(resource);
- ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
- if (ref == NULL) {
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : nullptr;
+ if (ref == nullptr) {
// If we're not tracking this resource, just delete it
if (Caches::hasInstance()) {
Caches::getInstance().textureCache.releaseTexture(resource);
@@ -193,8 +193,8 @@
void ResourceCache::destructorLocked(Res_png_9patch* resource) {
ssize_t index = mCache->indexOfKey(resource);
- ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
- if (ref == NULL) {
+ ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : nullptr;
+ if (ref == nullptr) {
// If we're not tracking this resource, just delete it
if (Caches::hasInstance()) {
Caches::getInstance().patchCache.removeDeferred(resource);
@@ -231,11 +231,11 @@
Caches::getInstance().textureCache.releaseTexture(resource);
}
// not tracking this resource; just recycle the pixel data
- resource->setPixels(NULL, NULL);
+ resource->setPixels(nullptr, nullptr);
return true;
}
ResourceReference* ref = mCache->valueAt(index);
- if (ref == NULL) {
+ if (ref == nullptr) {
// Should not get here - shouldn't get a call to recycle if we're not yet tracking it
return true;
}
@@ -258,7 +258,7 @@
if (Caches::hasInstance()) {
Caches::getInstance().textureCache.releaseTexture(bitmap);
}
- bitmap->setPixels(NULL, NULL);
+ bitmap->setPixels(nullptr, nullptr);
}
if (ref->destroyed) {
switch (ref->resourceType) {
diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp
index 93d4b31..f8917e3 100644
--- a/libs/hwui/ShadowTessellator.cpp
+++ b/libs/hwui/ShadowTessellator.cpp
@@ -193,7 +193,7 @@
* @param len the number of points of the polygon
*/
bool ShadowTessellator::isClockwise(const Vector2* polygon, int len) {
- if (len < 2 || polygon == NULL) {
+ if (len < 2 || polygon == nullptr) {
return true;
}
double sum = 0;
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp
index dff19a9..2c09344 100644
--- a/libs/hwui/SkiaShader.cpp
+++ b/libs/hwui/SkiaShader.cpp
@@ -87,7 +87,7 @@
SkiaShaderType SkiaShader::getType(const SkShader& shader) {
// First check for a gradient shader.
- switch (shader.asAGradient(NULL)) {
+ switch (shader.asAGradient(nullptr)) {
case SkShader::kNone_GradientType:
// Not a gradient shader. Fall through to check for other types.
break;
@@ -101,7 +101,7 @@
}
// The shader is not a gradient. Check for a bitmap shader.
- if (shader.asABitmap(NULL, NULL, NULL) == SkShader::kDefault_BitmapType) {
+ if (shader.asABitmap(nullptr, nullptr, nullptr) == SkShader::kDefault_BitmapType) {
return kBitmap_SkiaShaderType;
}
@@ -119,7 +119,7 @@
return kCompose_SkiaShaderType;
}
- if (shader.asACustomShader(NULL)) {
+ if (shader.asACustomShader(nullptr)) {
return kLayer_SkiaShaderType;
}
@@ -255,17 +255,17 @@
const Extensions& extensions, const SkShader& shader) {
SkBitmap bitmap;
SkShader::TileMode xy[2];
- if (shader.asABitmap(&bitmap, NULL, xy) != SkShader::kDefault_BitmapType) {
+ if (shader.asABitmap(&bitmap, nullptr, xy) != SkShader::kDefault_BitmapType) {
LOG_ALWAYS_FATAL("SkiaBitmapShader::describe called with a different kind of shader!");
}
- bitmapShaderHelper(caches, &description, NULL, extensions, bitmap, xy);
+ bitmapShaderHelper(caches, &description, nullptr, extensions, bitmap, xy);
}
void SkiaBitmapShader::setupProgram(Caches* caches, const mat4& modelViewMatrix,
GLuint* textureUnit, const Extensions& extensions, const SkShader& shader) {
SkBitmap bitmap;
SkShader::TileMode xy[2];
- if (shader.asABitmap(&bitmap, NULL, xy) != SkShader::kDefault_BitmapType) {
+ if (shader.asABitmap(&bitmap, nullptr, xy) != SkShader::kDefault_BitmapType) {
LOG_ALWAYS_FATAL("SkiaBitmapShader::setupProgram called with a different kind of shader!");
}
@@ -273,7 +273,7 @@
Caches::getInstance().activeTexture(textureSlot);
BitmapShaderInfo shaderInfo;
- if (!bitmapShaderHelper(caches, NULL, &shaderInfo, extensions, bitmap, xy)) {
+ if (!bitmapShaderHelper(caches, nullptr, &shaderInfo, extensions, bitmap, xy)) {
return;
}
@@ -343,8 +343,8 @@
const Extensions& extensions, const SkShader& shader) {
SkShader::GradientInfo gradInfo;
gradInfo.fColorCount = 0;
- gradInfo.fColors = NULL;
- gradInfo.fColorOffsets = NULL;
+ gradInfo.fColors = nullptr;
+ gradInfo.fColorOffsets = nullptr;
switch (shader.asAGradient(&gradInfo)) {
case SkShader::kLinear_GradientType:
diff --git a/libs/hwui/Snapshot.cpp b/libs/hwui/Snapshot.cpp
index cf8229fd..d4ca99e 100644
--- a/libs/hwui/Snapshot.cpp
+++ b/libs/hwui/Snapshot.cpp
@@ -29,16 +29,16 @@
Snapshot::Snapshot()
: flags(0)
- , previous(NULL)
- , layer(NULL)
+ , previous(nullptr)
+ , layer(nullptr)
, fbo(0)
, invisible(false)
, empty(false)
, alpha(1.0f)
- , roundRectClipState(NULL) {
+ , roundRectClipState(nullptr) {
transform = &mTransformRoot;
clipRect = &mClipRectRoot;
- region = NULL;
+ region = nullptr;
clipRegion = &mClipRegionRoot;
}
@@ -80,7 +80,7 @@
flags |= Snapshot::kFlagFboTarget;
region = s->region;
} else {
- region = NULL;
+ region = nullptr;
}
}
diff --git a/libs/hwui/SpotShadow.cpp b/libs/hwui/SpotShadow.cpp
index b3cfde2..a03192a 100644
--- a/libs/hwui/SpotShadow.cpp
+++ b/libs/hwui/SpotShadow.cpp
@@ -332,7 +332,7 @@
* @param len the number of points of the polygon
*/
void SpotShadow::makeClockwise(Vector2* polygon, int len) {
- if (polygon == 0 || len == 0) {
+ if (polygon == nullptr || len == 0) {
return;
}
if (!ShadowTessellator::isClockwise(polygon, len)) {
diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp
index 1e38f9e..4f028d5 100644
--- a/libs/hwui/TessellationCache.cpp
+++ b/libs/hwui/TessellationCache.cpp
@@ -76,7 +76,7 @@
}
TessellationCache::ShadowDescription::ShadowDescription()
- : nodeKey(NULL) {
+ : nodeKey(nullptr) {
memset(&matrixData, 0, 16 * sizeof(float));
}
@@ -114,7 +114,7 @@
: TaskProcessor<VertexBuffer*>(&caches.tasks) {}
~TessellationProcessor() {}
- virtual void onProcess(const sp<Task<VertexBuffer*> >& task) {
+ virtual void onProcess(const sp<Task<VertexBuffer*> >& task) override {
TessellationTask* t = static_cast<TessellationTask*>(task.get());
ATRACE_NAME("shape tessellation");
VertexBuffer* buffer = t->tessellator(t->description);
@@ -126,7 +126,7 @@
public:
Buffer(const sp<Task<VertexBuffer*> >& task)
: mTask(task)
- , mBuffer(NULL) {
+ , mBuffer(nullptr) {
}
~Buffer() {
@@ -146,9 +146,9 @@
private:
void blockOnPrecache() {
- if (mTask != NULL) {
+ if (mTask != nullptr) {
mBuffer = mTask->getResult();
- LOG_ALWAYS_FATAL_IF(mBuffer == NULL, "Failed to precache");
+ LOG_ALWAYS_FATAL_IF(mBuffer == nullptr, "Failed to precache");
mTask.clear();
}
}
@@ -278,7 +278,7 @@
: TaskProcessor<TessellationCache::vertexBuffer_pair_t*>(&caches.tasks) {}
~ShadowProcessor() {}
- virtual void onProcess(const sp<Task<TessellationCache::vertexBuffer_pair_t*> >& task) {
+ virtual void onProcess(const sp<Task<TessellationCache::vertexBuffer_pair_t*> >& task) override {
ShadowTask* t = static_cast<ShadowTask*>(task.get());
ATRACE_NAME("shadow tessellation");
@@ -302,7 +302,7 @@
, mCache(LruCache<Description, Buffer*>::kUnlimitedCapacity)
, mShadowCache(LruCache<ShadowDescription, Task<vertexBuffer_pair_t*>*>::kUnlimitedCapacity) {
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_VERTEX_CACHE_SIZE, property, NULL) > 0) {
+ if (property_get(PROPERTY_VERTEX_CACHE_SIZE, property, nullptr) > 0) {
INIT_LOGD(" Setting %s cache size to %sMB", name, property);
setMaxSize(MB(atof(property)));
} else {
@@ -382,12 +382,12 @@
sp<ShadowTask> task = new ShadowTask(drawTransform, localClip, opaque,
casterPerimeter, transformXY, transformZ, lightCenter, lightRadius);
- if (mShadowProcessor == NULL) {
+ if (mShadowProcessor == nullptr) {
mShadowProcessor = new ShadowProcessor(Caches::getInstance());
}
mShadowProcessor->add(task);
- task->incStrong(NULL); // not using sp<>s, so manually ref while in the cache
+ task->incStrong(nullptr); // not using sp<>s, so manually ref while in the cache
mShadowCache.put(key, task.get());
}
@@ -402,7 +402,7 @@
transformXY, transformZ, lightCenter, lightRadius);
task = static_cast<ShadowTask*>(mShadowCache.get(key));
}
- LOG_ALWAYS_FATAL_IF(task == NULL, "shadow not precached");
+ LOG_ALWAYS_FATAL_IF(task == nullptr, "shadow not precached");
outBuffers = *(task->getResult());
}
@@ -418,7 +418,7 @@
sp<TessellationTask> task = new TessellationTask(tessellator, entry);
buffer = new Buffer(task);
- if (mProcessor == NULL) {
+ if (mProcessor == nullptr) {
mProcessor = new TessellationProcessor(Caches::getInstance());
}
mProcessor->add(task);
diff --git a/libs/hwui/TextDropShadowCache.cpp b/libs/hwui/TextDropShadowCache.cpp
index a642c68..4ec298d 100644
--- a/libs/hwui/TextDropShadowCache.cpp
+++ b/libs/hwui/TextDropShadowCache.cpp
@@ -100,7 +100,7 @@
mCache(LruCache<ShadowText, ShadowTexture*>::kUnlimitedCapacity),
mSize(0), mMaxSize(MB(DEFAULT_DROP_SHADOW_CACHE_SIZE)) {
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_DROP_SHADOW_CACHE_SIZE, property, NULL) > 0) {
+ if (property_get(PROPERTY_DROP_SHADOW_CACHE_SIZE, property, nullptr) > 0) {
INIT_LOGD(" Setting drop shadow cache size to %sMB", property);
setMaxSize(MB(atof(property)));
} else {
@@ -182,7 +182,7 @@
len, numGlyphs, radius, positions);
if (!shadow.image) {
- return NULL;
+ return nullptr;
}
Caches& caches = Caches::getInstance();
diff --git a/libs/hwui/Texture.cpp b/libs/hwui/Texture.cpp
index e783905..58fd972 100644
--- a/libs/hwui/Texture.cpp
+++ b/libs/hwui/Texture.cpp
@@ -25,14 +25,14 @@
namespace uirenderer {
Texture::Texture(): id(0), generation(0), blend(false), width(0), height(0),
- cleanup(false), bitmapSize(0), mipMap(false), uvMapper(NULL), isInUse(false),
+ cleanup(false), bitmapSize(0), mipMap(false), uvMapper(nullptr), isInUse(false),
mWrapS(GL_CLAMP_TO_EDGE), mWrapT(GL_CLAMP_TO_EDGE),
mMinFilter(GL_NEAREST), mMagFilter(GL_NEAREST),
mFirstFilter(true), mFirstWrap(true), mCaches(Caches::getInstance()) {
}
Texture::Texture(Caches& caches): id(0), generation(0), blend(false), width(0), height(0),
- cleanup(false), bitmapSize(0), mipMap(false), uvMapper(NULL), isInUse(false),
+ cleanup(false), bitmapSize(0), mipMap(false), uvMapper(nullptr), isInUse(false),
mWrapS(GL_CLAMP_TO_EDGE), mWrapT(GL_CLAMP_TO_EDGE),
mMinFilter(GL_NEAREST), mMagFilter(GL_NEAREST),
mFirstFilter(true), mFirstWrap(true), mCaches(caches) {
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp
index 8109433..7dc2480 100644
--- a/libs/hwui/TextureCache.cpp
+++ b/libs/hwui/TextureCache.cpp
@@ -41,16 +41,16 @@
TextureCache::TextureCache():
mCache(LruCache<uint32_t, Texture*>::kUnlimitedCapacity),
mSize(0), mMaxSize(MB(DEFAULT_TEXTURE_CACHE_SIZE)),
- mFlushRate(DEFAULT_TEXTURE_CACHE_FLUSH_RATE), mAssetAtlas(0) {
+ mFlushRate(DEFAULT_TEXTURE_CACHE_FLUSH_RATE), mAssetAtlas(nullptr) {
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_TEXTURE_CACHE_SIZE, property, NULL) > 0) {
+ if (property_get(PROPERTY_TEXTURE_CACHE_SIZE, property, nullptr) > 0) {
INIT_LOGD(" Setting texture cache size to %sMB", property);
setMaxSize(MB(atof(property)));
} else {
INIT_LOGD(" Using default texture cache size of %.2fMB", DEFAULT_TEXTURE_CACHE_SIZE);
}
- if (property_get(PROPERTY_TEXTURE_CACHE_FLUSH_RATE, property, NULL) > 0) {
+ if (property_get(PROPERTY_TEXTURE_CACHE_FLUSH_RATE, property, nullptr) > 0) {
float flushRate = atof(property);
INIT_LOGD(" Setting texture cache flush rate to %.2f%%", flushRate * 100.0f);
setFlushRate(flushRate);
@@ -64,7 +64,7 @@
TextureCache::TextureCache(uint32_t maxByteSize):
mCache(LruCache<uint32_t, Texture*>::kUnlimitedCapacity),
- mSize(0), mMaxSize(maxByteSize), mAssetAtlas(0) {
+ mSize(0), mMaxSize(maxByteSize), mAssetAtlas(nullptr) {
init();
}
@@ -160,7 +160,7 @@
if (!texture) {
if (!canMakeTextureFromBitmap(bitmap)) {
- return NULL;
+ return nullptr;
}
const uint32_t size = bitmap->rowBytes() * bitmap->height();
@@ -210,7 +210,7 @@
if (!texture) {
if (!canMakeTextureFromBitmap(bitmap)) {
- return NULL;
+ return nullptr;
}
const uint32_t size = bitmap->rowBytes() * bitmap->height();
@@ -352,7 +352,7 @@
rgbaBitmap.eraseColor(0);
SkCanvas canvas(rgbaBitmap);
- canvas.drawBitmap(*bitmap, 0.0f, 0.0f, NULL);
+ canvas.drawBitmap(*bitmap, 0.0f, 0.0f, nullptr);
uploadToTexture(resize, GL_RGBA, rgbaBitmap.rowBytesAsPixels(), rgbaBitmap.bytesPerPixel(),
width, height, GL_UNSIGNED_BYTE, rgbaBitmap.getPixels());
diff --git a/libs/hwui/TreeInfo.h b/libs/hwui/TreeInfo.h
index e820b22..0799c6c 100644
--- a/libs/hwui/TreeInfo.h
+++ b/libs/hwui/TreeInfo.h
@@ -59,11 +59,11 @@
: mode(mode)
, prepareTextures(mode == MODE_FULL)
, runAnimations(true)
- , damageAccumulator(NULL)
+ , damageAccumulator(nullptr)
, renderState(renderState)
- , renderer(NULL)
- , errorHandler(NULL)
- , canvasContext(NULL)
+ , renderer(nullptr)
+ , errorHandler(nullptr)
+ , canvasContext(nullptr)
{}
explicit TreeInfo(TraversalMode mode, const TreeInfo& clone)
diff --git a/libs/hwui/font/CacheTexture.cpp b/libs/hwui/font/CacheTexture.cpp
index 380c0ed..128e392 100644
--- a/libs/hwui/font/CacheTexture.cpp
+++ b/libs/hwui/font/CacheTexture.cpp
@@ -43,7 +43,7 @@
#endif
CacheBlock* currBlock = head;
- CacheBlock* prevBlock = NULL;
+ CacheBlock* prevBlock = nullptr;
while (currBlock && currBlock->mY != TEXTURE_BORDER_SIZE) {
if (newBlock->mWidth < currBlock->mWidth) {
@@ -110,9 +110,9 @@
///////////////////////////////////////////////////////////////////////////////
CacheTexture::CacheTexture(uint16_t width, uint16_t height, GLenum format, uint32_t maxQuadCount) :
- mTexture(NULL), mTextureId(0), mWidth(width), mHeight(height), mFormat(format),
+ mTexture(nullptr), mTextureId(0), mWidth(width), mHeight(height), mFormat(format),
mLinearFiltering(false), mDirty(false), mNumGlyphs(0),
- mMesh(NULL), mCurrentQuad(0), mMaxQuadCount(maxQuadCount),
+ mMesh(nullptr), mCurrentQuad(0), mMaxQuadCount(maxQuadCount),
mCaches(Caches::getInstance()) {
mCacheBlocks = new CacheBlock(TEXTURE_BORDER_SIZE, TEXTURE_BORDER_SIZE,
mWidth - TEXTURE_BORDER_SIZE, mHeight - TEXTURE_BORDER_SIZE);
@@ -131,7 +131,7 @@
void CacheTexture::reset() {
// Delete existing cache blocks
- while (mCacheBlocks != NULL) {
+ while (mCacheBlocks != nullptr) {
CacheBlock* tmpBlock = mCacheBlocks;
mCacheBlocks = mCacheBlocks->mNext;
delete tmpBlock;
@@ -154,7 +154,7 @@
void CacheTexture::releaseTexture() {
if (mTexture) {
delete mTexture;
- mTexture = NULL;
+ mTexture = nullptr;
}
if (mTextureId) {
mCaches.deleteTexture(mTextureId);
@@ -193,7 +193,7 @@
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
// Initialize texture dimensions
glTexImage2D(GL_TEXTURE_2D, 0, mFormat, mWidth, mHeight, 0,
- mFormat, GL_UNSIGNED_BYTE, 0);
+ mFormat, GL_UNSIGNED_BYTE, nullptr);
const GLenum filtering = getLinearFiltering() ? GL_LINEAR : GL_NEAREST;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp
index 2e6c528..b07a3c8 100644
--- a/libs/hwui/font/Font.cpp
+++ b/libs/hwui/font/Font.cpp
@@ -298,13 +298,13 @@
void Font::render(const SkPaint* paint, const char *text, uint32_t start, uint32_t len,
int numGlyphs, int x, int y, const float* positions) {
- render(paint, text, start, len, numGlyphs, x, y, FRAMEBUFFER, NULL,
- 0, 0, NULL, positions);
+ render(paint, text, start, len, numGlyphs, x, y, FRAMEBUFFER, nullptr,
+ 0, 0, nullptr, positions);
}
void Font::render(const SkPaint* paint, const char *text, uint32_t start, uint32_t len,
int numGlyphs, const SkPath* path, float hOffset, float vOffset) {
- if (numGlyphs == 0 || text == NULL || len == 0) {
+ if (numGlyphs == 0 || text == nullptr || len == 0) {
return;
}
@@ -354,18 +354,18 @@
void Font::measure(const SkPaint* paint, const char* text, uint32_t start, uint32_t len,
int numGlyphs, Rect *bounds, const float* positions) {
- if (bounds == NULL) {
+ if (bounds == nullptr) {
ALOGE("No return rectangle provided to measure text");
return;
}
bounds->set(1e6, -1e6, -1e6, 1e6);
- render(paint, text, start, len, numGlyphs, 0, 0, MEASURE, NULL, 0, 0, bounds, positions);
+ render(paint, text, start, len, numGlyphs, 0, 0, MEASURE, nullptr, 0, 0, bounds, positions);
}
void Font::precache(const SkPaint* paint, const char* text, int numGlyphs) {
ATRACE_NAME("Precache Glyphs");
- if (numGlyphs == 0 || text == NULL) {
+ if (numGlyphs == 0 || text == nullptr) {
return;
}
@@ -386,7 +386,7 @@
void Font::render(const SkPaint* paint, const char* text, uint32_t start, uint32_t len,
int numGlyphs, int x, int y, RenderMode mode, uint8_t *bitmap,
uint32_t bitmapW, uint32_t bitmapH, Rect* bounds, const float* positions) {
- if (numGlyphs == 0 || text == NULL || len == 0) {
+ if (numGlyphs == 0 || text == nullptr || len == 0) {
return;
}
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 0e54169..71ecba5 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -45,7 +45,7 @@
, mBufferPreserved(false)
, mSwapBehavior(kSwap_default)
, mOpaque(!translucent)
- , mCanvas(NULL)
+ , mCanvas(nullptr)
, mHaveNewSurface(false)
, mAnimationContext(contextFactory->createAnimationContext(mRenderThread.timeLord()))
, mRootRenderNode(rootRenderNode) {
@@ -59,13 +59,13 @@
void CanvasContext::destroy() {
stopDrawing();
- setSurface(NULL);
+ setSurface(nullptr);
freePrefetechedLayers();
destroyHardwareResources();
mAnimationContext->destroy();
if (mCanvas) {
delete mCanvas;
- mCanvas = 0;
+ mCanvas = nullptr;
}
}
@@ -95,7 +95,7 @@
void CanvasContext::swapBuffers() {
if (CC_UNLIKELY(!mEglManager.swapBuffers(mEglSurface))) {
- setSurface(NULL);
+ setSurface(nullptr);
}
mHaveNewSurface = false;
}
@@ -273,19 +273,19 @@
mode = DrawGlInfo::kModeProcess;
}
- thread.renderState().invokeFunctor(functor, mode, NULL);
+ thread.renderState().invokeFunctor(functor, mode, nullptr);
}
void CanvasContext::markLayerInUse(RenderNode* node) {
if (mPrefetechedLayers.erase(node)) {
- node->decStrong(0);
+ node->decStrong(nullptr);
}
}
static void destroyPrefetechedNode(RenderNode* node) {
ALOGW("Incorrectly called buildLayer on View: %s, destroying layer...", node->getName());
node->destroyHardwareResources();
- node->decStrong(0);
+ node->decStrong(nullptr);
}
void CanvasContext::freePrefetechedLayers() {
@@ -319,7 +319,7 @@
mCanvas->markLayersAsBuildLayers();
mCanvas->flushLayerUpdates();
- node->incStrong(0);
+ node->incStrong(nullptr);
mPrefetechedLayers.insert(node);
}
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index d7f2ebd..d3fbde8 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -80,7 +80,7 @@
void destroy();
// IFrameCallback, Chroreographer-driven frame callback entry point
- virtual void doFrame();
+ virtual void doFrame() override;
void buildLayer(RenderNode* node);
bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap);
diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp
index 97b31a9..4d8a469 100644
--- a/libs/hwui/renderthread/DrawFrameTask.cpp
+++ b/libs/hwui/renderthread/DrawFrameTask.cpp
@@ -32,8 +32,8 @@
namespace renderthread {
DrawFrameTask::DrawFrameTask()
- : mRenderThread(NULL)
- , mContext(NULL)
+ : mRenderThread(nullptr)
+ , mContext(nullptr)
, mFrameTimeNanos(0)
, mRecordDurationNanos(0)
, mDensity(1.0f) // safe enough default
diff --git a/libs/hwui/renderthread/DrawFrameTask.h b/libs/hwui/renderthread/DrawFrameTask.h
index 28f6cb2..953f012 100644
--- a/libs/hwui/renderthread/DrawFrameTask.h
+++ b/libs/hwui/renderthread/DrawFrameTask.h
@@ -64,7 +64,7 @@
void setDensity(float density) { mDensity = density; }
int drawFrame(nsecs_t frameTimeNanos, nsecs_t recordDurationNanos);
- virtual void run();
+ virtual void run() override;
private:
void postAndWait();
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
index 9b8bc6c..0aa0439 100644
--- a/libs/hwui/renderthread/EglManager.cpp
+++ b/libs/hwui/renderthread/EglManager.cpp
@@ -68,12 +68,12 @@
EglManager::EglManager(RenderThread& thread)
: mRenderThread(thread)
, mEglDisplay(EGL_NO_DISPLAY)
- , mEglConfig(0)
+ , mEglConfig(nullptr)
, mEglContext(EGL_NO_CONTEXT)
, mPBufferSurface(EGL_NO_SURFACE)
, mAllowPreserveBuffer(load_dirty_regions_property())
, mCurrentSurface(EGL_NO_SURFACE)
- , mAtlasMap(NULL)
+ , mAtlasMap(nullptr)
, mAtlasMapSize(0)
, mInFrame(false) {
mCanSetPreserveBuffer = mAllowPreserveBuffer;
@@ -194,7 +194,7 @@
EGLSurface EglManager::createSurface(EGLNativeWindowType window) {
initialize();
- EGLSurface surface = eglCreateWindowSurface(mEglDisplay, mEglConfig, window, NULL);
+ EGLSurface surface = eglCreateWindowSurface(mEglDisplay, mEglConfig, window, nullptr);
LOG_ALWAYS_FATAL_IF(surface == EGL_NO_SURFACE,
"Failed to create EGLSurface for window %p, eglErr = %s",
(void*) window, egl_error_str());
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 4ad1c40..35f5512 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -60,7 +60,7 @@
RenderProxy::RenderProxy(bool translucent, RenderNode* rootRenderNode, IContextFactory* contextFactory)
: mRenderThread(RenderThread::getInstance())
- , mContext(0) {
+ , mContext(nullptr) {
SETUP_TASK(createContext);
args->translucent = translucent;
args->rootRenderNode = rootRenderNode;
@@ -76,15 +76,15 @@
CREATE_BRIDGE1(destroyContext, CanvasContext* context) {
delete args->context;
- return NULL;
+ return nullptr;
}
void RenderProxy::destroyContext() {
if (mContext) {
SETUP_TASK(destroyContext);
args->context = mContext;
- mContext = 0;
- mDrawFrameTask.setContext(NULL, NULL);
+ mContext = nullptr;
+ mDrawFrameTask.setContext(nullptr, nullptr);
// This is also a fence as we need to be certain that there are no
// outstanding mDrawFrame tasks posted before it is destroyed
postAndWait(task);
@@ -93,7 +93,7 @@
CREATE_BRIDGE2(setFrameInterval, RenderThread* thread, nsecs_t frameIntervalNanos) {
args->thread->timeLord().setFrameInterval(args->frameIntervalNanos);
- return NULL;
+ return nullptr;
}
void RenderProxy::setFrameInterval(nsecs_t frameIntervalNanos) {
@@ -105,7 +105,7 @@
CREATE_BRIDGE2(setSwapBehavior, CanvasContext* context, SwapBehavior swapBehavior) {
args->context->setSwapBehavior(args->swapBehavior);
- return NULL;
+ return nullptr;
}
void RenderProxy::setSwapBehavior(SwapBehavior swapBehavior) {
@@ -145,7 +145,7 @@
CREATE_BRIDGE2(updateSurface, CanvasContext* context, ANativeWindow* window) {
args->context->updateSurface(args->window);
- return NULL;
+ return nullptr;
}
void RenderProxy::updateSurface(const sp<ANativeWindow>& window) {
@@ -171,7 +171,7 @@
uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) {
args->context->setup(args->width, args->height, args->lightCenter, args->lightRadius,
args->ambientShadowAlpha, args->spotShadowAlpha);
- return NULL;
+ return nullptr;
}
void RenderProxy::setup(int width, int height, const Vector3& lightCenter, float lightRadius,
@@ -189,7 +189,7 @@
CREATE_BRIDGE2(setOpaque, CanvasContext* context, bool opaque) {
args->context->setOpaque(args->opaque);
- return NULL;
+ return nullptr;
}
void RenderProxy::setOpaque(bool opaque) {
@@ -207,7 +207,7 @@
CREATE_BRIDGE1(destroy, CanvasContext* context) {
args->context->destroy();
- return NULL;
+ return nullptr;
}
void RenderProxy::destroy() {
@@ -221,7 +221,7 @@
CREATE_BRIDGE2(invokeFunctor, RenderThread* thread, Functor* functor) {
CanvasContext::invokeFunctor(*args->thread, args->functor);
- return NULL;
+ return nullptr;
}
void RenderProxy::invokeFunctor(Functor* functor, bool waitForCompletion) {
@@ -242,7 +242,7 @@
CREATE_BRIDGE2(runWithGlContext, CanvasContext* context, RenderTask* task) {
args->context->runWithGlContext(args->task);
- return NULL;
+ return nullptr;
}
void RenderProxy::runWithGlContext(RenderTask* gltask) {
@@ -254,7 +254,7 @@
CREATE_BRIDGE2(createTextureLayer, RenderThread* thread, CanvasContext* context) {
Layer* layer = args->context->createTextureLayer();
- if (!layer) return 0;
+ if (!layer) return nullptr;
return new DeferredLayerUpdater(*args->thread, layer);
}
@@ -269,7 +269,7 @@
CREATE_BRIDGE2(buildLayer, CanvasContext* context, RenderNode* node) {
args->context->buildLayer(args->node);
- return NULL;
+ return nullptr;
}
void RenderProxy::buildLayer(RenderNode* node) {
@@ -303,7 +303,7 @@
CREATE_BRIDGE1(detachSurfaceTexture, DeferredLayerUpdater* layer) {
args->layer->detachSurfaceTexture();
- return NULL;
+ return nullptr;
}
void RenderProxy::detachSurfaceTexture(DeferredLayerUpdater* layer) {
@@ -314,7 +314,7 @@
CREATE_BRIDGE1(destroyHardwareResources, CanvasContext* context) {
args->context->destroyHardwareResources();
- return NULL;
+ return nullptr;
}
void RenderProxy::destroyHardwareResources() {
@@ -325,7 +325,7 @@
CREATE_BRIDGE2(timMemory, RenderThread* thread, int level) {
CanvasContext::trimMemory(*args->thread, args->level);
- return NULL;
+ return nullptr;
}
void RenderProxy::trimMemory(int level) {
@@ -341,7 +341,7 @@
CREATE_BRIDGE0(fence) {
// Intentionally empty
- return NULL;
+ return nullptr;
}
template <typename T>
@@ -355,7 +355,7 @@
CREATE_BRIDGE1(stopDrawing, CanvasContext* context) {
args->context->stopDrawing();
- return NULL;
+ return nullptr;
}
void RenderProxy::stopDrawing() {
@@ -366,7 +366,7 @@
CREATE_BRIDGE1(notifyFramePending, CanvasContext* context) {
args->context->notifyFramePending();
- return NULL;
+ return nullptr;
}
void RenderProxy::notifyFramePending() {
@@ -377,7 +377,7 @@
CREATE_BRIDGE2(dumpProfileInfo, CanvasContext* context, int fd) {
args->context->profiler().dumpData(args->fd);
- return NULL;
+ return nullptr;
}
void RenderProxy::dumpProfileInfo(int fd) {
@@ -389,7 +389,7 @@
CREATE_BRIDGE1(outputLogBuffer, int fd) {
RenderNode::outputLogBuffer(args->fd);
- return NULL;
+ return nullptr;
}
void RenderProxy::outputLogBuffer(int fd) {
@@ -400,15 +400,15 @@
CREATE_BRIDGE4(setTextureAtlas, RenderThread* thread, GraphicBuffer* buffer, int64_t* map, size_t size) {
CanvasContext::setTextureAtlas(*args->thread, args->buffer, args->map, args->size);
- args->buffer->decStrong(0);
- return NULL;
+ args->buffer->decStrong(nullptr);
+ return nullptr;
}
void RenderProxy::setTextureAtlas(const sp<GraphicBuffer>& buffer, int64_t* map, size_t size) {
SETUP_TASK(setTextureAtlas);
args->thread = &mRenderThread;
args->buffer = buffer.get();
- args->buffer->incStrong(0);
+ args->buffer->incStrong(nullptr);
args->map = map;
args->size = size;
post(task);
diff --git a/libs/hwui/renderthread/RenderTask.h b/libs/hwui/renderthread/RenderTask.h
index 1554a16..89c3a7d 100644
--- a/libs/hwui/renderthread/RenderTask.h
+++ b/libs/hwui/renderthread/RenderTask.h
@@ -47,7 +47,7 @@
class ANDROID_API RenderTask {
public:
- ANDROID_API RenderTask() : mNext(0), mRunAt(0) {}
+ ANDROID_API RenderTask() : mNext(nullptr), mRunAt(0) {}
ANDROID_API virtual ~RenderTask() {}
ANDROID_API virtual void run() = 0;
@@ -61,7 +61,7 @@
// Takes ownership of task, caller owns lock and signal
SignalingRenderTask(RenderTask* task, Mutex* lock, Condition* signal)
: mTask(task), mLock(lock), mSignal(signal) {}
- virtual void run();
+ virtual void run() override;
private:
RenderTask* mTask;
@@ -74,12 +74,12 @@
class MethodInvokeRenderTask : public RenderTask {
public:
MethodInvokeRenderTask(RunnableMethod method)
- : mMethod(method), mReturnPtr(0) {}
+ : mMethod(method), mReturnPtr(nullptr) {}
void* payload() { return mData; }
void setReturnPtr(void** retptr) { mReturnPtr = retptr; }
- virtual void run() {
+ virtual void run() override {
void* retval = mMethod(mData);
if (mReturnPtr) {
*mReturnPtr = retval;
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 3e4e965..361a440 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -42,16 +42,16 @@
// Slight delay to give the UI time to push us a new frame before we replay
static const nsecs_t DISPATCH_FRAME_CALLBACKS_DELAY = milliseconds_to_nanoseconds(4);
-TaskQueue::TaskQueue() : mHead(0), mTail(0) {}
+TaskQueue::TaskQueue() : mHead(nullptr), mTail(nullptr) {}
RenderTask* TaskQueue::next() {
RenderTask* ret = mHead;
if (ret) {
mHead = ret->mNext;
if (!mHead) {
- mTail = 0;
+ mTail = nullptr;
}
- ret->mNext = 0;
+ ret->mNext = nullptr;
}
return ret;
}
@@ -71,7 +71,7 @@
mTail = task;
} else {
// Need to find the proper insertion point
- RenderTask* previous = 0;
+ RenderTask* previous = nullptr;
RenderTask* next = mHead;
while (next && next->mRunAt <= task->mRunAt) {
previous = next;
@@ -131,19 +131,19 @@
public:
DispatchFrameCallbacks(RenderThread* rt) : mRenderThread(rt) {}
- virtual void run() {
+ virtual void run() override {
mRenderThread->dispatchFrameCallbacks();
}
};
RenderThread::RenderThread() : Thread(true), Singleton<RenderThread>()
, mNextWakeup(LLONG_MAX)
- , mDisplayEventReceiver(0)
+ , mDisplayEventReceiver(nullptr)
, mVsyncRequested(false)
, mFrameCallbackTaskPending(false)
- , mFrameCallbackTask(0)
- , mRenderState(NULL)
- , mEglManager(NULL) {
+ , mFrameCallbackTask(nullptr)
+ , mRenderState(nullptr)
+ , mEglManager(nullptr) {
mFrameCallbackTask = new DispatchFrameCallbacks(this);
mLooper = new Looper(false);
run("RenderThread");
@@ -342,7 +342,7 @@
if (next->mRunAt <= 0 || next->mRunAt <= systemTime(SYSTEM_TIME_MONOTONIC)) {
next = mQueue.next();
} else {
- next = 0;
+ next = nullptr;
}
}
if (nextWakeup) {
diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h
index 99c2e15..8fc8ca5 100644
--- a/libs/hwui/renderthread/RenderThread.h
+++ b/libs/hwui/renderthread/RenderThread.h
@@ -90,7 +90,7 @@
EglManager& eglManager() { return *mEglManager; }
protected:
- virtual bool threadLoop();
+ virtual bool threadLoop() override;
private:
friend class Singleton<RenderThread>;
diff --git a/libs/hwui/tests/main.cpp b/libs/hwui/tests/main.cpp
index 4efef6f..152e7b2 100644
--- a/libs/hwui/tests/main.cpp
+++ b/libs/hwui/tests/main.cpp
@@ -33,7 +33,7 @@
class ContextFactory : public IContextFactory {
public:
- virtual AnimationContext* createAnimationContext(renderthread::TimeLord& clock) {
+ virtual AnimationContext* createAnimationContext(renderthread::TimeLord& clock) override {
return new AnimationContext(clock);
}
};
@@ -76,7 +76,7 @@
sp<Surface> surface = control->getSurface();
RenderNode* rootNode = new RenderNode();
- rootNode->incStrong(0);
+ rootNode->incStrong(nullptr);
rootNode->mutateStagingProperties().setLeftTopRightBottom(0, 0, width, height);
rootNode->setPropertyFieldsDirty(RenderNode::X | RenderNode::Y);
rootNode->mutateStagingProperties().setClipToBounds(false);
@@ -123,7 +123,7 @@
sleep(5);
- rootNode->decStrong(0);
+ rootNode->decStrong(nullptr);
printf("Success!\n");
return 0;
diff --git a/libs/hwui/utils/PaintUtils.h b/libs/hwui/utils/PaintUtils.h
index 8a4034f..fa0ae03 100644
--- a/libs/hwui/utils/PaintUtils.h
+++ b/libs/hwui/utils/PaintUtils.h
@@ -44,13 +44,13 @@
// TODO: move to a method on android:Paint? replace with SkPaint::nothingToDraw()?
static inline bool paintWillNotDrawText(const SkPaint& paint) {
return paint.getAlpha() == 0
- && paint.getLooper() == NULL
+ && paint.getLooper() == nullptr
&& !paint.getColorFilter()
&& getXfermode(paint.getXfermode()) == SkXfermode::kSrcOver_Mode;
}
static bool isBlendedColorFilter(const SkColorFilter* filter) {
- if (filter == NULL) {
+ if (filter == nullptr) {
return false;
}
return (filter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag) == 0;
diff --git a/libs/hwui/utils/Timing.h b/libs/hwui/utils/Timing.h
index eced987..dd8847a 100644
--- a/libs/hwui/utils/Timing.h
+++ b/libs/hwui/utils/Timing.h
@@ -24,12 +24,12 @@
public:
MethodTimer(const char* name)
: mMethodName(name) {
- gettimeofday(&mStart, NULL);
+ gettimeofday(&mStart, nullptr);
}
~MethodTimer() {
struct timeval stop;
- gettimeofday(&stop, NULL);
+ gettimeofday(&stop, nullptr);
long long elapsed = (stop.tv_sec * 1000000) - (mStart.tv_sec * 1000000)
+ (stop.tv_usec - mStart.tv_usec);
ALOGD("%s took %.2fms", mMethodName, elapsed / 1000.0);