New DisplayList v2

First step of many

* Pulls SkLiteDL and SkLiteRecorder into HWUI

* forceDark shifted to be a sync-time transformation
instead of record time. No meaningful behavior change,
but much more flexible heuristics are possible this
way.

Test: build, poked around with forceDark on

Change-Id: I7b7cec5b7fd7c2b18823b4d92d821cf5898f9b88
diff --git a/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp b/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp
index eb67e6c..48bc8e4 100644
--- a/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp
+++ b/libs/hwui/tests/unit/RenderNodeDrawableTests.cpp
@@ -18,13 +18,13 @@
 #include <gtest/gtest.h>
 
 #include <SkClipStack.h>
-#include <SkLiteRecorder.h>
 #include <SkSurface_Base.h>
 #include <string.h>
 #include "AnimationContext.h"
 #include "DamageAccumulator.h"
 #include "FatalTestCanvas.h"
 #include "IContextFactory.h"
+#include "RecordingCanvas.h"
 #include "SkiaCanvas.h"
 #include "pipeline/skia/SkiaDisplayList.h"
 #include "pipeline/skia/SkiaOpenGLPipeline.h"
@@ -44,8 +44,8 @@
                 canvas.drawColor(Color::Red_500, SkBlendMode::kSrcOver);
             });
 
-    SkLiteDL skLiteDL;
-    SkLiteRecorder canvas;
+    DisplayListData skLiteDL;
+    RecordingCanvas canvas;
     canvas.reset(&skLiteDL, SkIRect::MakeWH(1, 1));
     canvas.translate(100, 100);
     RenderNodeDrawable drawable(rootNode.get(), &canvas);
diff --git a/libs/hwui/tests/unit/SkiaDisplayListTests.cpp b/libs/hwui/tests/unit/SkiaDisplayListTests.cpp
index 88d6dcf..6c398ee 100644
--- a/libs/hwui/tests/unit/SkiaDisplayListTests.cpp
+++ b/libs/hwui/tests/unit/SkiaDisplayListTests.cpp
@@ -36,32 +36,36 @@
 }
 
 TEST(SkiaDisplayList, reset) {
-    SkiaDisplayList skiaDL;
+    std::unique_ptr<SkiaDisplayList> skiaDL;
+    {
+        SkiaRecordingCanvas canvas{nullptr, 1, 1};
+        canvas.drawColor(0, SkBlendMode::kSrc);
+        skiaDL.reset(canvas.finishRecording());
+    }
 
     SkCanvas dummyCanvas;
     RenderNodeDrawable drawable(nullptr, &dummyCanvas);
-    skiaDL.mChildNodes.emplace_back(nullptr, &dummyCanvas);
-    skiaDL.mChildFunctors.emplace_back(nullptr, nullptr, &dummyCanvas);
-    skiaDL.mMutableImages.push_back(nullptr);
-    skiaDL.mVectorDrawables.push_back(nullptr);
-    skiaDL.mDisplayList.drawAnnotation(SkRect::MakeWH(200, 200), "testAnnotation", nullptr);
-    skiaDL.mProjectionReceiver = &drawable;
+    skiaDL->mChildNodes.emplace_back(nullptr, &dummyCanvas);
+    skiaDL->mChildFunctors.emplace_back(nullptr, nullptr, &dummyCanvas);
+    skiaDL->mMutableImages.push_back(nullptr);
+    skiaDL->mVectorDrawables.push_back(nullptr);
+    skiaDL->mProjectionReceiver = &drawable;
 
-    ASSERT_FALSE(skiaDL.mChildNodes.empty());
-    ASSERT_FALSE(skiaDL.mChildFunctors.empty());
-    ASSERT_FALSE(skiaDL.mMutableImages.empty());
-    ASSERT_FALSE(skiaDL.mVectorDrawables.empty());
-    ASSERT_FALSE(skiaDL.isEmpty());
-    ASSERT_TRUE(skiaDL.mProjectionReceiver);
+    ASSERT_FALSE(skiaDL->mChildNodes.empty());
+    ASSERT_FALSE(skiaDL->mChildFunctors.empty());
+    ASSERT_FALSE(skiaDL->mMutableImages.empty());
+    ASSERT_FALSE(skiaDL->mVectorDrawables.empty());
+    ASSERT_FALSE(skiaDL->isEmpty());
+    ASSERT_TRUE(skiaDL->mProjectionReceiver);
 
-    skiaDL.reset();
+    skiaDL->reset();
 
-    ASSERT_TRUE(skiaDL.mChildNodes.empty());
-    ASSERT_TRUE(skiaDL.mChildFunctors.empty());
-    ASSERT_TRUE(skiaDL.mMutableImages.empty());
-    ASSERT_TRUE(skiaDL.mVectorDrawables.empty());
-    ASSERT_TRUE(skiaDL.isEmpty());
-    ASSERT_FALSE(skiaDL.mProjectionReceiver);
+    ASSERT_TRUE(skiaDL->mChildNodes.empty());
+    ASSERT_TRUE(skiaDL->mChildFunctors.empty());
+    ASSERT_TRUE(skiaDL->mMutableImages.empty());
+    ASSERT_TRUE(skiaDL->mVectorDrawables.empty());
+    ASSERT_TRUE(skiaDL->isEmpty());
+    ASSERT_FALSE(skiaDL->mProjectionReceiver);
 }
 
 TEST(SkiaDisplayList, reuseDisplayList) {
diff --git a/libs/hwui/tests/unit/SkiaPipelineTests.cpp b/libs/hwui/tests/unit/SkiaPipelineTests.cpp
index 26b6000..a9124d9 100644
--- a/libs/hwui/tests/unit/SkiaPipelineTests.cpp
+++ b/libs/hwui/tests/unit/SkiaPipelineTests.cpp
@@ -18,7 +18,6 @@
 #include <gtest/gtest.h>
 
 #include <SkClipStack.h>
-#include <SkLiteRecorder.h>
 #include <SkSurface_Base.h>
 #include <string.h>
 #include "AnimationContext.h"
diff --git a/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp b/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp
index ad5fdac..479c462 100644
--- a/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp
+++ b/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp
@@ -18,7 +18,6 @@
 #include <gtest/gtest.h>
 
 #include <SkClipStack.h>
-#include <SkLiteRecorder.h>
 #include <SkSurface_Base.h>
 #include <string.h>
 #include "AnimationContext.h"