Dealing with SkScalar values in cache
Change-Id: I0da874242f243b3d3e71834240adc424bcb965c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266558
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
diff --git a/modules/skparagraph/src/TextStyle.cpp b/modules/skparagraph/src/TextStyle.cpp
index d4d1b81..1cae43d 100644
--- a/modules/skparagraph/src/TextStyle.cpp
+++ b/modules/skparagraph/src/TextStyle.cpp
@@ -107,10 +107,10 @@
return !fIsPlaceholder && !that.fIsPlaceholder &&
fFontStyle == that.fFontStyle &&
fFontFamilies == that.fFontFamilies &&
- fLetterSpacing == that.fLetterSpacing &&
- fWordSpacing == that.fWordSpacing &&
- fHeight == that.fHeight &&
- fFontSize == that.fFontSize &&
+ SkScalarNearlyEqual(fLetterSpacing, that.fLetterSpacing) &&
+ SkScalarNearlyEqual(fWordSpacing, that.fWordSpacing) &&
+ SkScalarNearlyEqual(fHeight, that.fHeight) &&
+ SkScalarNearlyEqual(fFontSize, that.fFontSize) &&
fLocale == that.fLocale;
}
@@ -179,11 +179,11 @@
}
bool PlaceholderStyle::equals(const PlaceholderStyle& other) const {
- return this->fWidth == other.fWidth &&
- this->fHeight == other.fHeight &&
- this->fAlignment == other.fAlignment &&
- this->fBaseline == other.fBaseline &&
- this->fBaselineOffset == other.fBaselineOffset;
+ return SkScalarNearlyEqual(fWidth, other.fWidth) &&
+ SkScalarNearlyEqual(fHeight, other.fHeight) &&
+ fAlignment == other.fAlignment &&
+ fBaseline == other.fBaseline &&
+ SkScalarNearlyEqual(fBaselineOffset, other.fBaselineOffset);
}
} // namespace textlayout