SkDrawCommand cleanup

https://codereview.chromium.org/12989030/



git-svn-id: http://skia.googlecode.com/svn/trunk@8355 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/SkDrawCommand.h b/debugger/SkDrawCommand.h
index 6acc24f..fc812b5 100644
--- a/debugger/SkDrawCommand.h
+++ b/debugger/SkDrawCommand.h
@@ -226,10 +226,13 @@
 class DrawData : public SkDrawCommand {
 public:
     DrawData(const void* data, size_t length);
+    virtual ~DrawData() { delete [] fData; }
     virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
 private:
-    const void* fData;
+    void*  fData;
     size_t fLength;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class DrawOval : public SkDrawCommand {
@@ -260,8 +263,8 @@
     virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
 
 private:
-    SkPath  fPath;
-    SkPaint fPaint;
+    SkPath   fPath;
+    SkPaint  fPaint;
     SkBitmap fBitmap;
 
     typedef SkDrawCommand INHERITED;
@@ -272,7 +275,9 @@
     DrawPicture(SkPicture& picture);
     virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
 private:
-    SkPicture* fPicture;
+    SkPicture fPicture;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class DrawPoints : public SkDrawCommand {
@@ -297,14 +302,17 @@
 class DrawTextC : public SkDrawCommand {
 public:
     DrawTextC(const void* text, size_t byteLength, SkScalar x, SkScalar y,
-            const SkPaint& paint);
+              const SkPaint& paint);
+    virtual ~DrawTextC() { delete [] fText; }
     virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
 private:
-    const void* fText;
-    size_t fByteLength;
+    void*    fText;
+    size_t   fByteLength;
     SkScalar fX;
     SkScalar fY;
-    const SkPaint* fPaint;
+    SkPaint  fPaint;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class DrawPosText : public SkDrawCommand {
@@ -314,23 +322,28 @@
     virtual ~DrawPosText() { delete [] fPos; delete [] fText; }
     virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
 private:
+    char*    fText;
+    size_t   fByteLength;
     SkPoint* fPos;
-    char* fText;
-    size_t fByteLength;
-    SkPaint fPaint;
+    SkPaint  fPaint;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class DrawTextOnPath : public SkDrawCommand {
 public:
     DrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
                    const SkMatrix* matrix, const SkPaint& paint);
+    virtual ~DrawTextOnPath() { delete [] fText; }
     virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
 private:
-    const SkMatrix* fMatrix;
-    const void* fText;
-    size_t fByteLength;
-    const SkPath* fPath;
-    const SkPaint* fPaint;
+    void*    fText;
+    size_t   fByteLength;
+    SkPath   fPath;
+    SkMatrix fMatrix;
+    SkPaint  fPaint;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class DrawPosTextH : public SkDrawCommand {
@@ -341,10 +354,10 @@
     virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
 private:
     SkScalar* fXpos;
-    char* fText;
-    size_t fByteLength;
-    SkScalar fConstY;
-    SkPaint fPaint;
+    char*     fText;
+    size_t    fByteLength;
+    SkScalar  fConstY;
+    SkPaint   fPaint;
 
     typedef SkDrawCommand INHERITED;
 };
@@ -370,6 +383,8 @@
 private:
     SkRRect fRRect;
     SkPaint fPaint;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class DrawSprite : public SkDrawCommand {
@@ -379,30 +394,37 @@
     virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
     virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
 private:
-    const SkPaint* fPaint;
-    int fLeft;
-    int fTop;
-    const SkBitmap* fBitmap;
+    SkBitmap fBitmap;
+    int      fLeft;
+    int      fTop;
+    SkPaint  fPaint;
+    SkPaint* fPaintPtr;
     SkBitmap fResizedBitmap;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class DrawVertices : public SkDrawCommand {
 public:
     DrawVertices(SkCanvas::VertexMode vmode, int vertexCount,
-            const SkPoint vertices[], const SkPoint texs[], const SkColor colors[],
-            SkXfermode* xfermode, const uint16_t indices[], int indexCount,
-            const SkPaint& paint);
+                const SkPoint vertices[], const SkPoint texs[], 
+                const SkColor colors[], SkXfermode* xfermode, 
+                const uint16_t indices[], int indexCount,
+                const SkPaint& paint);
+    virtual ~DrawVertices();
     virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
 private:
     SkCanvas::VertexMode fVmode;
-    int fVertexCount;
-    int fIndexCount;
-    const SkPoint* fVertices;
-    const SkPoint* fTexs;
-    const SkColor* fColors;
-    const uint16_t* fIndices;
+    int         fVertexCount;
+    SkPoint*    fVertices;
+    SkPoint*    fTexs;
+    SkColor*    fColors;
     SkXfermode* fXfermode;
-    const SkPaint* fPaint;
+    uint16_t*   fIndices;
+    int         fIndexCount;
+    SkPaint     fPaint;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class Rotate : public SkDrawCommand {
@@ -411,6 +433,8 @@
     virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
 private:
     SkScalar fDegrees;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class Save : public SkDrawCommand {
@@ -453,6 +477,8 @@
 private:
     SkScalar fSx;
     SkScalar fSy;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class SetMatrix : public SkDrawCommand {
@@ -461,6 +487,8 @@
     virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
 private:
     SkMatrix fMatrix;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class Skew : public SkDrawCommand {
@@ -470,6 +498,8 @@
 private:
     SkScalar fSx;
     SkScalar fSy;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 class Translate : public SkDrawCommand {
@@ -483,6 +513,8 @@
 private:
     SkScalar fDx;
     SkScalar fDy;
+
+    typedef SkDrawCommand INHERITED;
 };
 
 #endif