Guard against most unintentionally ephemeral SkAutoFoo instantiations.
I think I applied the trick everywhere possible. Limitations:
- can't be used with templated classes
- all constructors and destructors must be defined inline
A couple of the SkAutoFoo were unused in Skia, Chromium, and Android, so I
deleted them. This change caught the same bugs Cary found in SkPath, plus one
more in SampleApp.
BUG=
R=reed@google.com, caryclark@google.com
Author: mtklein@google.com
Review URL: https://codereview.chromium.org/72603005
git-svn-id: http://skia.googlecode.com/svn/trunk@12301 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 5f53ce8..d25ec3c 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -56,6 +56,7 @@
SkPath* fPath;
bool fSaved;
};
+#define SkAutoDisableOvalCheck(...) SK_REQUIRE_LOCAL_VAR(SkAutoDisableOvalCheck)
class SkAutoDisableDirectionCheck {
public:
@@ -71,6 +72,7 @@
SkPath* fPath;
SkPath::Direction fSaved;
};
+#define SkAutoDisableDirectionCheck(...) SK_REQUIRE_LOCAL_VAR(SkAutoDisableDirectionCheck)
/* This guy's constructor/destructor bracket a path editing operation. It is
used when we know the bounds of the amount we are going to add to the path
@@ -125,6 +127,7 @@
fDegenerate = is_degenerate(*path);
}
};
+#define SkAutoPathBoundsUpdate(...) SK_REQUIRE_LOCAL_VAR(SkAutoPathBoundsUpdate)
////////////////////////////////////////////////////////////////////////////