Remove android specific srcPath from SkPath
authordjsollen <djsollen@google.com>
Tue, 17 Feb 2015 16:06:32 +0000 (08:06 -0800)
committerCommit bot <commit-bot@chromium.org>
Tue, 17 Feb 2015 16:06:33 +0000 (08:06 -0800)
Review URL: https://codereview.chromium.org/926693002

include/core/SkPath.h
src/core/SkPath.cpp
tests/PathTest.cpp

index 61b1ce474abd466058b301e33a1dd0385672adf6..a0d60599f144fa77a50fd95e5236d13ab20f93a9 100644 (file)
@@ -953,10 +953,8 @@ public:
     */
     uint32_t getGenerationID() const;
 
-#ifdef SK_BUILD_FOR_ANDROID
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
     static const int kPathRefGenIDBitCnt = 30; // leave room for the fill type (skbug.com/1762)
-    const SkPath* getSourcePath() const;
-    void setSourcePath(const SkPath* path);
 #else
     static const int kPathRefGenIDBitCnt = 32;
 #endif
@@ -982,9 +980,6 @@ private:
     mutable uint8_t     fConvexity;
     mutable uint8_t     fDirection;
     mutable SkBool8     fIsVolatile;
-#ifdef SK_BUILD_FOR_ANDROID
-    const SkPath*       fSourcePath;
-#endif
 
     /** Resets all fields other than fPathRef to their initial 'empty' values.
      *  Assumes the caller has already emptied fPathRef.
index 4f5fffb7dd18ae966d9ab5c58c03b22e15979d11..c793396b560db50b02c75ad3e76dd577cc9e16bf 100644 (file)
@@ -125,11 +125,7 @@ private:
 #define INITIAL_LASTMOVETOINDEX_VALUE   ~0
 
 SkPath::SkPath()
-    : fPathRef(SkPathRef::CreateEmpty())
-#ifdef SK_BUILD_FOR_ANDROID
-    , fSourcePath(NULL)
-#endif
-{
+    : fPathRef(SkPathRef::CreateEmpty()) {
     this->resetFields();
     fIsVolatile = false;
 }
@@ -148,9 +144,6 @@ void SkPath::resetFields() {
 SkPath::SkPath(const SkPath& that)
     : fPathRef(SkRef(that.fPathRef.get())) {
     this->copyFields(that);
-#ifdef SK_BUILD_FOR_ANDROID
-    fSourcePath   = that.fSourcePath;
-#endif
     SkDEBUGCODE(that.validate();)
 }
 
@@ -164,9 +157,6 @@ SkPath& SkPath::operator=(const SkPath& that) {
     if (this != &that) {
         fPathRef.reset(SkRef(that.fPathRef.get()));
         this->copyFields(that);
-#ifdef SK_BUILD_FOR_ANDROID
-        fSourcePath = that.fSourcePath;
-#endif
     }
     SkDEBUGCODE(this->validate();)
     return *this;
@@ -198,9 +188,6 @@ void SkPath::swap(SkPath& that) {
         SkTSwap<uint8_t>(fConvexity, that.fConvexity);
         SkTSwap<uint8_t>(fDirection, that.fDirection);
         SkTSwap<SkBool8>(fIsVolatile, that.fIsVolatile);
-#ifdef SK_BUILD_FOR_ANDROID
-        SkTSwap<const SkPath*>(fSourcePath, that.fSourcePath);
-#endif
     }
 }
 
@@ -308,23 +295,13 @@ bool SkPath::conservativelyContainsRect(const SkRect& rect) const {
 
 uint32_t SkPath::getGenerationID() const {
     uint32_t genID = fPathRef->genID();
-#ifdef SK_BUILD_FOR_ANDROID
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
     SkASSERT((unsigned)fFillType < (1 << (32 - kPathRefGenIDBitCnt)));
     genID |= static_cast<uint32_t>(fFillType) << kPathRefGenIDBitCnt;
 #endif
     return genID;
 }
 
-#ifdef SK_BUILD_FOR_ANDROID
-const SkPath* SkPath::getSourcePath() const {
-    return fSourcePath;
-}
-
-void SkPath::setSourcePath(const SkPath* path) {
-    fSourcePath = path;
-}
-#endif
-
 void SkPath::reset() {
     SkDEBUGCODE(this->validate();)
 
index d1c28ec0fb50ddb8ed21fdaebbf99bc2f3d7890e..0946a0ee51eb6c87921ed561fe874cc2ed3c4388 100644 (file)
@@ -225,57 +225,6 @@ static void test_path_close_issue1474(skiatest::Reporter* reporter) {
     REPORTER_ASSERT(reporter, 95 == last.fY);
 }
 
-static void test_android_specific_behavior(skiatest::Reporter* reporter) {
-#ifdef SK_BUILD_FOR_ANDROID
-    // Make sure we treat fGenerationID and fSourcePath correctly for each of
-    // copy, assign, rewind, reset, and swap.
-    SkPath original, source, anotherSource;
-    original.setSourcePath(&source);
-    original.moveTo(0, 0);
-    original.lineTo(1, 1);
-    REPORTER_ASSERT(reporter, original.getSourcePath() == &source);
-
-    uint32_t copyID, assignID;
-
-    // Test copy constructor.  Copy generation ID, copy source path.
-    SkPath copy(original);
-    REPORTER_ASSERT(reporter, copy.getGenerationID() == original.getGenerationID());
-    REPORTER_ASSERT(reporter, copy.getSourcePath() == original.getSourcePath());
-
-    // Test assigment operator.  Change generation ID, copy source path.
-    SkPath assign;
-    assignID = assign.getGenerationID();
-    assign = original;
-    REPORTER_ASSERT(reporter, assign.getGenerationID() != assignID);
-    REPORTER_ASSERT(reporter, assign.getSourcePath() == original.getSourcePath());
-
-    // Test rewind.  Change generation ID, don't touch source path.
-    copyID = copy.getGenerationID();
-    copy.rewind();
-    REPORTER_ASSERT(reporter, copy.getGenerationID() != copyID);
-    REPORTER_ASSERT(reporter, copy.getSourcePath() == original.getSourcePath());
-
-    // Test reset.  Change generation ID, don't touch source path.
-    assignID = assign.getGenerationID();
-    assign.reset();
-    REPORTER_ASSERT(reporter, assign.getGenerationID() != assignID);
-    REPORTER_ASSERT(reporter, assign.getSourcePath() == original.getSourcePath());
-
-    // Test swap.  Swap the generation IDs, swap source paths.
-    copy.reset();
-    copy.moveTo(2, 2);
-    copy.setSourcePath(&anotherSource);
-    copyID = copy.getGenerationID();
-    assign.moveTo(3, 3);
-    assignID = assign.getGenerationID();
-    copy.swap(assign);
-    REPORTER_ASSERT(reporter, copy.getGenerationID() != copyID);
-    REPORTER_ASSERT(reporter, assign.getGenerationID() != assignID);
-    REPORTER_ASSERT(reporter, copy.getSourcePath() == original.getSourcePath());
-    REPORTER_ASSERT(reporter, assign.getSourcePath() == &anotherSource);
-#endif
-}
-
 static void test_gen_id(skiatest::Reporter* reporter) {
     SkPath a, b;
     REPORTER_ASSERT(reporter, a.getGenerationID() == b.getGenerationID());
@@ -3748,7 +3697,6 @@ DEF_TEST(Paths, reporter) {
     test_crbug_170666();
     test_bad_cubic_crbug229478();
     test_bad_cubic_crbug234190();
-    test_android_specific_behavior(reporter);
     test_gen_id(reporter);
     test_path_close_issue1474(reporter);
     test_path_to_region(reporter);