Remove unused functions and variables from DisplayListCanvas

This also moves some functions that are only called when creating/completing
a displayList into the appropriate constructors and endRecording calls.

Change-Id: I9f6add156d7f476a52766934af713b0f852c8dea
diff --git a/libs/hwui/DisplayListCanvas.cpp b/libs/hwui/DisplayListCanvas.cpp
index aeb1a3d..b96e555 100644
--- a/libs/hwui/DisplayListCanvas.cpp
+++ b/libs/hwui/DisplayListCanvas.cpp
@@ -31,7 +31,7 @@
 namespace android {
 namespace uirenderer {
 
-DisplayListCanvas::DisplayListCanvas()
+DisplayListCanvas::DisplayListCanvas(int width, int height)
     : mState(*this)
     , mResourceCache(ResourceCache::getInstance())
     , mDisplayListData(nullptr)
@@ -41,6 +41,7 @@
     , mDeferredBarrierType(kBarrier_None)
     , mHighContrastText(false)
     , mRestoreSaveCount(-1) {
+    reset(width, height);
 }
 
 DisplayListCanvas::~DisplayListCanvas() {
@@ -48,27 +49,12 @@
             "Destroyed a DisplayListCanvas during a record!");
 }
 
-///////////////////////////////////////////////////////////////////////////////
-// Operations
-///////////////////////////////////////////////////////////////////////////////
-
-DisplayListData* DisplayListCanvas::finishRecording() {
-    mPaintMap.clear();
-    mRegionMap.clear();
-    mPathMap.clear();
-    DisplayListData* data = mDisplayListData;
-    mDisplayListData = nullptr;
-    mSkiaCanvasProxy.reset(nullptr);
-    return data;
-}
-
-void DisplayListCanvas::prepareDirty(float left, float top,
-        float right, float bottom) {
-
+void DisplayListCanvas::reset(int width, int height) {
     LOG_ALWAYS_FATAL_IF(mDisplayListData,
             "prepareDirty called a second time during a recording!");
     mDisplayListData = new DisplayListData();
 
+    mState.setViewport(width, height);
     mState.initializeSaveStack(0, 0, mState.getWidth(), mState.getHeight(), Vector3());
 
     mDeferredBarrierType = kBarrier_InOrder;
@@ -76,16 +62,22 @@
     mRestoreSaveCount = -1;
 }
 
-bool DisplayListCanvas::finish() {
+
+///////////////////////////////////////////////////////////////////////////////
+// Operations
+///////////////////////////////////////////////////////////////////////////////
+
+DisplayListData* DisplayListCanvas::finishRecording() {
     flushRestoreToCount();
     flushTranslate();
-    return false;
-}
 
-void DisplayListCanvas::interrupt() {
-}
-
-void DisplayListCanvas::resume() {
+    mPaintMap.clear();
+    mRegionMap.clear();
+    mPathMap.clear();
+    DisplayListData* data = mDisplayListData;
+    mDisplayListData = nullptr;
+    mSkiaCanvasProxy.reset(nullptr);
+    return data;
 }
 
 void DisplayListCanvas::callDrawGLFunction(Functor *functor) {
diff --git a/libs/hwui/DisplayListCanvas.h b/libs/hwui/DisplayListCanvas.h
index 4982cc9..04a65e3 100644
--- a/libs/hwui/DisplayListCanvas.h
+++ b/libs/hwui/DisplayListCanvas.h
@@ -62,28 +62,18 @@
  */
 class ANDROID_API DisplayListCanvas: public Canvas, public CanvasStateClient {
 public:
-    DisplayListCanvas();
+    DisplayListCanvas(int width, int height);
     virtual ~DisplayListCanvas();
 
-    void insertReorderBarrier(bool enableReorder);
+    void reset(int width, int height);
 
     DisplayListData* finishRecording();
 
 // ----------------------------------------------------------------------------
-// HWUI Frame state operations
-// ----------------------------------------------------------------------------
-
-    void prepareDirty(float left, float top, float right, float bottom);
-    void prepare() { prepareDirty(0.0f, 0.0f, width(), height()); }
-    bool finish();
-    void interrupt();
-    void resume();
-
-// ----------------------------------------------------------------------------
 // HWUI Canvas state operations
 // ----------------------------------------------------------------------------
 
-    void setViewport(int width, int height) { mState.setViewport(width, height); }
+    void insertReorderBarrier(bool enableReorder);
 
     const Rect& getRenderTargetClipBounds() const { return mState.getRenderTargetClipBounds(); }
 
diff --git a/libs/hwui/tests/main.cpp b/libs/hwui/tests/main.cpp
index 80d7029..64d9037 100644
--- a/libs/hwui/tests/main.cpp
+++ b/libs/hwui/tests/main.cpp
@@ -42,15 +42,12 @@
 };
 
 static DisplayListCanvas* startRecording(RenderNode* node) {
-    DisplayListCanvas* renderer = new DisplayListCanvas();
-    renderer->setViewport(node->stagingProperties().getWidth(),
-            node->stagingProperties().getHeight());
-    renderer->prepare();
+    DisplayListCanvas* renderer = new DisplayListCanvas(
+            node->stagingProperties().getWidth(), node->stagingProperties().getHeight());
     return renderer;
 }
 
 static void endRecording(DisplayListCanvas* renderer, RenderNode* node) {
-    renderer->finish();
     node->setStagingDisplayList(renderer->finishRecording());
     delete renderer;
 }