diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkPaint.cpp | 9 | ||||
-rw-r--r-- | src/views/animated/SkStaticTextView.cpp | 9 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 328836624c..372e68051e 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -161,6 +161,15 @@ SkPaint& SkPaint::operator=(const SkPaint& src) { return *this; } +bool operator==(const SkPaint& a, const SkPaint& b) { +#ifdef SK_BUILD_FOR_ANDROID + //assumes that fGenerationID is the last field in the struct + return !memcmp(&a, &b, SK_OFFSETOF(SkPaint, fGenerationID)); +#else + return !memcmp(&a, &b, sizeof(a)); +#endif +} + void SkPaint::reset() { SkPaint init; diff --git a/src/views/animated/SkStaticTextView.cpp b/src/views/animated/SkStaticTextView.cpp index bbef63dff3..0e4cad63e5 100644 --- a/src/views/animated/SkStaticTextView.cpp +++ b/src/views/animated/SkStaticTextView.cpp @@ -125,9 +125,12 @@ void SkStaticTextView::getPaint(SkPaint* paint) const void SkStaticTextView::setPaint(const SkPaint& paint) { - fPaint = paint; - this->computeSize(); - this->inval(NULL); + if (fPaint != paint) + { + fPaint = paint; + this->computeSize(); + this->inval(NULL); + } } void SkStaticTextView::onDraw(SkCanvas* canvas) |