| Index: src/core/SkMatrix.cpp
|
| diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
|
| index 3a5ab622197694edfa89358ee3187b1ccff07042..d802e1c5653142add278d7402a973d70ed959375 100644
|
| --- a/src/core/SkMatrix.cpp
|
| +++ b/src/core/SkMatrix.cpp
|
| @@ -8,6 +8,7 @@
|
| #include "SkMatrix.h"
|
| #include "Sk64.h"
|
| #include "SkFloatBits.h"
|
| +#include "SkOnce.h"
|
| #include "SkScalarCompare.h"
|
| #include "SkString.h"
|
|
|
| @@ -1893,13 +1894,14 @@ SkScalar SkMatrix::getMaxStretch() const {
|
| return SkScalarSqrt(largerRoot);
|
| }
|
|
|
| +DEF_SK_ONCE(reset_identity_matrix, SkMatrix* identity) {
|
| + identity->reset();
|
| +}
|
| +
|
| const SkMatrix& SkMatrix::I() {
|
| + // If you can use C++11 now, you might consider replacing this with a constexpr constructor.
|
| static SkMatrix gIdentity;
|
| - static bool gOnce;
|
| - if (!gOnce) {
|
| - gIdentity.reset();
|
| - gOnce = true;
|
| - }
|
| + SK_ONCE(reset_identity_matrix, &gIdentity);
|
| return gIdentity;
|
| }
|
|
|
|
|