Reland "Add vis of android device clip restriction, fix regular clip vis on gpu"

This reverts commit 66f7ca63b15f054f435801c2fa1fe1227dc2f929.

Reason for revert: Attempt initializing all new members

Original change's description:
> Revert "Add vis of android device clip restriction, fix regular clip vis on gpu"
> 
> This reverts commit aac8e44d5c57553561ec3cf58be686f1539f2175.
> 
> Reason for revert: Attempted fix didn't work, still producing red on tree.
> 
> Original change's description:
> > Add vis of android device clip restriction, fix regular clip vis on gpu
> > 
> > Change-Id: I103025f4a9955c46f34b02d4e3ef1626796029e1
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263521
> > Commit-Queue: Nathaniel Nifong <nifong@google.com>
> > Reviewed-by: Kevin Lubick <kjlubick@google.com>
> 
> TBR=kjlubick@google.com,nifong@google.com
> 
> Change-Id: Ia1f3a53b829ceb15467da12a104d87d7b1e7dad9
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263697
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,kjlubick@google.com,nifong@google.com

Change-Id: I5acc8a1f0b06e0490125077596d2c6366856d49c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263703
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
diff --git a/experimental/wasm-skp-debugger/debugger_bindings.cpp b/experimental/wasm-skp-debugger/debugger_bindings.cpp
index 6eeaa7e..eb6af68 100644
--- a/experimental/wasm-skp-debugger/debugger_bindings.cpp
+++ b/experimental/wasm-skp-debugger/debugger_bindings.cpp
@@ -157,6 +157,12 @@
       }
       fLayerManager->setClipVizColor(SkColor(color));
     }
+    void setAndroidClipViz(bool on) {
+      for (int i=0; i < frames.size(); i++) {
+        frames[i]->setAndroidClipViz(on);
+      }
+      // doesn't matter in layers
+    }
     // The two operations below only apply to the current frame, because they concern the command
     // list, which is unique to each frame.
     void deleteCommand(int index) {
@@ -315,6 +321,7 @@
           debugCanvas->setOverdrawViz(false);
           debugCanvas->setDrawGpuOpBounds(false);
           debugCanvas->setClipVizColor(SK_ColorTRANSPARENT);
+          debugCanvas->setAndroidClipViz(false);
           frames.push_back(std::move(debugCanvas));
           i++;
         }
@@ -447,7 +454,8 @@
     .function("setCommandVisibility", &SkpDebugPlayer::setCommandVisibility)
     .function("setGpuOpBounds",       &SkpDebugPlayer::setGpuOpBounds)
     .function("setInspectedLayer",    &SkpDebugPlayer::setInspectedLayer)
-    .function("setOverdrawVis",       &SkpDebugPlayer::setOverdrawVis);
+    .function("setOverdrawVis",       &SkpDebugPlayer::setOverdrawVis)
+    .function("setAndroidClipViz",    &SkpDebugPlayer::setAndroidClipViz);
 
   // Structs used as arguments or returns to the functions above
   value_object<SkIRect>("SkIRect")
diff --git a/tools/debugger/DebugCanvas.cpp b/tools/debugger/DebugCanvas.cpp
index 578b001..96254e0 100644
--- a/tools/debugger/DebugCanvas.cpp
+++ b/tools/debugger/DebugCanvas.cpp
@@ -32,6 +32,7 @@
     // Constants used in Annotations by Android for keeping track of layers
     static constexpr char kOffscreenLayerDraw[] = "OffscreenLayerDraw";
     static constexpr char kSurfaceID[] = "SurfaceID";
+    static constexpr char kAndroidClip[] = "AndroidDeviceClipRestriction";
 } // namespace
 
 class DebugPaintFilterCanvas : public SkPaintFilterCanvas {
@@ -115,6 +116,10 @@
     DebugPaintFilterCanvas filterCanvas(originalCanvas);
     SkCanvas* finalCanvas = fOverdrawViz ? &filterCanvas : originalCanvas;
 
+    if (!fAndroidClip.isEmpty()) {
+        finalCanvas->clipRect(fAndroidClip);
+    }
+
     // If we have a GPU backend we can also visualize the op information
     GrAuditTrail* at = nullptr;
     if (fDrawGpuOpBounds || m != -1) {
@@ -141,10 +146,6 @@
 
     if (SkColorGetA(fClipVizColor) != 0) {
         finalCanvas->save();
-#define LARGE_COORD 1000000000
-        finalCanvas->clipRect(
-                SkRect::MakeLTRB(-LARGE_COORD, -LARGE_COORD, LARGE_COORD, LARGE_COORD),
-                kReverseDifference_SkClipOp);
         SkPaint clipPaint;
         clipPaint.setColor(fClipVizColor);
         finalCanvas->drawPaint(clipPaint);
@@ -155,6 +156,13 @@
     fClip   = finalCanvas->getDeviceClipBounds();
     finalCanvas->restoreToCount(saveCount);
 
+    if (fShowAndroidClip) {
+        // Draw visualization of android device clip restriction
+        SkPaint androidClipPaint;
+        androidClipPaint.setARGB(80, 255, 100, 0);
+        finalCanvas->drawRect(fAndroidClip, androidClipPaint);
+    }
+
     // draw any ops if required and issue a full reset onto GrAuditTrail
     if (at) {
         // just in case there is global reordering, we flush the canvas before querying
@@ -335,6 +343,12 @@
             return; // don't record it
         }
     }
+    if (strcmp(kAndroidClip, key) == 0) {
+        // Store this frame's android device clip restriction for visualization later.
+        // This annotation stands in place of the androidFramework_setDeviceClipRestriction
+        // which is unrecordable.
+        fAndroidClip = rect;
+    }
     this->addDrawCommand(new DrawAnnotationCommand(rect, key, sk_ref_sp(value)));
 }
 
diff --git a/tools/debugger/DebugCanvas.h b/tools/debugger/DebugCanvas.h
index 9053f7c..011a308 100644
--- a/tools/debugger/DebugCanvas.h
+++ b/tools/debugger/DebugCanvas.h
@@ -59,6 +59,8 @@
      */
     void setClipVizColor(SkColor clipVizColor) { this->fClipVizColor = clipVizColor; }
 
+    void setAndroidClipViz(bool enable) {this->fShowAndroidClip = enable; }
+
     void setDrawGpuOpBounds(bool drawGpuOpBounds) { fDrawGpuOpBounds = drawGpuOpBounds; }
 
     bool getDrawGpuOpBounds() const { return fDrawGpuOpBounds; }
@@ -225,6 +227,7 @@
     bool    fOverdrawViz;
     SkColor fClipVizColor;
     bool    fDrawGpuOpBounds;
+    bool    fShowAndroidClip;
 
     // When not negative, indicates the render node id of the layer represented by the next
     // drawPicture call.
@@ -236,6 +239,7 @@
     // May be set when DebugCanvas is used in playing back an animation.
     // Only used for passing to fLayerManager to identify itself.
     int fFrame = -1;
+    SkRect fAndroidClip = SkRect::MakeEmpty();
 
     /**
         Adds the command to the class' vector of commands.