Format the world (or just HWUI)
Test: No code changes, just ran through clang-format
Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
diff --git a/libs/hwui/Animator.cpp b/libs/hwui/Animator.cpp
index b6fbf89..74cf1fd 100644
--- a/libs/hwui/Animator.cpp
+++ b/libs/hwui/Animator.cpp
@@ -44,16 +44,14 @@
, mDuration(300)
, mStartDelay(0)
, mMayRunAsync(true)
- , mPlayTime(0) {
-}
+ , mPlayTime(0) {}
-BaseRenderNodeAnimator::~BaseRenderNodeAnimator() {
-}
+BaseRenderNodeAnimator::~BaseRenderNodeAnimator() {}
void BaseRenderNodeAnimator::checkMutable() {
// Should be impossible to hit as the Java-side also has guards for this
LOG_ALWAYS_FATAL_IF(mStagingPlayState != PlayState::NotStarted,
- "Animator has already been started!");
+ "Animator has already been started!");
}
void BaseRenderNodeAnimator::setInterpolator(Interpolator* interpolator) {
@@ -119,34 +117,36 @@
void BaseRenderNodeAnimator::resolveStagingRequest(Request request) {
switch (request) {
- case Request::Start:
- mPlayTime = (mPlayState == PlayState::Running || mPlayState == PlayState::Reversing) ?
- mPlayTime : 0;
- mPlayState = PlayState::Running;
- mPendingActionUponFinish = Action::None;
- break;
- case Request::Reverse:
- mPlayTime = (mPlayState == PlayState::Running || mPlayState == PlayState::Reversing) ?
- mPlayTime : mDuration;
- mPlayState = PlayState::Reversing;
- mPendingActionUponFinish = Action::None;
- break;
- case Request::Reset:
- mPlayTime = 0;
- mPlayState = PlayState::Finished;
- mPendingActionUponFinish = Action::Reset;
- break;
- case Request::Cancel:
- mPlayState = PlayState::Finished;
- mPendingActionUponFinish = Action::None;
- break;
- case Request::End:
- mPlayTime = mPlayState == PlayState::Reversing ? 0 : mDuration;
- mPlayState = PlayState::Finished;
- mPendingActionUponFinish = Action::End;
- break;
- default:
- LOG_ALWAYS_FATAL("Invalid staging request: %d", static_cast<int>(request));
+ case Request::Start:
+ mPlayTime = (mPlayState == PlayState::Running || mPlayState == PlayState::Reversing)
+ ? mPlayTime
+ : 0;
+ mPlayState = PlayState::Running;
+ mPendingActionUponFinish = Action::None;
+ break;
+ case Request::Reverse:
+ mPlayTime = (mPlayState == PlayState::Running || mPlayState == PlayState::Reversing)
+ ? mPlayTime
+ : mDuration;
+ mPlayState = PlayState::Reversing;
+ mPendingActionUponFinish = Action::None;
+ break;
+ case Request::Reset:
+ mPlayTime = 0;
+ mPlayState = PlayState::Finished;
+ mPendingActionUponFinish = Action::Reset;
+ break;
+ case Request::Cancel:
+ mPlayState = PlayState::Finished;
+ mPendingActionUponFinish = Action::None;
+ break;
+ case Request::End:
+ mPlayTime = mPlayState == PlayState::Reversing ? 0 : mDuration;
+ mPlayState = PlayState::Finished;
+ mPendingActionUponFinish = Action::End;
+ break;
+ default:
+ LOG_ALWAYS_FATAL("Invalid staging request: %d", static_cast<int>(request));
};
}
@@ -182,8 +182,8 @@
if (mStagingPlayState == PlayState::Finished) {
callOnFinishedListener(context);
- } else if (mStagingPlayState == PlayState::Running
- || mStagingPlayState == PlayState::Reversing) {
+ } else if (mStagingPlayState == PlayState::Running ||
+ mStagingPlayState == PlayState::Reversing) {
bool changed = currentPlayTime != mPlayTime || prevFramePlayState != mStagingPlayState;
if (prevFramePlayState != mStagingPlayState) {
transitionToRunning(context);
@@ -197,7 +197,7 @@
if (mPlayState == PlayState::Reversing) {
// Reverse is not supported for animations with a start delay, so here we
// assume no start delay.
- mStartTime = currentFrameTime - (mDuration - mPlayTime);
+ mStartTime = currentFrameTime - (mDuration - mPlayTime);
} else {
// Animation should play forward
if (mPlayTime == 0) {
@@ -223,9 +223,9 @@
}
mStartTime = frameTimeMs + mStartDelay;
if (mStartTime < 0) {
- ALOGW("Ended up with a really weird start time of %" PRId64
- " with frame time %" PRId64 " and start delay %" PRId64,
- mStartTime, frameTimeMs, mStartDelay);
+ ALOGW("Ended up with a really weird start time of %" PRId64 " with frame time %" PRId64
+ " and start delay %" PRId64,
+ mStartTime, frameTimeMs, mStartDelay);
// Set to 0 so that the animate() basically instantly finishes
mStartTime = 0;
}
@@ -247,7 +247,7 @@
updatePlayTime(mDuration);
}
// Reset pending action.
- mPendingActionUponFinish = Action ::None;
+ mPendingActionUponFinish = Action::None;
return true;
}
@@ -276,7 +276,7 @@
float fraction = 1.0f;
if ((mPlayState == PlayState::Running || mPlayState == PlayState::Reversing) && mDuration > 0) {
- fraction = mPlayTime / (float) mDuration;
+ fraction = mPlayTime / (float)mDuration;
}
fraction = MathUtils::clamp(fraction, 0.0f, 1.0f);
@@ -308,35 +308,35 @@
************************************************************/
struct RenderPropertyAnimator::PropertyAccessors {
- RenderNode::DirtyPropertyMask dirtyMask;
- GetFloatProperty getter;
- SetFloatProperty setter;
+ RenderNode::DirtyPropertyMask dirtyMask;
+ GetFloatProperty getter;
+ SetFloatProperty setter;
};
// Maps RenderProperty enum to accessors
const RenderPropertyAnimator::PropertyAccessors RenderPropertyAnimator::PROPERTY_ACCESSOR_LUT[] = {
- {RenderNode::TRANSLATION_X, &RenderProperties::getTranslationX, &RenderProperties::setTranslationX },
- {RenderNode::TRANSLATION_Y, &RenderProperties::getTranslationY, &RenderProperties::setTranslationY },
- {RenderNode::TRANSLATION_Z, &RenderProperties::getTranslationZ, &RenderProperties::setTranslationZ },
- {RenderNode::SCALE_X, &RenderProperties::getScaleX, &RenderProperties::setScaleX },
- {RenderNode::SCALE_Y, &RenderProperties::getScaleY, &RenderProperties::setScaleY },
- {RenderNode::ROTATION, &RenderProperties::getRotation, &RenderProperties::setRotation },
- {RenderNode::ROTATION_X, &RenderProperties::getRotationX, &RenderProperties::setRotationX },
- {RenderNode::ROTATION_Y, &RenderProperties::getRotationY, &RenderProperties::setRotationY },
- {RenderNode::X, &RenderProperties::getX, &RenderProperties::setX },
- {RenderNode::Y, &RenderProperties::getY, &RenderProperties::setY },
- {RenderNode::Z, &RenderProperties::getZ, &RenderProperties::setZ },
- {RenderNode::ALPHA, &RenderProperties::getAlpha, &RenderProperties::setAlpha },
+ {RenderNode::TRANSLATION_X, &RenderProperties::getTranslationX,
+ &RenderProperties::setTranslationX},
+ {RenderNode::TRANSLATION_Y, &RenderProperties::getTranslationY,
+ &RenderProperties::setTranslationY},
+ {RenderNode::TRANSLATION_Z, &RenderProperties::getTranslationZ,
+ &RenderProperties::setTranslationZ},
+ {RenderNode::SCALE_X, &RenderProperties::getScaleX, &RenderProperties::setScaleX},
+ {RenderNode::SCALE_Y, &RenderProperties::getScaleY, &RenderProperties::setScaleY},
+ {RenderNode::ROTATION, &RenderProperties::getRotation, &RenderProperties::setRotation},
+ {RenderNode::ROTATION_X, &RenderProperties::getRotationX, &RenderProperties::setRotationX},
+ {RenderNode::ROTATION_Y, &RenderProperties::getRotationY, &RenderProperties::setRotationY},
+ {RenderNode::X, &RenderProperties::getX, &RenderProperties::setX},
+ {RenderNode::Y, &RenderProperties::getY, &RenderProperties::setY},
+ {RenderNode::Z, &RenderProperties::getZ, &RenderProperties::setZ},
+ {RenderNode::ALPHA, &RenderProperties::getAlpha, &RenderProperties::setAlpha},
};
RenderPropertyAnimator::RenderPropertyAnimator(RenderProperty property, float finalValue)
- : BaseRenderNodeAnimator(finalValue)
- , mPropertyAccess(&(PROPERTY_ACCESSOR_LUT[property])) {
-}
+ : BaseRenderNodeAnimator(finalValue), mPropertyAccess(&(PROPERTY_ACCESSOR_LUT[property])) {}
void RenderPropertyAnimator::onAttached() {
- if (!mHasStartValue
- && mStagingTarget->isPropertyFieldDirty(mPropertyAccess->dirtyMask)) {
+ if (!mHasStartValue && mStagingTarget->isPropertyFieldDirty(mPropertyAccess->dirtyMask)) {
setStartValue((mStagingTarget->stagingProperties().*mPropertyAccess->getter)());
}
}
@@ -385,11 +385,9 @@
* CanvasPropertyPrimitiveAnimator
************************************************************/
-CanvasPropertyPrimitiveAnimator::CanvasPropertyPrimitiveAnimator(
- CanvasPropertyPrimitive* property, float finalValue)
- : BaseRenderNodeAnimator(finalValue)
- , mProperty(property) {
-}
+CanvasPropertyPrimitiveAnimator::CanvasPropertyPrimitiveAnimator(CanvasPropertyPrimitive* property,
+ float finalValue)
+ : BaseRenderNodeAnimator(finalValue), mProperty(property) {}
float CanvasPropertyPrimitiveAnimator::getValue(RenderNode* target) const {
return mProperty->value;
@@ -407,50 +405,44 @@
* CanvasPropertySkPaintAnimator
************************************************************/
-CanvasPropertyPaintAnimator::CanvasPropertyPaintAnimator(
- CanvasPropertyPaint* property, PaintField field, float finalValue)
- : BaseRenderNodeAnimator(finalValue)
- , mProperty(property)
- , mField(field) {
-}
+CanvasPropertyPaintAnimator::CanvasPropertyPaintAnimator(CanvasPropertyPaint* property,
+ PaintField field, float finalValue)
+ : BaseRenderNodeAnimator(finalValue), mProperty(property), mField(field) {}
float CanvasPropertyPaintAnimator::getValue(RenderNode* target) const {
switch (mField) {
- case STROKE_WIDTH:
- return mProperty->value.getStrokeWidth();
- case ALPHA:
- return mProperty->value.getAlpha();
+ case STROKE_WIDTH:
+ return mProperty->value.getStrokeWidth();
+ case ALPHA:
+ return mProperty->value.getAlpha();
}
- LOG_ALWAYS_FATAL("Unknown field %d", (int) mField);
+ LOG_ALWAYS_FATAL("Unknown field %d", (int)mField);
return -1;
}
static uint8_t to_uint8(float value) {
- int c = (int) (value + .5f);
- return static_cast<uint8_t>( c < 0 ? 0 : c > 255 ? 255 : c );
+ int c = (int)(value + .5f);
+ return static_cast<uint8_t>(c < 0 ? 0 : c > 255 ? 255 : c);
}
void CanvasPropertyPaintAnimator::setValue(RenderNode* target, float value) {
switch (mField) {
- case STROKE_WIDTH:
- mProperty->value.setStrokeWidth(value);
- return;
- case ALPHA:
- mProperty->value.setAlpha(to_uint8(value));
- return;
+ case STROKE_WIDTH:
+ mProperty->value.setStrokeWidth(value);
+ return;
+ case ALPHA:
+ mProperty->value.setAlpha(to_uint8(value));
+ return;
}
- LOG_ALWAYS_FATAL("Unknown field %d", (int) mField);
+ LOG_ALWAYS_FATAL("Unknown field %d", (int)mField);
}
uint32_t CanvasPropertyPaintAnimator::dirtyMask() {
return RenderNode::DISPLAY_LIST;
}
-RevealAnimator::RevealAnimator(int centerX, int centerY,
- float startValue, float finalValue)
- : BaseRenderNodeAnimator(finalValue)
- , mCenterX(centerX)
- , mCenterY(centerY) {
+RevealAnimator::RevealAnimator(int centerX, int centerY, float startValue, float finalValue)
+ : BaseRenderNodeAnimator(finalValue), mCenterX(centerX), mCenterY(centerY) {
setStartValue(startValue);
}
@@ -459,8 +451,7 @@
}
void RevealAnimator::setValue(RenderNode* target, float value) {
- target->animatorProperties().mutableRevealClip().set(true,
- mCenterX, mCenterY, value);
+ target->animatorProperties().mutableRevealClip().set(true, mCenterX, mCenterY, value);
}
uint32_t RevealAnimator::dirtyMask() {