Reverting r12010 (Use SkPathRef gen id for SkPath::getGenerationID https://codereview.chromium.org/49693002) due to test failures in PathTest on Android



git-svn-id: http://skia.googlecode.com/svn/trunk/include@12012 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkPath.h b/core/SkPath.h
index 9b5dc4b..a6674d9 100644
--- a/core/SkPath.h
+++ b/core/SkPath.h
@@ -16,6 +16,14 @@
 #include "SkTDArray.h"
 #include "SkRefCnt.h"
 
+#ifdef SK_BUILD_FOR_ANDROID
+#define GEN_ID_INC              fGenerationID++
+#define GEN_ID_PTR_INC(ptr)     (ptr)->fGenerationID++
+#else
+#define GEN_ID_INC
+#define GEN_ID_PTR_INC(ptr)
+#endif
+
 class SkReader32;
 class SkWriter32;
 class SkAutoPathBoundsUpdate;
@@ -32,10 +40,10 @@
     SK_DECLARE_INST_COUNT_ROOT(SkPath);
 
     SkPath();
-    SkPath(const SkPath&);
+    SkPath(const SkPath&);  // Copies fGenerationID on Android.
     ~SkPath();
 
-    SkPath& operator=(const SkPath&);
+    SkPath& operator=(const SkPath&);  // Increments fGenerationID on Android.
     friend  SK_API bool operator==(const SkPath&, const SkPath&);
     friend bool operator!=(const SkPath& a, const SkPath& b) {
         return !(a == b);
@@ -72,6 +80,7 @@
     */
     void setFillType(FillType ft) {
         fFillType = SkToU8(ft);
+        GEN_ID_INC;
     }
 
     /** Returns true if the filltype is one of the Inverse variants */
@@ -83,6 +92,7 @@
      */
     void toggleInverseFillType() {
         fFillType ^= 2;
+        GEN_ID_INC;
      }
 
     enum Convexity {
@@ -904,25 +914,16 @@
      *  If buffer is NULL, it still returns the number of bytes.
      */
     uint32_t writeToMemory(void* buffer) const;
-
     /**
      *  Initialized the region from the buffer, returning the number
      *  of bytes actually read.
      */
     uint32_t readFromMemory(const void* buffer);
 
-    /** Returns a non-zero, globally unique value corresponding to the set of verbs
-        and points in the path (but not the fill type [except on Android skbug.com/1762]).
-        Each time the path is modified, a different generation ID will be returned. 
-    */
-    uint32_t getGenerationID() const;
-
 #ifdef SK_BUILD_FOR_ANDROID
-    static const int kPathRefGenIDBitCnt = 30; // leave room for the fill type (skbug.com/1762)
+    uint32_t getGenerationID() const;
     const SkPath* getSourcePath() const;
     void setSourcePath(const SkPath* path);
-#else
-    static const int kPathRefGenIDBitCnt = 32;
 #endif
 
     SkDEBUGCODE(void validate() const;)
@@ -952,6 +953,7 @@
     mutable uint8_t     fDirection;
     mutable SkBool8     fIsOval;
 #ifdef SK_BUILD_FOR_ANDROID
+    uint32_t            fGenerationID;
     const SkPath*       fSourcePath;
 #endif
 
diff --git a/core/SkPathRef.h b/core/SkPathRef.h
index aea0a91..d832944 100644
--- a/core/SkPathRef.h
+++ b/core/SkPathRef.h
@@ -227,13 +227,6 @@
      */
     uint32_t writeSize();
 
-    /**
-     * Gets an ID that uniquely identifies the contents of the path ref. If two path refs have the
-     * same ID then they have the same verbs and points. However, two path refs may have the same
-     * contents but different genIDs.
-     */
-    uint32_t genID() const;
-
 private:
     enum SerializationOffsets {
         kIsFinite_SerializationShift = 25,  // requires 1 bit
@@ -387,6 +380,14 @@
         return reinterpret_cast<intptr_t>(fVerbs) - reinterpret_cast<intptr_t>(fPoints);
     }
 
+    /**
+     * Gets an ID that uniquely identifies the contents of the path ref. If two path refs have the
+     * same ID then they have the same verbs and points. However, two path refs may have the same
+     * contents but different genIDs. Zero is reserved and means an ID has not yet been determined
+     * for the path ref.
+     */
+    int32_t genID() const;
+
     SkDEBUGCODE(void validate() const;)
 
     /**
@@ -412,7 +413,7 @@
     enum {
         kEmptyGenID = 1, // GenID reserved for path ref with zero points and zero verbs.
     };
-    mutable uint32_t    fGenerationID;
+    mutable int32_t     fGenerationID;
     SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use at any time.
 
     typedef SkRefCnt INHERITED;