Format the world (or just HWUI)

Test: No code changes, just ran through clang-format
Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
diff --git a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
index ca93925..46d4ae7 100644
--- a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
+++ b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
@@ -15,33 +15,34 @@
  */
 
 #include "RenderNodeDrawable.h"
+#include <SkPaintFilterCanvas.h>
 #include "RenderNode.h"
 #include "SkiaDisplayList.h"
 #include "SkiaPipeline.h"
 #include "utils/TraceUtils.h"
-#include <SkPaintFilterCanvas.h>
 
 namespace android {
 namespace uirenderer {
 namespace skiapipeline {
 
-void RenderNodeDrawable::drawBackwardsProjectedNodes(SkCanvas* canvas, const SkiaDisplayList& displayList,
-        int nestLevel) {
+void RenderNodeDrawable::drawBackwardsProjectedNodes(SkCanvas* canvas,
+                                                     const SkiaDisplayList& displayList,
+                                                     int nestLevel) {
     LOG_ALWAYS_FATAL_IF(0 == nestLevel && !displayList.mProjectionReceiver);
     for (auto& child : displayList.mChildNodes) {
         const RenderProperties& childProperties = child.getNodeProperties();
 
-        //immediate children cannot be projected on their parent
+        // immediate children cannot be projected on their parent
         if (childProperties.getProjectBackwards() && nestLevel > 0) {
             SkAutoCanvasRestore acr2(canvas, true);
-            //Apply recorded matrix, which is a total matrix saved at recording time to avoid
-            //replaying all DL commands.
+            // Apply recorded matrix, which is a total matrix saved at recording time to avoid
+            // replaying all DL commands.
             canvas->concat(child.getRecordedMatrix());
             child.drawContent(canvas);
         }
 
-        //skip walking sub-nodes if current display list contains a receiver with exception of
-        //level 0, which is a known receiver
+        // skip walking sub-nodes if current display list contains a receiver with exception of
+        // level 0, which is a known receiver
         if (0 == nestLevel || !displayList.containsProjectionReceiver()) {
             SkAutoCanvasRestore acr(canvas, true);
             SkMatrix nodeMatrix;
@@ -51,9 +52,9 @@
             hwuiMatrix.copyTo(nodeMatrix);
             canvas->concat(nodeMatrix);
             SkiaDisplayList* childDisplayList = static_cast<SkiaDisplayList*>(
-                (const_cast<DisplayList*>(childNode->getDisplayList())));
+                    (const_cast<DisplayList*>(childNode->getDisplayList())));
             if (childDisplayList) {
-                drawBackwardsProjectedNodes(canvas, *childDisplayList, nestLevel+1);
+                drawBackwardsProjectedNodes(canvas, *childDisplayList, nestLevel + 1);
             }
         }
     }
@@ -92,8 +93,8 @@
 }
 
 void RenderNodeDrawable::onDraw(SkCanvas* canvas) {
-    //negative and positive Z order are drawn out of order, if this render node drawable is in
-    //a reordering section
+    // negative and positive Z order are drawn out of order, if this render node drawable is in
+    // a reordering section
     if ((!mInReorderingSection) || MathUtils::isZero(mRenderNode->properties().getZ())) {
         this->forceDraw(canvas);
     }
@@ -118,13 +119,13 @@
 
     SkAutoCanvasRestore acr(canvas, true);
     const RenderProperties& properties = this->getNodeProperties();
-    //pass this outline to the children that may clip backward projected nodes
-    displayList->mProjectedOutline = displayList->containsProjectionReceiver()
-            ? &properties.getOutline() : nullptr;
+    // pass this outline to the children that may clip backward projected nodes
+    displayList->mProjectedOutline =
+            displayList->containsProjectionReceiver() ? &properties.getOutline() : nullptr;
     if (!properties.getProjectBackwards()) {
         drawContent(canvas);
         if (mProjectedDisplayList) {
-            acr.restore(); //draw projected children using parent matrix
+            acr.restore();  // draw projected children using parent matrix
             LOG_ALWAYS_FATAL_IF(!mProjectedDisplayList->mProjectedOutline);
             const bool shouldClip = mProjectedDisplayList->mProjectedOutline->getPath();
             SkAutoCanvasRestore acr2(canvas, shouldClip);
@@ -138,12 +139,10 @@
     displayList->mProjectedOutline = nullptr;
 }
 
-static bool layerNeedsPaint(const LayerProperties& properties,
-                            float alphaMultiplier, SkPaint* paint) {
-    if (alphaMultiplier < 1.0f
-            || properties.alpha() < 255
-            || properties.xferMode() != SkBlendMode::kSrcOver
-            || properties.colorFilter() != nullptr) {
+static bool layerNeedsPaint(const LayerProperties& properties, float alphaMultiplier,
+                            SkPaint* paint) {
+    if (alphaMultiplier < 1.0f || properties.alpha() < 255 ||
+        properties.xferMode() != SkBlendMode::kSrcOver || properties.colorFilter() != nullptr) {
         paint->setAlpha(properties.alpha() * alphaMultiplier);
         paint->setBlendMode(properties.xferMode());
         paint->setColorFilter(sk_ref_sp(properties.colorFilter()));
@@ -155,13 +154,14 @@
 class AlphaFilterCanvas : public SkPaintFilterCanvas {
 public:
     AlphaFilterCanvas(SkCanvas* canvas, float alpha) : SkPaintFilterCanvas(canvas), mAlpha(alpha) {}
+
 protected:
     bool onFilter(SkTCopyOnFirstWrite<SkPaint>* paint, Type t) const override {
         SkTLazy<SkPaint> defaultPaint;
         if (!*paint) {
             paint->init(*defaultPaint.init());
         }
-        paint->writable()->setAlpha((uint8_t)(*paint)->getAlpha()*mAlpha);
+        paint->writable()->setAlpha((uint8_t)(*paint)->getAlpha() * mAlpha);
         return true;
     }
     void onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) override {
@@ -169,6 +169,7 @@
         // get their alpha applied. THe default SkPaintFilterCanvas::onDrawDrawable does not unroll.
         drawable->draw(this, matrix);
     }
+
 private:
     float mAlpha;
 };
@@ -189,7 +190,7 @@
         displayList->mProjectedReceiverParentMatrix = canvas->getTotalMatrix();
     }
 
-    //TODO should we let the bound of the drawable do this for us?
+    // TODO should we let the bound of the drawable do this for us?
     const SkRect bounds = SkRect::MakeWH(properties.getWidth(), properties.getHeight());
     bool quickRejected = properties.getClipToBounds() && canvas->quickReject(bounds);
     if (!quickRejected) {
@@ -221,7 +222,7 @@
                 }
             }
 
-        // composing a software layer with alpha
+            // composing a software layer with alpha
         } else if (properties.effectiveLayerType() == LayerType::Software) {
             SkPaint paint;
             bool needsLayer = layerNeedsPaint(layerProperties, alphaMultiplier, &paint);
@@ -246,7 +247,7 @@
 }
 
 void RenderNodeDrawable::setViewProperties(const RenderProperties& properties, SkCanvas* canvas,
-        float* alphaMultiplier) {
+                                           float* alphaMultiplier) {
     if (properties.getLeft() != 0 || properties.getTop() != 0) {
         canvas->translate(properties.getLeft(), properties.getTop());
     }
@@ -266,7 +267,7 @@
     int clipFlags = properties.getClippingFlags();
     if (properties.getAlpha() < 1) {
         if (isLayer) {
-            clipFlags &= ~CLIP_TO_BOUNDS; // bounds clipping done by layer
+            clipFlags &= ~CLIP_TO_BOUNDS;  // bounds clipping done by layer
         }
         if (CC_LIKELY(isLayer || !properties.getHasOverlappingRendering())) {
             *alphaMultiplier = properties.getAlpha();
@@ -275,18 +276,18 @@
             Rect layerBounds(0, 0, properties.getWidth(), properties.getHeight());
             if (clipFlags) {
                 properties.getClippingRectForFlags(clipFlags, &layerBounds);
-                clipFlags = 0; // all clipping done by savelayer
+                clipFlags = 0;  // all clipping done by savelayer
             }
-            SkRect bounds = SkRect::MakeLTRB(layerBounds.left, layerBounds.top,
-                    layerBounds.right, layerBounds.bottom);
-            canvas->saveLayerAlpha(&bounds, (int) (properties.getAlpha() * 255));
+            SkRect bounds = SkRect::MakeLTRB(layerBounds.left, layerBounds.top, layerBounds.right,
+                                             layerBounds.bottom);
+            canvas->saveLayerAlpha(&bounds, (int)(properties.getAlpha() * 255));
         }
 
         if (CC_UNLIKELY(ATRACE_ENABLED() && properties.promotedToLayer())) {
             // pretend alpha always causes savelayer to warn about
             // performance problem affecting old versions
             ATRACE_FORMAT("alpha caused saveLayer %dx%d", properties.getWidth(),
-                    properties.getHeight());
+                          properties.getHeight());
         }
     }
 
@@ -312,6 +313,6 @@
     }
 }
 
-}; // namespace skiapipeline
-}; // namespace uirenderer
-}; // namespace android
+};  // namespace skiapipeline
+};  // namespace uirenderer
+};  // namespace android